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?
This works for me :
the accepted solution did not work for me
I had to export the boot2docker env variables
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 ofboot2docker
, 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
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
Note:
"State": "poweroff"
.Started the boot2docker VM:
$ boot2docker up
Start with
boot2docker -v info
to see where the images and files should be.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
andSerialFile
) 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 theState
of the boot2docker-vm (i.e. it should bepoweroff
at this point).From here you should be able to succeed with the
boot2docker up
command (there is noboot2docker start
) andboot2docker init
should returnVirtual 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
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.
In the end, I removed the
boot2docker-vm
virtual machine: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