使用boot2docker从主机共享代码目录不会在guest虚拟机上调用inotify [英] Sharing code directory from host with boot2docker does not call inotify on guest

查看:101
本文介绍了使用boot2docker从主机共享代码目录不会在guest虚拟机上调用inotify的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用boot2docker/Virtualbox设置开发环境.与docker容器共享主机上的文件夹是可行的,但是由于它是通过Virtualbox共享文件夹共享的,因此inotify不会在容器内部触发(并且不会重新加载代码).

I am trying to setup a dev environment with boot2docker/Virtualbox. Sharing a folder on the host with the docker container works, but since it is shared through a Virtualbox shared folder inotify does not trigger inside the container (and the code is not reloaded).

有没有一种方法可以使用boot2docker将源文件夹放入docker映像中,而该映像仍会触发容器中的inotify?我宁愿不使用轮询,因为在Virtualbox共享中使用轮询会给主机带来沉重的CPU开销.

Is there a way to get the source folder into a docker image with boot2docker that still triggers inotify in the container? I would rather not use polling, since using polling inside a Virtualbox share has a heavy CPU cost on the host.

推荐答案

这是boot2docker的局限性,因为这种双层间接访问必须使用Virtual box进行,而另一项则使用docker.看起来您最好设置自己的Vagrant计算机,并使用其他方法之一通过上述评论中提到的NFS,RSYNC或Unison插件来共享文件夹

That is boot2docker limitation because of this double layers of indirection you have to go through one with Virtual box and another is with docker. Looks like you will be better off setting up your own Vagrant machine and use one of alternative methods to share the folders, either through NFS, RSYNC or Unison plugin mentioned in the comment above

这篇关于使用boot2docker从主机共享代码目录不会在guest虚拟机上调用inotify的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆