我是用dockerfile build的镜像:VOLUME /home/user/web
我开启容器,进到bash,进到这个目录,然后新建了一个文件,
然后我回主机目录去查看,但是没有啊?不是说这样挂着的,在容器里面修改了,主机目录会马上出现吗?
ringa_lee2017-04-26 09:04:19
Using VOLUME in the Dockerfile only declares a volume, which is a mount point. When mounting locally, you need to specify the local directory through -v when running to mount it on the volume you have declared. Of course, for Docker will automatically create undeclared volumes.
PHP中文网2017-04-26 09:04:19
Directory to be mounted when running:
docker run -v hostpath:/home/user/web xximg
曾经蜡笔没有小新2017-04-26 09:04:19
You need to use -v to hang in the directory. You can also consider docker-compose.