Machine: docker-machine can't remove machine

Created on 5 Feb 2016  路  9Comments  路  Source: docker/machine

with the docker-machine 0.6.0 when you try to remove a machine in a weird state like this :

 Directory of C:\Users\docker\.docker\machine\machines\default
02/04/2016  03:11 PM        33,554,432 boot2docker.iso
02/04/2016  03:11 PM    <DIR>          default
02/04/2016  07:36 PM        88,195,072 disk.vhd
               2 File(s)    121,749,504 bytes

it fails :

C:\Users\docker>docker-machine rm -f default
About to remove default
Error removing host "default": open C:\Users\docker\.docker\machine\machines\default\config.json: The system cannot find the file specified.
Can't remove "default"
arecli kinbug

Most helpful comment

@filipegorges
Thanks for your reply! I was having this exact same issue.

I already tried what you said, but it wasn't working. But thanks to you I looked into it again.

For others having this issue, but still can't delete the machine when they add the config.json file:
Check if VBoxHeadless.exe is running (using task manager), this is probably using a file in the machine folder.
Kill it, make sure you have the config.json file and remove ->
Successfully removed default

All 9 comments

Just bumped into this on my Win 10 box as well. Are there any obvious workarounds or fixes?

@jeanlaurent @Zimmergren

Just managed to fix this! Follow the path that it's trying to access through Explorer: in my case, I had deleted those files manually in an attempt to remove the machine, because I couldn't remove it through docker-machine rm for some reason I can't remember , so I just created the missing folder and file:

  1. Open Explorer
  2. Go to C:\Users\your_user.docker\machine\machines
  3. Create a folder named default
  4. Open folder default
  5. Create empty file config.json
  6. Open Powershell
  7. Run docker-machine rm -f default
PS E:\workspace\hubbles\sources> docker-machine rm -f default
About to remove default
WARNING: This action will delete both local reference and remote instance.
Error removing host "default": Error getting migrated host: unexpected end of JSON input
Successfully removed default
PS E:\workspace\hubbles\sources> docker-machine ls
NAME   ACTIVE   DRIVER   STATE   URL   SWARM   DOCKER   ERRORS
PS E:\workspace\hubbles\sources>

@filipegorges
Thanks for your reply! I was having this exact same issue.

I already tried what you said, but it wasn't working. But thanks to you I looked into it again.

For others having this issue, but still can't delete the machine when they add the config.json file:
Check if VBoxHeadless.exe is running (using task manager), this is probably using a file in the machine folder.
Kill it, make sure you have the config.json file and remove ->
Successfully removed default

Same issue on Windows 10 pro. I have not been able to fix this with either solution. VBoxHeadless.exe was not running.

Thanks @rdhaese , it worked for me!

I am using docker toolbox in a Windows 7 machine, uninstalling and installing the docker toolbox again fixed this issue for me. :)

Deleting C:\Users\\.docker folder worked for me

restart worked for me virtualbox 6.1

Thank you... it's worked for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pc-mreeves picture pc-mreeves  路  4Comments

diver-sity picture diver-sity  路  4Comments

moander picture moander  路  5Comments

nathanleclaire picture nathanleclaire  路  4Comments

masaeedu picture masaeedu  路  4Comments