在Mac OS X上从boot2docker迁移到Vagrant + NFS的最快方法是什么? [英] What's the fastest way to migrate from boot2docker to Vagrant+NFS on Mac OS X?
问题描述
docker pull mysql
构建。 我有一个后端应用程序 cms
/ code>建立与Symfony。
我已经为应用程序
和 cms
开始并自动连接到 db
。
一切都很好,但是boot2docker的速度非常慢。
我一直在努力了解如何使用Vagrant与NFS。
在线有一些不同的教程和示例,但到目前为止,我一直无法开始。我安装了最新的Vagrant,并使用例子 yungsang / boot2docker
,但是当我尝试最简单的命令 docker images
得到错误,如 FATA [0000]尝试连接发生错误:Get https:// localhost:2375 / v1.16 / images / json:tls:已收到的长度为20527的超大记录。
我发现如果我将$ code> vagrant ssh 加入虚拟机,我可以运行 docker图像
等等,但这不是我想要的;我习惯于直接从Mac OS X终端运行docker命令。很明显我误解了一些东西。此外,Vagrant博客上的教程也使用 rsync
和 - provider = docker
,这似乎也不需要使用yangsang / boot2docker vagrant box。
感谢您的指导,感觉我已经用尽了我的Google搜索功能。
参考文献:
https://www.vagrantup.com/blog/feature-preview-vagrant-1-6-docker-dev-environments.html 一>
https://github.com/boot2docker/boot2docker/issues/64
https://vagrantcloud.com/yungsang/boxes/boot2docker
更新[2015-02-11]
回答更广泛的问题在标题中)我已经在Github上创建了一个Vagrantfile,它可以让您从Mac OS上快速方便地开始使用Vagrant + Docker + NFS。
https://github.com/blinkreaction/boot2docker-vagrant
tls:超大记录记录的原始答案发生问题[2015-02-10]
问题
检查您的环境变量。您最有可能混合使用 boot2docker shellinit
和您的自定义 DOCKER_HOST
变量。例如:
$ env | grep DOCKER
DOCKER_HOST = tcp:// localhost:2375
DOCKER_CERT_PATH = / Users /< user> /。boot2docker / certs / boot2docker-vm
DOCKER_TLS_VERIFY = 1
你这里的原因是第一个 $(boot2docker shellinit)
导出这样的东西,将Docker客户端指向boot2docker VM:
DOCKER_HOST = tcp://192.168.59.103:2376
DOCKER_CERT_PATH = / Users /< user> /。boot2docker / certs / boot2docker -vm
DOCKER_TLS_VERIFY = 1
然后,您将Docker客户端指向自定义VM映射端口与
export DOCKER_HOST = tcp:// localhost:2375
如何修复
短期
unset DOCKER_TLS_VERIFY
长期
您的 .bashrc
, .zshrc中的
等文件,并在需要时手动执行,或按以下顺序执行: $(boot2docker shellinit)
#Docker(基于Vagrant的框默认)
export DOCKER_HOST = tcp:// localhost:2375
#boot2docker shellinit
$(boot2docker shellinit)
如果boot2docker未运行,您的 DOCKER_HOST
将默认为 tcp:// localhost:2375
。
否则 $(boot2docker shellinit)
将覆盖变量,设置 DOCKER_HOST
指向boot2docker VM。
I have a database container built from the official mysql docker pull mysql
.
I have a front-end app app
built with Cake.
I have a back-end app cms
built with Symfony.
I have container linking set up for both app
and cms
to start and connect automatically to db
.
Everything works great but it's super slow with boot2docker.
I've been trying to understand how to use Vagrant with NFS.
There's a few different tutorials and examples online, but so far I've been unable to get going. I have installed the latest Vagrant and used the example yungsang/boot2docker
but when I try the simplest command docker images
I keep getting errors like FATA[0000] An error occurred trying to connect: Get https://localhost:2375/v1.16/images/json: tls: oversized record received with length 20527.
I discovered that if I vagrant ssh
into the VM, I can run docker images
and such, but that's not what I wanted; I am used to running docker commands straight from the Mac OS X terminal. So clearly I've misunderstood something. Also the tutorials on the Vagrant blog use rsync
and --provider=docker
which also doesn't seem necessary to use the yungsang/boot2docker vagrant box.
I would be grateful for some guidance and feel like I exhausted my Google search capabilities on this one.
Refs:
https://www.vagrantup.com/blog/feature-preview-vagrant-1-6-docker-dev-environments.html https://github.com/boot2docker/boot2docker/issues/64 https://vagrantcloud.com/yungsang/boxes/boot2docker
Update [2015-02-11]
To answer the broader question (the one in the title) I've created a repo on Github with a Vagrantfile which will let you start with Vagrant+Docker+NFS on MacOS quickly and easily.
https://github.com/blinkreaction/boot2docker-vagrant
Original answer to the "tls: oversized record received" issue [2015-02-10]
The issue
Check your environment variables. You most likely have a mix of boot2docker shellinit
and your custom DOCKER_HOST
variables there. E.g.:
$ env|grep DOCKER
DOCKER_HOST=tcp://localhost:2375
DOCKER_CERT_PATH=/Users/<user>/.boot2docker/certs/boot2docker-vm
DOCKER_TLS_VERIFY=1
The reason you got here is first $(boot2docker shellinit)
exported something like this to point the docker client to the boot2docker VM:
DOCKER_HOST=tcp://192.168.59.103:2376
DOCKER_CERT_PATH=/Users/<user>/.boot2docker/certs/boot2docker-vm
DOCKER_TLS_VERIFY=1
Then you pointed your docker client to the custom VM mapped port with
export DOCKER_HOST=tcp://localhost:2375
How to fix
Short term
unset DOCKER_TLS_VERIFY
Long term
Either get rid of the $(boot2docker shellinit)
in your .bashrc
, .zshrc
, etc. file and execute it manually when needed or have it in the following order there:
# Docker (default for Vagrant based boxes)
export DOCKER_HOST=tcp://localhost:2375
# boot2docker shellinit
$(boot2docker shellinit)
This way if boot2docker is NOT running, your DOCKER_HOST
will default to tcp://localhost:2375
.
Otherwise $(boot2docker shellinit)
will overwrite the variables and set DOCKER_HOST
to point to the boot2docker VM.
这篇关于在Mac OS X上从boot2docker迁移到Vagrant + NFS的最快方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!