我正在尝试将主机目录挂载到Docker容器中,以便在主机上完成的任何更新都反映到Docker容器中。
我哪里做错了。这是我做的:
kishore$ cat Dockerfile
FROM ubuntu:trustyRUN apt-get updateRUN apt-get -y install git curl vimCMD ["/bin/bash"]WORKDIR /test_containerVOLUME ["/test_container"]
kishore$tree.──Dockerfile──main_folder──tfile1.txt──tfile2.txt──tfile3.txttfile4.txt
1个目录,5个文件kishore$pwd/Users/kishore/tdock
kishore$docker build--tag=k3_s3:最新。
Uploading context 7.168 kBUploading contextStep 0 : FROM ubuntu:trusty---> 99ec81b80c55Step 1 : RUN apt-get update---> Using cache---> 1c7282005040Step 2 : RUN apt-get -y install git curl vim---> Using cache---> aed48634e300Step 3 : CMD ["/bin/bash"]---> Running in d081b576878d---> 65db8df48595Step 4 : WORKDIR /test_container---> Running in 5b8d2ccd719d---> 250369b30e1fStep 5 : VOLUME ["/test_container"]---> Running in 72ca332d9809---> 163deb2b1bc5Successfully built 163deb2b1bc5Removing intermediate container b8bfcb071441Removing intermediate container d081b576878dRemoving intermediate container 5b8d2ccd719dRemoving intermediate container 72ca332d9809
docker run-d-v /Users/kishore/main_folder:/test_containerk3_s3:最新
c9f9a7e09c54ee1c2cc966f15c963b4af320b5203b8c46689033c1ab8872a0ea
kishore$docker run-i-tk3_s3:最新 /bin/bash
root@0f17e2313a46:/test_container# ls -altotal 8drwx------ 2 root root 4096 Apr 29 05:15 .drwxr-xr-x 66 root root 4096 Apr 29 05:15 ..
root@0f17e2313a46:/test_container#退出退出
kishore$docker-vDocker版本0.9.1,构建867b2a9
问题,面临的问题:
run -d -v
命令的情况下执行此操作?