Docker小记

Docker小记

  由于ubuntu16.04还不支持paddle paddle,所以就用了下docker。官网上安装都很详细了,这里记录一些比较蛋疼的方法。如果你想要在运行的docker容器里面访问ubuntu本地的文件咋办?你发现运行一个容器进入了一个新linux环境,无法看到你的ubuntu主机文件了,更不用说访问和运行了。此时就需要知道docker和宿主机之间的数据共享了!

docker share data between a docker container and host system using volumes

mkdir data1
echo "docker data share with host system" >> data1/file

docker run -v $PWD/data1:/opt/data1 -it paddledev/paddle:cpu-latest /bin/bash
cat /opt/data1/file

Error 1:
FATA[0000] Error response from daemon: cannot bind mount volume: data1 volume paths must be absolute.
You need to supply a full path to both source and destination directories. Hint: the full path always starts with /. 

Error 2:
# ls /opt/data1/ 
ls: cannot open directory /opt/data1/: Permission denied
This error is caused by SElinux running on your local host system. The following two solutions will help to solve this issue. First, solution is to disable SElinux on your local host system.
# setenforce 0

Since disabling the SElinux may hinder an integrity of your host system it may be easier to give an extended privileges to your container instead, with a docker --privileged=true option:
# docker run --privileged=true -v $PWD/data1:/opt/data1 -it paddledev/paddle:cpu-latest /bin/bash
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值