Ubuntu – Docker containers running, but not showing up in docker ps

docker

I am running Ubuntu Server 20.04.2, fresh install. I have an unbound container up and running, also a pihole container.
After a reboot of the host server, Docker doesn't show me any containers at all. And no docker images either.
But the unbound and pihole containers are definitely running in the background. The pihole website is accessible via the hosts IP, and DNS requests from clients are handled without problems.
I have no output from "docker ps", "docker ps -a", "docker images" and "docker stats".
I can also see that the listening ports are blocked by "docker-pr"
Can anybody help me? How do I access those "invisible" containers?

"sudo systemctl restart docker" didn't bring any change, also tried the commands above as root.

$ docker -v 
Docker version 20.10.3, build 48d30b5
$ which docker
/usr/bin/docker
$ apt list --installed | grep 'docker'
docker-ce-cli/focal,now 5:20.10.3~3-0~ubuntu-focal amd64 [installed,automatic]
docker-ce-rootless-extras/focal,now 5:20.10.3~3-0~ubuntu-focal amd64 [installed,automatic]
docker-ce/focal,now 5:20.10.3~3-0~ubuntu-focal amd64 [installed]
$ snap list
Name    Version      Rev    Tracking       Publisher   Notes
core    16-2.48.2.1  10823  latest/stable  canonical✓  core
core18  20200707     1880   latest/stable  canonical✓  base
docker  19.03.11     471    latest/stable  canonical✓  -
lxd     4.0.2        16099  4.0/stable/…   canonical✓  -
snapd   2.45.2       8542   latest/stable  canonical✓  snapd
$ docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 19.03.11
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: 
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.4.0-65-generic
 Operating System: Ubuntu Core 16
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.69GiB
 Name: ubuntu
 ID: W56I:F32Q:H7O6:LWFT:AAUC:6QEI:EYOZ:HFJB:IEQ3:T6E7:ZCJG:HSJU
 Docker Root Dir: /var/snap/docker/common/var-lib-docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Best Answer

In your case you have both an apt and snap package of docker installed. Remove the snap package with this command:

sudo snap remove docker

Then you might have to restart your containers.

Related Question