Windows上的Docker:已装入卷中的数据不会更新 [英] Docker on windows: data in mounted volume doesn't updated
问题描述
我使用以下命令在windows 10上运行docker:
I run docker on windows 10 with this command:
docker run -d -v /c/Users/tsh/docker:/usr/share/nginx/html -p 80:80 nginx
Inside 用户/ tsh / docker 文件夹我有简单的 index.html 文件:
Inside Users/tsh/docker folder I have simple index.html file:
<h1>Hello!</h1>
当我将浏览器指向Windows上的虚拟机IP时,我可以看到网页你好!显示。
但是当我将 index.html 的内容更改为:
It works perfectly well, when I point my browser on windows to virtualbox IP I can see web page with "Hello!" displayed. But when I change content of the index.html to something like:
<h1>Hello from docker!</h1>
网页仍然显示我旧的你好!
The web page still shows me the old "Hello!" text.
当我更改 index.html 网页上的数据是否可以更改?
Is it possible when I change index.html data on the web page is also changed?
更新:
docker run -it -v //c/Users/tsh/docker:/usr/share/nginx/html -p 80:80 nginx bash
root@ae5fc6b6126a:/# cd /usr/share/nginx/html
root@ae5fc6b6126a:/usr/share/nginx/html# cat index.html
<h1>Hello from docker!</h1>
root@ae5fc6b6126a:/usr/share/nginx/html#
容器查看新数据< h1>你好,从docker!< / h1>
,但页面仍然显示旧的 Hello!
Container see new data <h1>Hello from docker!</h1>
but page still shows the old Hello!
推荐答案
这个问题似乎与Virtualbox缓存有关。我也遇到过最近编辑CSS的问题并且我可以通过在Virtualbox中重新设置映像来创建解决方法。但是,我称之为解决方法,因为在每次对HTML文档进行编辑时,必须完全重新启动boot2docker映像并不是非常有用。
This problem appears to be related to Virtualbox caching. I also encountered this problem recently editing CSS and I was able to create a "workaround" by resetting the image in Virtualbox. But, I call this a workaround only in a vague sense since it is not very useful to have to completely reboot the boot2docker image each time you make an edit to an HTML doc.
这篇关于Windows上的Docker:已装入卷中的数据不会更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!