niels segers

Ubuntu and snap installed Docker on reboot

cover

Oct 20, 2020

I have been experiencing an odd docker issue lately that I've been tearing hair out trying to troubleshoot.

For some odd reason every time I restarted my server the containers would be running, but not running at the same time. Wait this might sound weird, I promise it makes sense.

The issue

When I checked out the running processes using ps -aux or htop I could clearly see the docker daemon and containers running under the root user. The weird thing was that I couldn't access them through a browser and more weirdly... they weren't even showing up under docker ps. The only fix for this was to restart the docker service on reboot manually (systemctl restart docker) which oddly fixed the problem. But this caused me to manually fix the issue on each reboot which became frustrating rather quickly.

The solution

But I finally found the culprit! Turns out when you install more recent version of Ubuntu (might be the same for older versions but frankly no idea) the installer prompts you if you'd like to install services such as docker on your system by default. Turns out I must have checked it and installed it through the installation.

The snap installed version basically interferes with whatever version of docker you install manually. The containers were running under the snap installed version of docker, but as the user I logged in as I was using the version I installed myself. Weirdly enough this caused some weird issues. Restarting the docker service manually then probably restarted the docker daemon and caused every container to be launched under the correct docker version.

The easy fix was to remove the originally default installed version and now everything is back to where it needs to be.

1 sudo snap remove docker