Unable to create docker virtual machine - docker

I was using boot2docker previously and everything was working fine. Now when I upgraded to using Docker Toolbox, I am unable to create a new virtual machine.
I am even unable to import the virtual machine that was used with boot2docker.
I get this error when trying to create a new machine:
C:\Program Files\Docker Toolbox\kitematic\resources\resources\docker-machine.exe -D create -d virtualbox --virtualbox-memory 2048 default returned non zero exit code. Stderr: Converting from raw image file="stdin" to file="C:\Users\disk.vmdk"... Creating dynamic image with size 20971520000 bytes (20000MB)... Error creating machine: exit status 1 You will want to check the provider to make sure the machine and associated resources were properly removed.
And I get this when trying to import the old vm that boot2docker used:'
C:\Users\pmandayam>docker-machine create -d virtualbox --virtualbox-import-boot2
docker-vm boot2docker-vm docker-vm
Creating VirtualBox VM...
Error creating machine: exit status 1
You will want to check the provider to make sure the machine and associated reso
urces were properly removed.
Assistance, is greatly appreciated.
Thank you,
Prithvi

I fixed this by reinstalling the Docker Toolbox, make sure you install all the components of the Oracle VM VirtualBox.

I think you have not installed kernel driver.
You can run this:
yum -y install kmod-VirtualBox-$(uname -r) kmod-VirtualBox
or
yum -y install akmod-VirtualBox kernel-devel-$(uname -r) akmods
systemctl restart systemd-modules-load.service
and you should make sure that your firewall have been stopped.

Installing the latest test build of Virtual Box solved the problem for me!
https://www.virtualbox.org/wiki/Testbuilds

The correct answer is actually
docker-machine rm DOCKERHOST
where DOCKERHOST is the machine name (e.g. boot2docker-vm in the original post above).

Related

Error in Docker: bad address to executables

I'm trying to something with Docker.
Steps I'm doing:
- Launch Docker Quickstart Terminal
- run docker run hello-world
Then I get error like:
bash: /c/Program Files/Docker Toolbox/docker: Bad address
I have to say that I was able to run hello-world image, but now I'm not. I don't know what happend.
I don't know if it matters however I had some problems at instalation step.
Since I have git installed in non standard location. However it seems git bash.exe working correctly for Docker.
My environment:
Windows 10
Git 2.5.0 (installed before Docker)
Docker Toolbox 1.9.1a
I have the same issue with bash: /c/Program Files/Docker Toolbox/docker: Bad address
I thought the problems is "bash doesn't support docker.exe".
SO I fix this problem by use powershell ,not the bash.
and if you use powershell maybe face this
An error occurred trying to connect: Get http://localhost:2375/v1.21/containers/json: dial tcp 127.0.0.1:2375: ConnectExenter code here
tcp: No connection could be made because the target machine actively refused it.
You can export variable from bash use export and import to powershell by this below
$env:DOCKER_HOST="tcp://192.168.99.100:2376"
$env:DOCKER_MACHINE_NAME="default"
$env:DOCKER_TLS_VERIFY="1"
$env:DOCKER_TOOLBOX_INSTALL_PATH="C:\\Program Files\\Docker Toolbox"
$env:DOCKER_CERT_PATH="C:\\Users\\kk580\\.docker\\machine\\machines\\default"
that's all
ps:I found this problem fixed by update git from 2.5.0 to 2.6.3.
Not entirely sure what the issue is, report it to the project on github. I find the docker mac and windows tools a bit flakey from time to time as they are still maturing. If you don't mind seeing what's underneath, you can try running docker-machine directly or set up your own host pretty quickly with Vagrant.
Docker Machine
Run a command or bash prompt to see what machines you have.
docker-machine ls
Create a machine if you don't have one listed
docker-machine create -d "virtualbox" default-docker
Then connect to the listed machine (or default-docker)
docker-machine ssh default-docker
Vagrant
If that doesn't work you can always use vagrant to manage VM's
Install VirtualBox (Which you probably have already if you installed the toolbox)
Reinstall Git, make sure you select the option for adding ALL the tools to your system PATH (for vagrant ssh)
Install Vagrant
Run a command or bash prompt
mkdir docker
cd docker
vagrant init debian/jessie64
vagrant up --provider virtualbox
Then to connect to your docker host you can run (from the same docker directory you created above)
vagrant ssh
Now your on the docker host, Install the latest docker the first time
curl https://get.docker.com/ | sudo sh
Docker
Now you have either a vagrant or docker-machine host up, you can docker away after that.
sudo docker run -ti busybox bash
You could also use PuTTY to connect to vagrant machines instead of installing git/ssh and running vagrant ssh. It provides a nicer shell experience but it requires some manual setup of the ssh connections.

Why is my docker machine not working under OSX?

I've installed Docker Toolbox v1.8.1b on OSX 10.10.5
This also installs VirtualBox v5.0.2
However, when the installation has finished and I run the Docker Quickstart Terminal, it does its thing, creates a new VM in virtualbox but then doesn't start it, finishing with the message that default is not running.
When I try to run the machine using docker-machine start default I get the message exit status 1.
When I go to VirtualBox and attempt to start the machine there, I get the following error message:
Failed to load VMMR0.r0 (VERR_VMM_SMAP_BUT_AC_CLEAR).
Result Code:
NS_ERROR_FAILURE (0x80004005)
Component:
ConsoleWrap
Interface:
IConsole {872da645-4a9b-1727-bee2-5585105b9eed}
So is anyone else getting this or am I not following the instructions properly?
I had exactly the same problem. It seems that there is a bug in recent versions of VirtualBox, which is fixed in the latest test build. See https://www.virtualbox.org/ticket/14412
I downloaded the latest VirtualBox test build from
https://www.virtualbox.org/wiki/Testbuilds
then used the uninstaller script provided in that installer to remove the buggy version before installing the new one.
Running the Docker QuickStart Terminal again got the default VM running, but it was missing a ca.pem file:
docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com
open /Users/justin/.docker/machine/machines/default/ca.pem: no such file or directory
VirtualBox confirmed that the VM was running.
I could create a new VM and use it with docker successfully (in a different Terminal window):
Justins-MacBook:~ justin$ docker-machine create --driver virtualbox dev
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env dev
Justins-MacBook:~ justin$ eval "$(docker-machine env dev)"
Justins-MacBook:~ justin$ docker run hello-world
...
I then deleted the default VM:
Justins-MacBook:.docker justin$ docker-machine stop default
Justins-MacBook:.docker justin$ docker-machine rm default
Successfully removed default
Running the Docker QuickStart Terminal created a new default VM, and docker is now working happily with it.
Update: There is an open issue for this at: https://github.com/docker/toolbox/issues/119
Just wanted to add: if you have docker for mac installed, they intentionally removed the docker-machine command starting from version 2.2.0.
You can find the discussion here: https://github.com/docker/for-mac/issues/4208
So, you need to install docker-machine separately, using the commands provided by #shivanikoko or using brew:
brew install docker-machine
ON Osx after installing docker or updating docker we have to reinstall the docker-machine again to make it work in CLI.
Running the command below helped me.
base=https://github.com/docker/machine/releases/download/v0.16.0 &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/usr/local/bin/docker-
machine &&
chmod +x /usr/local/bin/docker-machine

Vagrant mount error after installing Docker

I'm getting a strange error in my vagrant VM. So I created a new ubuntu/trusty64 VM using VirtualBox (on OS X if anyone cares).
All fine there...
Then I installed Docker as per the instructions which basically involves running
wget -qO- https://get.docker.com/ | sh
That works fine too.
Then I go to reboot the VM, I exit the ssh shell, and run vagrant reload and I get this error message.
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
The error output from the last command was:
stdin: is not a tty
/sbin/mount.vboxsf: mounting failed with the error: No such device
Any thoughts?
I faced similar issues. Looks like Docker (and potentially other tools) when installed will update the kernel version in your Ubuntu/Trusty64 guest. Since the VBox GuestAdditions that came preinstalled in Ubuntu/Trusty64 were specifically built against the original kernel version, the Guest Additions will stop working in the next vagrant up or vagrant reload as that's when the new kernel installed by Docker kicks in. At that point, Vagrant is no longer able to auto-mount /vagrant folder (or any synced folder for the matter) as the Guest Additions were built against a different kernel.
To get them working again you'd have to rebuild the GuestAdditions against the new kernel version that Docker installed.
Luckily, there's a plugin in Vagrant called vagrant-vbguest that takes care of automatically rebuilding the Guest Additions when the plugin detects they need to be rebuilt (i.e. like when the kernel in the guest changes, or you upgraded your VirtualBox version in the host)
So in my case, the easy way to fix it was to:
On the host: $ vagrant plugin install vagrant-vbguest
On the guest: $ sudo apt-get install linux-headers-$(uname -r)
On the host: $ vagrant reload
Thanks to the vagrant-vbguest plugin, new VBox GuestAdditions will be automatically rebuilt against the new version of your kernel (for which you would have downloaded the required headers in the second step above).
Once the GuestAdditions are back in shape, synchronized folders should be working again and the mapping of /vagrant should be successful.
Give it a try.

Docker complains about invalid certificate after update to v1.7.0

After updating to Docker v1.7.0 (and also boot2docker), I'm getting the following error when running docker ps:
x509: certificate is valid for 127.0.0.1, 10.0.2.15, not 192.168.59.103
Is this a known issue with this version, and what can I do to fix this?
This is a known issue introduced in version 1.7.0 of boot2docker: https://github.com/boot2docker/boot2docker/issues/824
Update to boot2docker 1.7.1
Updating to boot2docker 1.7.1 fixes this issue, as described here.
Options for boot2docker 1.7.0
It seems to be related to the way the network interfaces are coming up during boot. The following options can be used to fix this.
Option 1
The fix is to run the following sequence, which adds code to wait for all network interfaces to be present:
boot2docker ssh
sudo curl -o /var/lib/boot2docker/profile https://gist.githubusercontent.com/garthk/d5a17007c277aa5c76de/raw/3d09c77aae38b4f2809d504784965f5a16f2de4c/profile
sudo halt
boot2docker up
Source (and more details on the code that is downloaded): https://gist.github.com/garthk/d5a17007c277aa5c76de
This has fixed the issue for me, although I had to stop the boot2docker-vm through the VirtualBox UI to get a clean start.
The Gist adds the following to the .profile file in the boot2docker VM:
wait4eth1() {
CNT=0
until ip a show eth1 | grep -q UP
do
[ $((CNT++)) -gt 60 ] && break || sleep 1
done
sleep 1
}
wait4eth1
This function waits up to 1 minute for the eth1 interface to come up.
Option 2
Another option seems to be to do
boot2docker delete
boot2docker init
boot2docker up
This will destroy the boot2docker VM - you might lose any customizations you have done.
Simply running this command fixes the issue for me. This was suggested by a Docker employee via GitHub.
boot2docker ssh sudo /etc/init.d/docker restart
Unfortunately it needs to be run each time you start boot2docker.
I've found the following "easy" alternative to work. Use a shell alias:
alias docker="docker --tlsverify=false"
Thanks to Mark Duncan.
From the troubleshooting guide:
docker-machine regenerate-certs default
docker-machine restart default
And then you're good to go, just run this as usual
eval $(docker-machine env default)

docker-machine install fails due to 'Couldn't read CA cert' error

I am trying to setup docker-machine locally on my Windows machine and I followed the install instructions at the Docker Machine Page.
Per the instructions, I ran the following commands in my bash terminal
To install Docker client binary
$curl -L https://github.com/docker/machine/releases/download/v0.3.0/docker-machine_windows-amd64.exe > /bin/docker-machine
and to install Docker machine binary
$ curl -L https://github.com/docker/machine/releases/download/v0.3.0/docker-machine_windows-amd64.exe > /bin/docker-machine
when I try to run docker-machine -v I get the following error
FATAL[0000] Couldn't read ca cert 'C:\Users\Me\.boot2docker\certs\boot2doker-vm\ca.pm: open 'C:\Users\Me\.boot2docker\certs\boot2docker-vm'\ca.pem: The filename, directory name, or volume label syntax is incorrect.
I did some searching and came across a few posts, but can't really see any connection to what would be causing my issues...
https://github.com/hypriot/kitematic/pull/1
https://github.com/docker/machine/issues/908
I installed docker machine today on my Windows 7 machine and run the command without any problem.
Did you use boot2docker before on your machine? If you did, it might be related as mine is a clean machine without any pre-existing docker installations.
Its referring to boot2docker environment.
see this:
DOCKER_CERT_PATH="/Users//.docker/machine/machines/dev"
I got the same answer and was able to resolve it by changing the path pattern to be unix-style in the environment variable.
Inside msysgit bash shell:
export DOCKER_CERT_PATH=/C/Users/Me/.boot2docker/certs/boot2docker-vm
This resolved boot2docker.
Note that I also tried using docker-machine before using boot2docker which previously failed with the same error. That was not resolved the same way boot2docker could be resolved. For now only boot2docker is working for me.

Resources