All Images and Containers Disappeared After I Use Docker Logout

I was working on my server and modified the /etc/docker/daemon.json file.
After making the changes, I restarted the Docker service with:systemctl restart docker

Then, I ran the following commands:
docker logout
docker login example.com:port

After these steps, all of my Docker images and containers seemed to have disappeared.
When I ran docker images and docker ps -a , docker ps , nothing showed up.

This situation surprised me, and I’m looking for help to understand what happened.
Is it normal for images and containers to disappear after changing the Docker daemon configuration?
What should I do in this case?

Logging out would not delete anything, but right now, I also don’t know why it would not show images right after a logout. Maybe you have multiple Docker installations and you somehow automatically switched back to another. It shouldn’t happen. Let me share a template that contains some questions for debugging.

We usually need the following information to understand the issue:

  1. What platform are you using? Windows, Linux or macOS? Which version of the operating systems? In case of Linux, which distribution?

  2. How did you install Docker? Sharing the platform almost answers it, but only almost. Direct links to the followed guide can be useful.

  3. On debian based Linux, the following commands can give us some idea and recognize incorrectly installed Docker:

    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

Hello, sorry for my late reply. Here it is:

:pushpin: Platform

I am using Linux, specifically:

  • Distribution: Ubuntu 22.04.5 LTS (x86_64)
  • Kernel: 5.15.0-143-generic

:pushpin: How Docker was installed

I installed Docker and Docker Compose via APT (the official Docker repositories for Debian/Ubuntu).
I did not use Snap or any other installer.


:pushpin: Docker version info

docker info

Client: Docker Engine - Community
 Version:    28.1.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: v0.17.1
  compose: v2.29.7
  scan: v0.23.0

Server:
 Containers: 6
  Running: 6
  Paused: 0
  Stopped: 0
 Images: 8
 Server Version: 28.1.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
 Cgroup Driver: systemd
 Cgroup Version: 2
 Logging Driver: json-file
 Runtimes: runc io.containerd.runc.v2
 Init Binary: docker-init
 Kernel Version: 5.15.0-143-generic
 Operating System: Ubuntu 22.04.5 LTS
 Architecture: x86_64
 CPUs: 2
 Total Memory: 3.8 GiB
 Docker Root Dir: /var/lib/docker

docker version

Client: Docker Engine - Community
 Version:           28.1.1
 API version:       1.49
 Go version:        go1.23.8
 Git commit:        4eba377
 OS/Arch:           linux/amd64

Server: Docker Engine - Community
 Engine:
  Version:          28.1.1
  API version:      1.49 (minimum 1.24)
  Go version:       go1.23.8
  Git commit:       01f442b
 containerd:
  Version:          1.7.27
 runc:
  Version:          1.2.5
 docker-init:
  Version:          0.19.0

:pushpin: Debian packages (dpkg -l 'docker*' | grep '^ii')

nginx

ii  docker-buildx-plugin      0.17.1-1ubuntu.20.04focal
ii  docker-ce                 5:28.1.1-1ubuntu.20.04focal
ii  docker-ce-cli             5:28.1.1-1ubuntu.20.04focal
ii  docker-ce-rootless-extras 5:27.3.1-1ubuntu.20.04focal
ii  docker-compose            1.29.2-1
ii  docker-compose-plugin     2.29.7-1ubuntu.20.04focal
ii  docker-scan-plugin        0.23.0~ubuntu-focal

:pushpin: Snap check (snap list docker)

error: no matching snaps installed

Are you sure you used the default context and not the rootless context before? You can try to switch to rootless.

docker context use rootless

But now that I read your first post again, I think it is more likely that you changed something in the daemon.json. For example the storage driver. If you change the storage driver, a completely new fodler will be created for the images. If you switch back to the original driver, you will see the old images and containers again.

So if you didn’t test listing images before logging out after restarting the systemd docker service, images probbaly “disappeared” before logging out.

I remove confidential data and all is ok. Thanks

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