Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove docker-machine machine (created by user) by admin in Window 10?

I have created a docker-machine with my user account permission in Window 10.

By command:
C:\Users\my_name>docker-machine create -d "virtualbox" haha

However, I got a problem on removing them via CMD run as Administrator.

C:\WINDOWS\system32>docker-machine rm haha
About to remove haha
WARNING: This action will delete both local reference and remote instance.
Are you sure? (y/n): y
Error removing host "haha": C:\Program Files\Oracle\VirtualBox\VBoxManage.exe unregistervm --delete haha failed:
0%...10%...20%...
Progress state: VBOX_E_FILE_ERROR
VBoxManage.exe: error: Machine delete failed
VBoxManage.exe: error: Could not delete the medium storage unit 'C:\Users\Beetle\.docker\machine\machines\haha\disk.vmdk' (VERR_SHARING_VIOLATION)
VBoxManage.exe: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MediumWrap, interface IMedium
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleUnregisterVM(struct HandlerArg *)" at line 165 of file VBoxManageMisc.cpp


C:\WINDOWS\system32>docker-machine ls
NAME   ACTIVE   DRIVER       STATE     URL   SWARM   DOCKER   ERRORS
haha            virtualbox   Timeout

Although I found out that this is a permission problem, which is a machine created by an user cannot be deleted by an admin in Windows 10.

How can I remove a machine created by docker-machine (with user right level) with admin right in Windows 10 ?

Thanks for your time.

like image 740
Chun To Lam Avatar asked Jul 23 '18 10:07

Chun To Lam


People also ask

How do I make docker start by default?

Run the docker-machine create command, pass the appropriate driver to the --driver flag and provide a machine name. If this is your first machine, name it default as shown in the example. If you already have a “default” machine, choose another name for this new machine.


2 Answers

The following command will delete completely the Docker-Machine.

docker-machine rm ^Machine_Name^
like image 133
Roee Avatar answered Sep 21 '22 07:09

Roee


so after a bit of research it's a bit more complicated but we can start with killing the docker machine:

$ docker-machine kill docker_machine_name

Then once it runs it's process we can do docker-machine ls and see it's stopped:

 NAME              ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER     ERRORS 

docker_machine_name   -        virtualbox   Stopped

So when that is finished we actually need to navigate to where the docker machine's are stored on our local machine. We can do so by going to this path, I have windows so this may be different for mac and linux users, the path is as follows:

C:\Users\user_name\.docker\machine\machines

And as a directory we should see docker_machine_name or the docker machine that was created. Just delete it and it's gone. If we do

$ docker-machine ls

We should see that the machine we wanted to delete is gone. Hope this helped.

like image 33
DevOpsIsTheNameOfTheGame Avatar answered Sep 22 '22 07:09

DevOpsIsTheNameOfTheGame