34

Running boot2docker with the start|info|stop|delete arguments result in an error message:

snowch$ boot2docker start
error in run: Failed to get machine "boot2docker-vm": machine does not exist    
snowch$ boot2docker info
error in run: Failed to get machine "boot2docker-vm": machine does not exist
snowch$ boot2docker stop
error in run: Failed to get machine "boot2docker-vm": machine does not exist
snowch$ boot2docker delete
error in run: Failed to get machine "boot2docker-vm": machine does not exist

The init error was slightly different

snowch$ boot2docker init
error in run: Failed to initialize machine "boot2docker-vm": exit status 1

How can I fix this?

1

10 Answers 10

42

In the end, I removed the boot2docker-vm virtual machine:

snowch$ rm -rfi ~/VirtualBox\ VMs/boot2docker-vm/

Original source of the answer: https://github.com/boot2docker/boot2docker/issues/436

Note: this method is probably the quickest but you will lose your existing boot2docker virtual machine. If you want to keep your existing boot2docker virtual machine, you could try Patrick Henning's answer

1
  • 2
    For me, the problem was that I had to update where VirtualBox wanted to store the VM images. I had moved my home directory some time back, so VirtualBox was trying to write to a directory that didn't exist. Nov 12, 2014 at 16:59
36

Update: Boot2Docker is now legacy. See here for official deprecation notice: https://docs.docker.com/installation/mac/, and here for info on migrating a preexisting Boot2Docker vm to Docker Machine: https://docs.docker.com/machine/migrate-to-machine/.

I've yet to see whether this issue continues to exist or if an analogous solution to that below, running docker-machine with the appropriate flags in place of boot2docker, would help remedy it.


This worked for me and I kept all my images/containers. I followed Anthony A's response: https://stackoverflow.com/a/26592419/4377364.

Here are the exact steps:

$ boot2docker -v info

{
    "Name": "boot2docker-vm",
    "UUID": "470abff4-f4fe-4c24-90c5-32b3ef7bfbe2",
    "Iso": "/Users/pat/.boot2docker/boot2docker.iso",
    "State": "saved",
    "CPUs": 4,
    "Memory": 2048,
    "VRAM": 8,
    "CfgFile": "/Users/pat/VirtualBox VMs/boot2docker-vm/boot2docker-vm.vbox",
    "BaseFolder": "/Users/pat/VirtualBox VMs/boot2docker-vm",
    "OSType": "",
    "Flag": 0,
    "BootOrder": null,
    "DockerPort": 0,
    "SSHPort": 2022,
    "SerialFile": "/Users/pat/.boot2docker/boot2docker-vm.sock"
}

Note: "State": "saved".

Identified the .vbox file:

"CfgFile": "/Users/pat/VirtualBox VMs/boot2docker-vm/boot2docker-vm.vbox"

Used this as input to start the VM:

$ VBoxManage startvm "/Users/pat/VirtualBox VMs/boot2docker-vm/boot2docker-vm.vbox"

Then to shut it down:

$ VBoxManage controlvm "/Users/pat/VirtualBox VMs/boot2docker-vm/boot2docker-vm.vbox" acpipowerbutton

Verified it had actually shut down:

$ boot2docker -v info

{
    "Name": "boot2docker-vm",
    "UUID": "470abff4-f4fe-4c24-90c5-32b3ef7bfbe2",
    "Iso": "/Users/pat/.boot2docker/boot2docker.iso",
    "State": "poweroff",
    "CPUs": 4,
    "Memory": 2048,
    "VRAM": 8,
    "CfgFile": "/Users/pat/VirtualBox VMs/boot2docker-vm/boot2docker-vm.vbox",
    "BaseFolder": "/Users/pat/VirtualBox VMs/boot2docker-vm",
    "OSType": "",
    "Flag": 0,
    "BootOrder": null,
    "DockerPort": 0,
    "SSHPort": 2022,
    "SerialFile": "/Users/pat/.boot2docker/boot2docker-vm.sock"
}

Note: "State": "poweroff".

Started the boot2docker VM:

$ boot2docker up

Waiting for VM and Docker daemon to start...
.................ooo
Started.
0
13
  • Error:

error in run: Failed to start machine "boot2docker-vm": exit status 1

  • Solution:

// WARNING: this will delete all your images

  1. rm -rfi ~/VirtualBox\ VMs/boot2docker-vm/

  2. boot2docker init

  3. boot2docker start

  4. docker ps -a

3
  • It looks like you are giving a solution to a different error. You could post a new question similar to my question, and tick the box 'answer your own question' to add the answer.
    – Chris Snow
    Nov 2, 2014 at 8:43
  • As @ChrisSnow notes, your post is about something different. Please read questions very carefully in the future. It doesn't help to have someone looking for solutions to one error, and seeing something telling them what to do about a different error. They'll end up causing themselves more grief, and not resolving the problem. I have to down vote for such a potentially harmful answer. Nov 2, 2014 at 21:56
  • It works because although the error message is different, the steps posted in the answer are basically the same.
    – Chris Snow
    Aug 10, 2015 at 12:15
6

Start with boot2docker -v info to see where the images and files should be.

{
    "Name": "boot2docker-vm",
    "UUID": "dbd28698-2cab-43d2-8e37-f6c07bd15137",
    "Iso": "/Users/ezrak/.boot2docker/boot2docker.iso",
    "State": "running",
    "CPUs": 8,
    "Memory": 2048,
    "VRAM": 8,
    "CfgFile": "/Users/ezrak/VirtualBox VMs/boot2docker-vm/boot2docker-vm.vbox",
    "BaseFolder": "/Users/ezrak/VirtualBox VMs/boot2docker-vm",
    "OSType": "",
    "Flag": 0,
    "BootOrder": null,
    "DockerPort": 0,
    "SSHPort": 2022,
    "SerialFile": "/Users/ezrak/.boot2docker/boot2docker-vm.sock"
}

If you get errors running this command or the files mentioned in its output are missing I recommend you to re-install boot2docker as it is probably the quickest option to a state of normality.

If not, use the information returned to identify your Virtual Box image for boot2docker (Iso, CfgFile, BaseFolder and SerialFile) and use Virtual Box to start up the image and then shut it down completely.

If you get no issues with this operation then boot2docker -v info should give you the State of the boot2docker-vm (i.e. it should be poweroff at this point).

From here you should be able to succeed with the boot2docker up command (there is no boot2docker start) and boot2docker init should return Virtual machine boot2docker-vm already exists, if not then a re-install is probably in order anyway.

Also please check the usual suspects such as file permissions etc.

HTH

1
  • 1
    @AnthonyA "use Virtual Box to start up the image and then shut it down completely." Worked great. Thanks. Dec 26, 2014 at 4:55
2

This works for me :

vboxmanage discardstate boot2docker-vm
boot2docker up
1

One to watch out for, I had an old installation of virtual box from before i migrated over to a new machine. It had an old home folder in the preferences. This meant that when docker tries to init the vm, it tries to do so in ~/oldaccount

If you open up preferences in virtual box, you can change to your existing account.

0

The currently accepted answer to this question has you removing the boot2docker vm completely. That'll work, but it will also leave you without any of your docker cache or saved volume shares done through

vboxmanage sharedfolder add "boot2docker-vm" ...

That's obviously not ideal, especially if you're sharing a lot of volumes between your host system and your vm, or if your builds take a long time.

For me, the error in run: Failed to get machine "boot2docker-vm": machine does not exist appears on system restarts. VirtualBox is trying to be smart and "saves" the vm, which is a state boot2docker doesn't seem able to gracefully recover from. To fix this, go into VirtualBox, and power-down the vm. Then go back to boot2docker and run boot2docker up. Now that the vm has been gracefully powered down, boot2docker should be able to bring it up just fine.

0

First execute the boot2docker application. This sets some variables, and creates the ~/.boot2docker directory. Once this is done, boot2docker up/down will work for you.

0

the accepted solution did not work for me

I had to export the boot2docker env variables

export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/USERNAME/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
0

I had the same problem on my mac after restarting it. A restart of OS X made VirtualBox suspend all VMs (incl. boot2docker).

Opening VirtualBox and starting the suspended instance fixed the problem and I could reuse docker.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.