docker / machine

Machine management for a container-centric world
https://docs.docker.com/machine/
Apache License 2.0
6.62k stars 1.97k forks source link

docker-machine can't remove machine #3001

Open jeanlaurent opened 8 years ago

jeanlaurent commented 8 years ago

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"
Zimmergren commented 7 years ago

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

filipegorges commented 7 years ago

@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>
rdhaese commented 7 years ago

@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

MFry commented 6 years ago

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

felipecruz91 commented 6 years ago

Thanks @rdhaese , it worked for me!

mechdeveloper commented 5 years ago

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

valekar commented 5 years ago

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

danielgis commented 4 years ago

restart worked for me virtualbox 6.1

suryambose commented 4 years ago

Thank you... it's worked for me