Failed to Start/Connect to Daemon

I tried to google and search the forums for help but to no avail. I’m not exactly sure where to ask in the forums but I thought I might as well take a shot at asking here.

My docker-compose installation has caused encountered some problems and I am unable to use any of the apps I’ve installed using it (immich, PaperMC)

Here is my “docker info” output:

Client: Docker Engine - Community
 Version:    27.3.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.17.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.29.7
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info

When i use “sudo systemctl status docker”, I get:

docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-11-28 16:53:16 EST; 25min ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 1764 (dockerd)
      Tasks: 10
     Memory: 104.0M (peak: 105.5M)
        CPU: 844ms
     CGroup: /system.slice/docker.service
             └─1764 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Nov 28 16:53:02 server-name dockerd[1764]: time="2024-11-28T16:53:02.573588887-05:00" level=info msg="Starting up"
Nov 28 16:53:02 server-name dockerd[1764]: time="2024-11-28T16:53:02.697210418-05:00" level=info msg="detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/re>
Nov 28 16:53:07 server-name dockerd[1764]: time="2024-11-28T16:53:07.720236511-05:00" level=info msg="[graphdriver] using prior storage driver: overlay2"
Nov 28 16:53:08 server-name dockerd[1764]: time="2024-11-28T16:53:08.009140081-05:00" level=info msg="Loading containers: start."
Nov 28 16:53:09 server-name dockerd[1764]: time="2024-11-28T16:53:09.949762334-05:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used t>
Nov 28 16:53:10 server-name dockerd[1764]: time="2024-11-28T16:53:10.450479843-05:00" level=info msg="Loading containers: done."
Nov 28 16:53:16 server-name dockerd[1764]: time="2024-11-28T16:53:16.237915946-05:00" level=info msg="Docker daemon" commit=41ca978 containerd-snapshotter=false storage-driver=overlay2 version=27.3.1
Nov 28 16:53:16 server-name dockerd[1764]: time="2024-11-28T16:53:16.277573270-05:00" level=info msg="Daemon has completed initialization"
Nov 28 16:53:16 server-name dockerd[1764]: time="2024-11-28T16:53:16.609976815-05:00" level=info msg="API listen on /run/docker.sock"
Nov 28 16:53:16 server-name systemd[1]: Started docker.service - Docker Application Container Engine.

Here is the output for "sudo systemctl status docker.socket:

docker.socket - Docker Socket for the API
     Loaded: loaded (/usr/lib/systemd/system/docker.socket; enabled; preset: enabled)
     Active: active (running) since Thu 2024-11-28 16:51:55 EST; 33min ago
   Triggers: ● docker.service
     Listen: /run/docker.sock (Stream)
      Tasks: 0 (limit: 14237)
     Memory: 0B (peak: 256.0K)
        CPU: 701us
     CGroup: /system.slice/docker.socket

Nov 28 16:51:55 server-name systemd[1]: Starting docker.socket - Docker Socket for the API...
Nov 28 16:51:55 server-name systemd[1]: Listening on docker.socket - Docker Socket for the API.

Here is the output for “sudo dockerd -D -l debug”:

INFO[2024-11-28T17:27:16.049588375-05:00] Starting up
failed to start daemon, ensure docker is not running or delete /var/run/docker.pid: process with PID 1764 is still running

I’ve tried uninstalled docker-compose but I still get the same issue and I’ve tried running “dockerd”, “sudo systemctl docker start”, and “sudo service docker restart”

I’m confused, but let me summarize my observation.

You opened the topic in a Docker Desktop category (I moved it to Docker Engine), but there is nothing about Docker Desktop here. In fact, you are using the Docker Engine (Docker CE), and assume there is a problem with compose, bu there is nothing about compose in your message either, except that th docker-compose installation has failed (use docker compose instead), but I guess you meant running the docker compose command.

Then all I see that you have an error message about the dockerd not started, which is a very common issue when someone doesn’t use sudo when running docker commands and doesn’t add the user to the docker group either (mentioned in the documentation too).

Then you try to run a second docker daemon and it says the daemon is already running. Which is true and you knew that from the systemctl commands.

So use either sudo fo the docker command or add your user to the docker group, or you can do what I did to make my docker commands logged since everyone who has access to the docker command can get full root access very easily and run commands even acidentally that you want to know about. Even if you ran those commands accidentally.

Direct link to the secion in my blogpost about it:

https://dev.to/rimelek/install-docker-and-portainer-in-a-vm-using-ansible-21ib#allow-nonroot-users-to-use-the-docker-commands

Thanks for doing your best to answer,

I didn’t know where to post exactly so I posted to what I thought was the right place and I apologize for posting in the wrong category. I will try to explain my situation a little better:

I installed what I assume is docker compose a few weeks ago following a guide about starting your own home server Here is the video with a timestamp. Everything installed smoothly and was working well. All of my docker containers (I think that the right term) would start running as soon as my server booted up and I could use docker commands without sudo.

A few days ago, I couldn’t access my Immich server and my Minecraft server was down, too. I used docker ps to check if the containers were running and got the error:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I tried adding sudo to it and still get the same problem.

I do believe I’ve added my user to the docker group, even doing a second time after reading your comment about it to make sure I did do it.

Hopefully that explains the problem I’m currently having and thank you for your help so far!

I believe i fixed my issue,

I didn’t realize docker engine and docker compose were two different things so i uninstalled docker compose and docker engine but noticed i was still getting the
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? error when nothing should have been showing up.

I realized I had installed the snap version at some point. I uninstalled snap, reinstalled docker-engine seem to be working again, though I had to remake some of my containers.

Thank you for the help!

For those who may need the help:
Type ‘snap list’ and see if Docker from Snap is installed
If it is, run ‘sudo snap remove docker’
Then reboot the system ‘sudo reboot’
Now install the apt version again and you should be good.

If you want the snap version, just uninstall the apt version.

Small note: we always recommend installing docker-ce from docker’s official repositories, as those are vanilla versions the documentation is written for. Flavors from the distribution’s repos may or may not be modified to align with the philosophy of the distribution. The snap version is an extreme example for that :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.