What's the fastest way to migrate from boot2do

2019-03-28 20:17发布

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

1条回答
可以哭但决不认输i
2楼-- · 2019-03-28 20:44

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.

查看更多
登录 后发表回答