如何将Dockerfile和应用程序文件部署到boot2docker [英] How to deploy Dockerfile and application files to boot2docker

查看:182
本文介绍了如何将Dockerfile和应用程序文件部署到boot2docker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始学习Docker,而我正在Windows上使用boot2docker进行简单的设置。我找不到任何教程或在线样本如何使我的项目文件可访问的boot2docker虚拟机。

I'm just starting to learn Docker, and I'm trying to get a simple setup with boot2docker on Windows. I could not find in any tutorial or samples online how to make my project files accessible to the boot2docker VM.

我下载了boot2docker,并成功安装它,并得到它并运行。我也可以ssh进入它并运行你好的世界码​​头代码示例,所以我知道我在VM中安装了一个工作的Docker。

I downloaded boot2docker, and succeeded in installing it and getting it up and running. I can also ssh into it and run the hello world docker example, so I know I have a working Docker installation in the VM.

现在, / strong>:如何在boot2docker VM上获取我的 Dockerfile 和我的应用程序文件,以便我可以构建一个Docker容器?

Now, the question: How do I get my Dockerfile and my application files on the boot2docker VM so that I can build a Docker container?

换句话说,我试图从boot2docker VM中执行此操作:

In other words, I'm trying to do this from the boot2docker VM:

$ cd /some-directory-from-my-host-os
$ docker build .

我尝试按照 https://github.com/boot2docker/boot2docker#folder-sharing 并设置一个SAMBA共享,我可以从Windows成功连接到 \\ \\\192.168.59.103\data ,但是并没有告诉我如何从boot2docker VM中访问相同的目录。

I tried following the instructions on https://github.com/boot2docker/boot2docker#folder-sharing and setup a SAMBA share, and I can successfully connect from Windows to the share at \\192.168.59.103\data but that doesn't tell me how to access that same directory from within the boot2docker VM.

我觉得答案可能很明显,但我相信我不是唯一一个会打墙的人。感谢您的帮助!

I feel like the answer might be obvious, but I'm sure I'm not the only one who will hit that wall. Thanks for your help!

由于boot2docker 1.3,加载了共享文件夹的功能已经添加,所以VM可以直接共享您的dev文件夹。更多信息: https://github.com/boot2docker/boot2docker#virtualbox-guest-additions

Since boot2docker 1.3, the ability to mount a shared folder has been added, so the VM can share your dev folder directly. More information here: https://github.com/boot2docker/boot2docker#virtualbox-guest-additions

推荐答案

不知道是否在Windows下有帮助。但是对于Mac,请参阅:

Not sure if it helps under windows. But for Mac see:

boot2docker与VirtualBox Guest添加一起

如何将/ Users加载到boot2docker

boot2docker together with VirtualBox Guest Additions
How to mount /Users into boot2docker

https://medium.com/boot2docker-lightweight-linux-for-docker/boot2docker-together-with-virtualbox-guest-additions-da1e3ab2465c


tl; dr使用VirtualBox创建自己的自定义boot2docker.iso
添加(请参阅链接)或下载
http ://static.dockerfiles.io/boot2docker-v1.0.1-virtualbox-guest-additions-v4.3.12.iso
并将其保存到〜/ .boot2docker / boot2docker.iso。

tl;dr Build your own custom boot2docker.iso with VirtualBox Guest Additions (see link) or download http://static.dockerfiles.io/boot2docker-v1.0.1-virtualbox-guest-additions-v4.3.12.iso and save it to ~/.boot2docker/boot2docker.iso.

这篇关于如何将Dockerfile和应用程序文件部署到boot2docker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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