SACn
SACn

Reputation: 1924

Simultaneous Docker and VirtualBox

Is there any way with which docker can be executed alongside virtualbox or vmware workstation. As I understand docker installer in Windows requires Hyper-V which needs to be disabled for VirtualBox or Workstation.

Upvotes: 0

Views: 842

Answers (2)

zveljkovic
zveljkovic

Reputation: 444

Install latest Docker for Windows, and VirtualBox. When asked from DfW about enabling Hyper-V cancel it, VirtualBox doesn't work with it, but you can use docker-machine with VirtualBox driver to run docker containers. I had some errors starting the docker machine in VB so here's full guide.

Go to Command Prompt and issue

docker-machine create -d virtualbox --virtualbox-ui-type "gui" default

You can look the boot2docker booting and docker-machine still don't see the IP. After 5 minutes it will timeout with error "Error creating machine: Error in driver during machine creation: Too many retries waiting for SSH to be available. Last error: Maximum number of retries (60) exceeded".

Next command is docker-machine stop default. Download and start Process Explorer, we will try to see the command that gives out error. Issue docker-machine start default in console while Process Explorer is open. Quickly search for docker-machine process and click on ssh.exe child it spawned. Then right click it and select properties and copy Command line text (hint HOME, SHIFT+END, CTRL+C).

Mine looked like:

C:\WINDOWS\System32\OpenSSH\ssh.exe -F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none [email protected] -o IdentitiesOnly=yes -i C:\Users\zvelj\.docker\machine\machines\default\id_rsa -p 55011 "exit 0"

Add the verbose flag -v before "exit 0" so we can see what is the error. In my case it was "WARNING: UNPROTECTED PRIVATE KEY FILE!". To fix that find that private key, right click, select Properties, in dialog go Security tab, Advanced button, Change owner to you, Disable inheritance (remove all), Add new permission entry for your account with full control.

Now issue docker-machine stop default and docker-machine start default. Then just follow instructions in console.

docker-machine regenerate-certs default @FOR /f "tokens=*" %i IN ('docker-machine env') DO @%i To verify run docker-machine ls and look for * in ACTIVE column.

To change it back to headless mode you need to change line in "C:\Users{{YOUR USERNAME}}.docker\machine\machines\default\config.json" "UIType": "guid", to "UIType": "headless",

You will have to shell variables with @FOR /f "tokens=*" %i IN ('docker-machine env') DO @%i to enable docker commands for new consoles. Probably best to create a bash script which does that automatically and offers menu choices for starting/stopping containers

Upvotes: 2

barat
barat

Reputation: 1058

I think that only solution might be to use Docker Toolbox (which uses Virtualbox) instead of Docker for Windows ...

https://github.com/docker/for-win/issues/6

Quote from this issue:

I'm closing this issue. While we understand the background for the request, we currently have no concrete plans to offer other virtualization backends for Docker for Windows for the reasons outlined above. We continue having Toolbox and docker-machine updates for non-Hyper-V users.

Upvotes: 1

Related Questions