How to fix “error in run: Failed to get machine ”b

2019-03-09 00:11发布

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?

10条回答
何必那么认真
2楼-- · 2019-03-09 00:58

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.

查看更多
小情绪 Triste *
3楼-- · 2019-03-09 01:03

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.

查看更多
【Aperson】
4楼-- · 2019-03-09 01:04
  • 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

查看更多
▲ chillily
5楼-- · 2019-03-09 01:05

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.

查看更多
登录 后发表回答