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 this, i restart my WSL instance (Close and open up again) and run
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]
As i don’t know if the site content ever changes i wanted to have a copy of the steps myself.
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.
Recent Comments