1

Please be advised that I am somewhat of a newbie at Ubuntu system configuration.

I am running the snap- installed docker on Ubuntu desktop V22.04. It is running a number of containers without problems. My containers are all setup (in their docker-compose files) to restart always if for any reason the machine restarts.

Unfortunately, whenever I reboot my Ubuntu machine my containers are not restarting. When I attempt to list the running containers using "docker ps", I get an error message saying:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I can, of course, get things runnung again by doing a "sudo snap disable docker" and then doing "sudo snap enable docker", but this is not a good solution for those times when (for example) I have power hits (my town has one of the worst power grids in the country!) and my system has to automatically restart. I need to be able to somehow make the docker daemon start up automatically upon reboot. More unfortunately: I cannot find any instructions on how to do this!

Does anyone know how to set up an Ubuntu instance so that a docker daemon installed by snap can be made to start up automatically on reboot?

  • 1
    This question is somewhat dated but its resolution looks sound to me: install the regular version of docker: sudo apt install docker.io. I've installed it that way on dozens of (server & desktop) systems, and have never needed to look at it again. – zwets Jan 15 '24 at 19:49
  • 2
    Snaps should really be a last resort used only when an apt version is not available or when you absolutely need a newer software version that's not available from the main, universe, etc., repositories. – mchid Jan 15 '24 at 21:26
  • 1
  • Folks: so you know, my first attempt to install docker used "sudo apt install docker", which failed. I then used "sudo apt install docker.io", but attempts to run docker commands failed (docker: command not found). So I had to use snap to do a successful install. – Factor Three Jan 18 '24 at 05:11
  • As for the link provided: I had already read it prior to posting this question. One of the answers provided talks about solving the problem by creating a group that allow the user to use docker without sudo (something that I had already done), and others talk about restarting docker (which I already do whenever I reboot) or reinstalling docker (which I did twice). Furthermore, the problem described is different from mine, because the questioner was unable to connect to the docker daemon after an install. My problem is that I connected fine after the install, but I don't connect after reboot. – Factor Three Jan 18 '24 at 05:43
  • What I am particularly interested in knowing is: why does my system fail to run docker commands if I install using apt install docker.io??? zwets, this question is for you. You've installed docker that way on several machines -- so what is the difference between the machines you installed on and mine??? A repository I don't access? A configuration that I am unaware of? Why do your machines install it without problems and mine doesn't??? – Factor Three Jan 18 '24 at 05:49

0 Answers0