jmohr95
February 10, 2022, 8:40pm
1
On Ubuntu server 20.04 I’ve run into an issue where I can no longer manage my containers. I updated my containers with docker-compose pull and tried to recreate them with docker-compose up -d. That command failed, claiming the ports were already in use. So I checked docker ps -a, it shows all my containers as created but not running. . Docker system info also shows 0 running containers. However, I can still access my containers through their web interfaces, and htop shows them still running .
I think there are two versions of docker running and terminal is calling the version which is not running. How do I confirm and then fix that?
rimelek
(Ákos Takács)
February 10, 2022, 9:17pm
2
Did you install rootless Docker? Try running docker context ls
and switch to an other context if you have any. It is possible that your current context is the rootless version but you had containers running on the same port you wanted to use now.
jmohr95
February 10, 2022, 9:33pm
3
Thanks for the quick reply. The only context listed is default.
rimelek
(Ákos Takács)
February 10, 2022, 9:35pm
4
then try
ps aux | grep docker
The official Docker is run by Systemd. maybe you have an other installed an other way.
jmohr95
February 10, 2022, 10:06pm
5
rimelek, that command returns the following:
root 920 0.0 0.1 2457068 37392 ? Ssl 19:36 0:06 dockerd --group docker --exec-root=/run/snap.docker --data-root=/var/snap/docker/common/var-lib-docker --pidfile=/run/snap.docker/docker.pid --config-file=/var/snap/docker/1458/config/daemon.json
root 1205 0.3 0.2 3893608 57864 ? Ssl 19:36 0:28 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root 1239 0.0 0.0 2385232 18940 ? Ssl 19:36 0:02 containerd --config /run/snap.docker/containerd/containerd.toml --log-level error
root 2315 0.0 0.0 1076520 3412 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8787 -container-ip 172.19.0.2 -container-port 8787
root 2321 0.0 0.0 1222832 2540 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8787 -container-ip 172.19.0.2 -container-port 8787
root 2340 0.0 0.0 1075368 2676 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8999 -container-ip 172.19.0.3 -container-port 8999
root 2346 0.0 0.0 1222832 2680 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8999 -container-ip 172.19.0.3 -container-port 8999
root 2365 0.0 0.0 1149100 3372 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto udp -host-ip 0.0.0.0 -host-port 8999 -container-ip 172.19.0.3 -container-port 8999
root 2372 0.0 0.0 1148844 3432 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto udp -host-ip :: -host-port 8999 -container-ip 172.19.0.3 -container-port 8999
root 2385 0.0 0.0 1298740 4300 ? Sl 19:37 0:01 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8080 -container-ip 172.19.0.3 -container-port 8080
root 2391 0.0 0.0 1222832 2568 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8080 -container-ip 172.19.0.3 -container-port 8080
root 2437 0.0 0.0 1222832 2572 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8786 -container-ip 172.19.0.5 -container-port 8787
root 2445 0.0 0.0 1222832 3276 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8786 -container-ip 172.19.0.5 -container-port 8787
root 2464 0.0 0.0 1296820 2828 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 9117 -container-ip 172.19.0.6 -container-port 9117
root 2471 0.0 0.0 1222832 2708 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 9117 -container-ip 172.19.0.6 -container-port 9117
root 2490 0.0 0.0 1222832 2828 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8686 -container-ip 172.19.0.7 -container-port 8686
root 2498 0.0 0.0 1149100 2556 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8686 -container-ip 172.19.0.7 -container-port 8686
root 2517 0.0 0.0 1149100 2620 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 7878 -container-ip 172.19.0.8 -container-port 7878
root 2524 0.0 0.0 1223088 3308 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 7878 -container-ip 172.19.0.8 -container-port 7878
root 2554 0.0 0.0 1222832 2608 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8989 -container-ip 172.19.0.9 -container-port 8989
root 2562 0.0 0.0 1222832 2624 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8989 -container-ip 172.19.0.9 -container-port 8989
root 2576 0.0 0.0 1222832 2540 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8090 -container-ip 172.19.0.10 -container-port 80
root 2583 0.0 0.0 1149100 3188 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8090 -container-ip 172.19.0.10 -container-port 80
root 2600 0.0 0.0 1075112 3348 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8096 -container-ip 172.19.0.11 -container-port 8096
root 2606 0.0 0.0 1149100 2688 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8096 -container-ip 172.19.0.11 -container-port 8096
root 2622 0.0 0.0 1222576 3236 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto udp -host-ip 0.0.0.0 -host-port 7359 -container-ip 172.19.0.11 -container-port 7359
root 2630 0.0 0.0 1149100 3352 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto udp -host-ip :: -host-port 7359 -container-ip 172.19.0.11 -container-port 7359
root 2644 0.0 0.0 1149100 3436 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto udp -host-ip 0.0.0.0 -host-port 1900 -container-ip 172.19.0.11 -container-port 1900
root 2651 0.0 0.0 1149100 3224 ? Sl 19:37 0:00 /usr/bin/docker-proxy -proto udp -host-ip :: -host-port 1900 -container-ip 172.19.0.11 -container-port 1900
root 6963 0.0 0.0 1222832 2672 ? Sl 19:39 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8191 -container-ip 172.19.0.4 -container-port 8191
root 6971 0.0 0.0 1222832 2612 ? Sl 19:39 0:00 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8191 -container-ip 172.19.0.4 -container-port 8191```
jmohr95
February 10, 2022, 10:17pm
6
Also, the installed docker packages are:
docker-ce-cli/focal,now 5:20.10.12~3-0~ubuntu-focal amd64 [installed]
docker-ce-rootless-extras/focal,now 5:20.10.12~3-0~ubuntu-focal amd64 [installed,automatic]
docker-ce/focal,now 5:20.10.12~3-0~ubuntu-focal amd64 [installed]
docker-scan-plugin/focal,now 0.12.0~ubuntu-focal amd64 [installed,automatic]
taken from sudo apt list --installed.
jmohr95
February 10, 2022, 10:23pm
7
And I found the problem. Docker is also installed through snap.
~$ snap list
Name Version Rev Tracking Publisher Notes
core18 20211215 2284 latest/stable canonical✓ base
core20 20220114 1328 latest/stable canonical✓ base
docker 20.10.11 1458 latest/stable canonical✓ -
lxd 4.0.8 21835 4.0/stable/… canonical✓ -
snapd 2.54.2 14549 latest/stable canonical✓ snapd
1 Like
meyay
(Metin Y.)
February 10, 2022, 10:25pm
8
You are not the first that installed a snap package and a deb docker package…
Remove the snap version.
2 Likes
I know this thread is old, but I too have the same issue. I have both the repo and the snap installed. How do I figure out which one to uninstall? I assume it’s the snap version (that’s the one I want to uninstall), but I worry that I will nuke everything if I uninstall the wrong one.
rimelek
(Ákos Takács)
May 11, 2024, 3:42pm
10
If you run docker version
you will get version numbers and “GitCommit” for the components. If the GitCommit of runc is empty, it must be the snap package.
You can also stop the snap version first before uninstalling to see which one you used. You can list the running services first:
sudo snap services
Stop the snap Docker:
snap stop docker
But if that is what you used so far, you will still have to uninstall it. If you saved persistent data, you will need to backup/export everything and load it into the new containers.
update:
Forgot to mention the simplest way to find out if it is snap:
docker info --format '{{ .DockerRootDir }}'
If it is snap, the output will be:
/var/snap/docker/common/var-lib-docker
3 Likes
The unused one did end up being the snap package. Thanks!
ijaxon
(Ian Jackson)
April 23, 2025, 4:00pm
12
Well this is old but I’ve apparently got the apt and snap docker versions installed. I’ve never installed or used the snap versions of anything.
It appears the containers are running /usr/bin/dockerd
But the root volume is snap:
docker info --format '{{ .DockerRootDir }}'
/var/snap/docker/common/var-lib-docker
not:
/var/lib/docker
I could restart the service but if I remove the snap version do I wipe out my local containers?
However I don’t see any containers listed in this directory, I do see them in /var/lib/docker where I would expect them.
rimelek
(Ákos Takács)
April 26, 2025, 11:41pm
13
I don’t understand. You mean
dockerd is running in a container?
or you want to say that your containers are started by dockerd from the Snap package?
or maybe you mean when the Docker daemon from the Snap package runs, you see it in the process list as /usr/bin/dockerd
?
If you have no containers in the output of docker ps -a
, you could not lose containers. Removing the snap package will not remove another, not snap-related folder.