简体   繁体   English

在Docker中挂载了一个卷,但是容器和本地主机的更改是独立的

[英]Mounted a volume in Docker, but container and localhost changes are independent

I think I may either be experiencing an error, or misunderstanding the way volumes work in Docker containers. 我认为我可能遇到错误,或者误解了Docker容器中卷的工作方式。

I am starting my image using the following command: docker run --name Goku -ti -p 3000:3000 -v VSPM:/root/goku:rw ubuntu:goku 我正在使用以下命令启动映像docker run --name Goku -ti -p 3000:3000 -v VSPM:/root/goku:rw ubuntu:goku

VSPM is the local directory and I am wanting to mount it to /root/goku on the docker container. VSPM是本地目录,我想将其挂载到VSPM容器上的/root/goku上。 Well, it mounts just fine; 好吧,它安装得很好。 however, if I create a new file within the container, that new file doesn't show on the localhost in the VSPM directory. 但是,如果我在容器中创建一个新文件,则该新文件不会显示在VSPM目录中的localhost上。 The same vice versa -- if I create a new file on the host in that folder, nothing changes in the container's folder. 反之亦然-如果我在主机上的该文件夹中创建一个新文件,则该容器的文件夹中没有任何更改。

What am I doing wrong? 我究竟做错了什么? I just simply want a shared folder between the host and the container. 我只希望主机和容器之间有一个共享文件夹。 Nothing more, nothing less. 仅此而已。

使用本地安装的驱动器的完整文件路径,而不仅仅是VSPM

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM