Docker + Ubuntu + Virtualbox:“卷” dockerfile中的指令不工作 [英] Docker + Ubuntu + Virtualbox: "volumes" directive in dockerfile not working

查看:345
本文介绍了Docker + Ubuntu + Virtualbox:“卷” dockerfile中的指令不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Docker + Ubuntu + Virtualbox:dockerfile中的volumes指令不工作?请参阅下面的解决方案。

解决方案

只是在这里测试Docker,并且已经在前面了一个问题:



之后,您使用 docker-machine ssh [name] 输入您的计算机,您必须创建一个符号链接到 / home $ b

ln -s/ Users / [您的用户名] / $ {d}/ home / $ {d}



从这里,映射必须是正确的,你好去吧! \o /



PS到前端:如果您打算使用 vboxmanage controlvm default natpf135729,tcp,127.0.0.1,35729 ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 35729在您的终端(不在码头机内,在主机) - 只是一次所有项目。


Docker + Ubuntu + Virtualbox: "volumes" directive in dockerfile not working? See the solution below.

解决方案

Just testing Docker here and already in front an issue: the "volumes" directive in dockerfile seems like not working in Ubuntu -- OK in Mac and Windows. All the proccess with and alright and the environment ups, but the filesystem without the sharing folders.

After trying MANY things and a lot of researching with my pals, we found this issue in GitHub: "Add support to mount Linux host homedir".

Basically, the problem is the fail of Docker in mount host home dir in container. They plan to include the fix in future releases, but, meanwhile, if you need to use right now, here is what you have to do.

Open Virtualbox interface, right click in your machine, Settings > Shared Folders. You can delete whatever is filled and add a new one. In path, choose your /home and name Users (could be whatever name, but this one is for name consistency with Mac and Windows). Check automatic mounting and persistence and press "OK".

After that, you enter in your machine with docker-machine ssh [name] and you have to create a symlink to the /home of the guest from your shared home folder in docker (host already mapped):

ln -s "/Users/[your username]/${d}" "/home/${d}"

From here, the mapping must be alright and you good to go! \o/

PS to frontenders: if you intend to use LiveReload in your projects, you need to run vboxmanage controlvm default natpf1 "35729,tcp,127.0.0.1,35729,,35729" in your terminal (not inside docker machine, in host) -- just once for all projects.

这篇关于Docker + Ubuntu + Virtualbox:“卷” dockerfile中的指令不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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