Or: “Get Docker running in WSL without WSL Integration”
Recently, i’ve had a special case where i had to develop a project with Docker containers running on the Windows Host Docker, other containers running in WSL and some of the tools running directly on the Windows Host.
(Basically, a big confusing mess).
To get this 3-way-communication going, i actually had to install Docker in WSL independantly from Docker Desktop on my Host.
This turned out to be a little tricky, just because i didn’t really know where to look up the sources.
So if anyone of you have these special needs, feel free to follow me along.
Take these steps:
- Install Docker Desktop normally on your host, do not enable WSL Integration but install all tools necessary for WSL Integration (just in case)
- Open up your WSL and execute following commands:
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
Get the Docker GPG Key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Set up stable repository:
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Do another update
sudo apt-get update
Install docker engine independantly of host:
sudo apt-get install docker-ce docker-ce-cli containerd.io
After installing the packages, start the Docker service inside the distribution. Closing and reopening a terminal does not necessarily stop or restart the WSL instance:
sudo service docker start
And check if docker is running correctly:
sudo docker run hello-world
This is basically copied and condensed from
https://docs.docker.com/engine/install/ubuntu/ [12th of April 2021]
These commands preserve the April 2021 Ubuntu/amd64 setup. Package prerequisites, repository setup, supported releases, and service startup can change. For a new installation, follow Docker’s current Ubuntu installation instructions for your release and architecture. This note was added on 15 October 2026.
Now you have docker only in wsl, you will have to start up the service manually if you open up your WSL instance for the first time or if WSL is stopped completely.
But i’ll offer a fix for that later.
This will also work without Docker installed on the host, so both instances don’t know about each other and Docker Desktop cannot f* with your network too much.
Originally published on blog.yavuz.support: https://blog.yavuz.support/get-docker-running-in-wsl-2-independently-of-docker-desktop.
