WSL Docker container not showing in Docker Desktop

Ganesh GhadageGanesh Ghadage
2 min read

This article gives you a step by step procedure on how to make WSL Docker containers visible in your Docker Desktop.

Note: This is not a official document, I did some research and this worked for me, providing you the same steps to follow, it might or might not work for you depending on many reasons, so don’t blame me or article if it won’t works for you. 😅

What is WSL

Windows Subsystem for Linux (WSL) is a feature of Windows that allows you to run a Linux environment on your Windows machine, without the need for a separate virtual machine or dual booting. WSL is designed to provide a seamless and productive experience for developers who want to use both Windows and Linux at the same time.

reference: What is the Windows Subsystem for Linux? article by Microsoft

As WSL is another environment, docker containers running in might not show in your docker desktop.

If you want, WSL docker containers (Judge0) to show in your docker desktop you can follow the below steps.

Steps to add wsl docker container to docker desktop

step 1:

open your wsl sub-system and run below cmd

docker context ls

It will show something like this:

step 2:

change context from default to desktop-linux

docker context use desktop-linux

NOTE: once you switch to docker-linux, docker windows commands won’t work here, you need to use docker linux commands

step 3:

Switch back to default docker context

That’s right you need to switch back to default, we won’t be using docker-linux context, this switching is only required to refresh the docker context

docker context use default

step 4:

Restart you docker engine

go to docker desktop and follow the steps as per image below to restart the docker engine

step 4:

now restart you docker container

To restart judge0

  1. start the redis db

      docker-compose up -d db redis
    
  1. start judge0

     docker-compose up -d
    

make sure you are in correct directory

it will start showing in you docker desktop.

This process will sync your wsl docker context and system docker context for all the docker containers.

Summary

This article provides a step-by-step guide to making WSL Docker containers visible in Docker Desktop. It involves changing the Docker context, restarting the Docker engine and containers, and ensuring the correct directory is used. These steps sync the WSL Docker context with the system Docker context, allowing containers to appear in Docker Desktop.

32
Subscribe to my newsletter

Read articles from Ganesh Ghadage directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ganesh Ghadage
Ganesh Ghadage