System.InvalidOperationException: Failed to deploy distro docker-desktop to <localpath>: exit code: -1

32,282

Solution 1

Almost sure, that the accepted answer will work. However, it won't be an option, if you utilize WSL for other purposes as well. In that case, you may have several configurations/apps in WSL and just reinstalling or deleting your configuration will probably be a bad solution.

Furthermore: WSL is not the issue for this error! It is created by Docker engine configuration which will kill the WSL service (LxxsManager). This may happen because of

  • changed configuration (by you) or
  • because of a Docker update, maybe also
  • because of Windows updates

You can find a detailed discussion about this issue on Docker's GitHub Issues.

I personally experienced this problem after installing updates on Windows while running Docker v3.5.2. And again, reinstalling/killing WSL is not an option for me! So I tried to kill all services (Docker and WSL) and update Docker. Unfortunately that did not work in first place, since LxxsManager was in some weird state and I could not even kill it any more (even a kill command as admin with force switch did not do it's job!)... So here is my solution to fix that problem:

  1. Remove Docker from autostart
  2. Restart Windows (Yippiee: WSL works again! 🥰)
  3. Install a new version of Docker (in my case v.4.2.0)
  4. Restart Windows again (probably not necessary, but for me it was because Docker engine did not start before a Windows restart)
  5. Start Docker (Yippiee: Docker works again! ☺️)

Note: Since I did not change Docker configuration, I installed an update. If you changed configuration options resulting in that crash, your solution may be different. Literally, instead of updating Docker (step 3) you would probably roll back your Docker configuration changes instead.

Solution 2

  • Uninstall Docker.
  • Uncheck Containers, Hyper-V, Windows Subsystem for Linux in Windows features
  • Restart the system
  • Install Docker Desktop
  • Restart System
  • Start Docker Desktop

Solution 3

Try delete %USERPROFILE%/.wslconfig. If it helps then you can try to modify it so that it work. As for me I deleted the file, because on my workstation docker didn't want to work with it

Solution 4

Right click on docker icon, run as administrator (if you have administrator rights on your computer). It solved the problem for me.

Share:
32,282
sanketh s
Author by

sanketh s

Updated on April 09, 2022

Comments

  • sanketh s
    sanketh s about 2 years

    i am trying to run docker Desktop in my windows 10 Local. have installed it sucessfully but while running it i am getting the below error.

    System.InvalidOperationException:
    Failed to deploy distro docker-desktop to <localpath>: exit code: -1
     stdout: The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.
    

    I think it is saying some windows service need to be enabled, but i dont know which service has to be enabled could someone please help me with this concern?

    docker version C:\Users\lenova>docker --version Docker version 20.10.2, build 2291f61

    enter image description here

    • ZecKa
      ZecKa about 3 years
      I have same issue, in my case it was a conflict with laravel Valet. So i just run valet stop and restart docker. You can find various solution here: github.com/docker/for-win/issues/8204
    • sanketh s
      sanketh s about 3 years
      do i need to run this in command prompt?
    • ZecKa
      ZecKa about 3 years
      Do you have valet installed in your machine ?
  • sanketh s
    sanketh s about 3 years
    not quite sure about uninstalling WSL2 Kernel and unchecking the options you mentioned. if possible could you please provide a screenshot from your windows machine?
  • Nova Herdi Kusumah
    Nova Herdi Kusumah over 2 years
    this is the accurate solution to me thanks @Potato
  • Jnr
    Jnr over 2 years
    Well that saved my morning.
  • RyanQuey
    RyanQuey about 2 years
    This worked great. I was afraid I would lose all sorts of files and stuff but nothing was lost. My error was slightly different though: it was still a invalidOperationException but the message was The network was not found instead.