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:
What platform are you using? Windows, Linux or macOS? Which version of the operating systems? In case of Linux, which distribution?
How did you install Docker? Sharing the platform almost answers it, but only almost. Direct links to the followed guide can be useful.
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)
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
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
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.