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

12,638

Solution 1

The following command will delete completely the Docker-Machine.

docker-machine rm ^Machine_Name^

Solution 2

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.

Share:
12,638

Related videos on Youtube

Chun To Lam
Author by

Chun To Lam

Updated on June 04, 2022

Comments

  • Chun To Lam
    Chun To Lam almost 2 years

    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.