Xavi Montero
Xavi Montero

Reputation: 10725

How can I stop the docker engine running integrated on WSL2 from the command line?

I run WSL2 on Windows with an Ubuntu distribution inside WSL, and Docker desktop using the integrated "WSL2-based engine".

If I do wsl --shutdown in the CLI, Docker Desktop complains about the backend shutting down unexpectedly.

What command should I issue before the wsl --shutdown to shutdown the Docker engine without danger of loosing data?

Upvotes: 6

Views: 17251

Answers (3)

Anurag Daksh
Anurag Daksh

Reputation: 11

In C:\Users\YourUsername dir create .wslconfig

[wsl2]
memory=<Enter amount of memory you want to allocate for wsl>GB

Upvotes: 0

Kakada NEANG
Kakada NEANG

Reputation: 531

I found the answer at https://github.com/docker/for-win/issues/6122 by manually setting

wslEngineEnabled from true to false in the Docker setting file:

C:\Users<username>\AppData\Roaming\Docker\settings.json

In case the AppData does not show, watch this https://youtu.be/9OO6sgvq2Aw

Upvotes: 4

NotTheDr01ds
NotTheDr01ds

Reputation: 20817

What command should I issue before the wsl --shutdown to shutdown the Docker engine without danger of loosing data?

I'm not sure about a "command" (which would be nice, since I prefer keyboard interaction over the mouse for most things), but at the moment I'm just using the GUI. To make sure that Docker Desktop is safely shut down, I go to the Windows Taskbar icon (usually in "Hidden Icons"/overflow, unless you've configured it otherwise), right-click, and Quit Docker Desktop.

There may be a way to script it. I did try taskkill (without) the /f (force) option, but that didn't work.

It sounds like rmlogotest.exe, which is a tool for sending Windows shutdown messages to applications might work.

Upvotes: 0

Related Questions