40

重启docker之后输入ls找不到挂载的文件了,请问怎么回事?(vmware启动docker虚拟机)

一开始就把共享文件夹挂载到创建好的目录下:

docker@boot2docker:~$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                    PORTS               NAMES
327d1c34552e        python              "python3"           12 hours ago        Exited (0) 12 hours ago                       condescending_snyder
docker@boot2docker:~$ mount 
tmpfs on / type tmpfs (rw,relatime,size=911772k)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,relatime)
/dev/sda1 on /mnt/sda1 type ext4 (rw,relatime,data=ordered)
cgroup on /sys/fs/cgroup type tmpfs (rw,relatime,mode=755)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu type cgroup (rw,relatime,cpu)
cgroup on /sys/fs/cgroup/cpuacct type cgroup (rw,relatime,cpuacct)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,relatime,net_cls)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,relatime,perf_event)
cgroup on /sys/fs/cgroup/net_prio type cgroup (rw,relatime,net_prio)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,relatime,hugetlb)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,relatime,pids)
vmhgfs-fuse on /mnt/hgfs type fuse.vmhgfs-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sda1 on /mnt/sda1/var/lib/docker type ext4 (rw,relatime,data=ordered)
docker@boot2docker:~$ sudo umount /mnt/hgfs
docker@boot2docker:~$ vmware-hgfsclient
Users
docker_spider_system
docker@boot2docker:~$ mkdir docker_test
docker@boot2docker:~$ cd docker_test/
docker@boot2docker:~/docker_test$ pwd
/home/docker/docker_test
docker@boot2docker:~/docker_test$ sudo vmhgfs-fuse .host:/docker_spider_system /home/docker/docker_test -o subtype=vmhgfs-fuse,allow_other
docker@boot2docker:~/docker_test$ mount
tmpfs on / type tmpfs (rw,relatime,size=911772k)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,relatime)
/dev/sda1 on /mnt/sda1 type ext4 (rw,relatime,data=ordered)
cgroup on /sys/fs/cgroup type tmpfs (rw,relatime,mode=755)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu type cgroup (rw,relatime,cpu)
cgroup on /sys/fs/cgroup/cpuacct type cgroup (rw,relatime,cpuacct)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,relatime,net_cls)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,relatime,perf_event)
cgroup on /sys/fs/cgroup/net_prio type cgroup (rw,relatime,net_prio)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,relatime,hugetlb)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,relatime,pids)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sda1 on /mnt/sda1/var/lib/docker type ext4 (rw,relatime,data=ordered)
vmhgfs-fuse on /home/docker/docker_test type fuse.vmhgfs-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
docker@boot2docker:~/docker_test$ docker run -it -v /home/docker/docker_test/:/root --name python python:3.7 /bin/bash
root@6fafc7bbaab3:/# ls
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
root@6fafc7bbaab3:/# cd root
root@6fafc7bbaab3:~# ls
Dockerfile  __init__.py  __pycache__  decode_data.py  handle_appium_docker.py  handle_mongo.py  test.py  常用命令
root@6fafc7bbaab3:~# python test.py
前期环境创建成功!!!

重启docker之前

docker@boot2docker:~/docker_test$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS                        PORTS                                        NAMES
30df6a654394        python:3.7          "/bin/bash"              About a minute ago   Exited (127) 29 seconds ago                                                python
5a0a3828ad00        appium/appium       "/bin/sh -c '/root/w…"   18 hours ago         Exited (255) 16 hours ago     4567/tcp, 4723/tcp, 0.0.0.0:4727->4727/tcp   appium_jrtt
3d8a34263166        appium/appium       "/bin/sh -c '/root/w…"   18 hours ago         Exited (255) 16 hours ago     4567/tcp, 4723/tcp, 0.0.0.0:4725->4725/tcp   appium_kuaishou
d7fbcbc5fb87        appium/appium       "/bin/sh -c '/root/w…"   18 hours ago         Exited (255) 16 hours ago     4567/tcp, 0.0.0.0:4723->4723/tcp             appium_douyin

docker@boot2docker:~/docker_test$ docker start 30df6a654394
30df6a654394

docker@boot2docker:~/docker_test$ docker exec -it 30df6a654394 /bin/bash
root@30df6a654394:/# ls
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
root@30df6a654394:/# cd root
root@30df6a654394:~# ls
Dockerfile  __init__.py  __pycache__  decode_data.py  handle_appium_docker.py  handle_mongo.py  test.py  常用命令
root@30df6a654394:~# python test.py
前期环境创建成功!!!

启动之后输入ls找不到挂载的文件了,请问怎么回事?:


docker@boot2docker:~$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                        PORTS                                        NAMES
30df6a654394        python:3.7          "/bin/bash"              8 minutes ago       Exited (255) 47 seconds ago                                                python
5a0a3828ad00        appium/appium       "/bin/sh -c '/root/w…"   18 hours ago        Exited (255) 16 hours ago     4567/tcp, 4723/tcp, 0.0.0.0:4727->4727/tcp   appium_jrtt
3d8a34263166        appium/appium       "/bin/sh -c '/root/w…"   18 hours ago        Exited (255) 16 hours ago     4567/tcp, 4723/tcp, 0.0.0.0:4725->4725/tcp   appium_kuaishou
d7fbcbc5fb87        appium/appium       "/bin/sh -c '/root/w…"   18 hours ago        Exited (255) 16 hours ago     4567/tcp, 0.0.0.0:4723->4723/tcp             appium_douyin
docker@boot2docker:~$ docker start 30df6a654394
30df6a654394
docker@boot2docker:~$ docker exec -it 30df6a654394 /bin/bash
root@30df6a654394:/# ls
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
root@30df6a654394:/# cd root
root@30df6a654394:~# ls
root@30df6a654394:~# 
查看全部
weixin_43256057
weixin_43256057
2019/10/19 12:10
  • python
  • 点赞
  • 收藏
  • 回答
    私信

1个回复