Docker Containers and Images Disappear After WSL2 Restart (v28.0.0/27.5.1)

Description:
I’m experiencing an issue with Docker engine under WSL2 where all containers and images vanish after restarting WSL. Here are the details:
Environment:
WSL2 Configuration:

NAME            STATE           VERSION
* Ubuntu-22.04    Running         2
WSL version:2.4.11.0  
Kernal version:5.15.167.4-1  
WSLg version:1.0.65  
Windows version:10.0.22631.4890
Affected Docker Versions: 28.0.0 and 27.5.1 (other versions untested but possibly affected)

Observed Behavior:

  1. After restarting WSL2:
  • docker images shows no images
  • docker ps -a shows no containers
  1. Temporary workaround:
    Reinstalling via sudo apt reinstall docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin restores the containers/images,
    but the issue reoccurs after subsequent WSL restarts.

Reproduction Steps:

  1. Start/Restart WSL2
  2. Run docker images and docker ps -a
  3. Observe missing containers/images

Question:
Are there recommended configurations or fixes to ensure persistent storage across WSL restarts?

Please share the output of following commands:

docker info
docker version

Review the output before sharing and remove confidential data if any appears (public IP for example)

dpkg -l 'docker*' | grep '^ii'
snap list docker

When you share the outputs, always format your posts according to the following guide: How to format your forum posts

It is very likely that @meyay assumption is right (assuming he asusmes what I assume he assumes :smiley: ) and you have multiple Docker instances . This disappearing containers and images happened only when someone installed multiple Docker instances on the same machine, created containers, but after restaring the machine, the other instance started more quickly. The other instance is often the snap package.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.