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
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.