docker cannot connect to the daemon

"Cannot connect to the Docker daemon" or "permission denied" on docker.sock: start the service, or let your user use it.

  • containers

Steps

  1. systemctl status docker

    is the service running?

  2. sudo systemctl enable --now docker

    start it, and at every boot

  3. ls -l /var/run/docker.sock

    who may use the socket: root and the docker group

  4. sudo usermod -aG docker $USER

    join the docker group, then log out and in

  5. docker info

    check it works

Notes

  • The docker group is as good as root: only add users you trust.
  • macOS and Windows: start Docker Desktop.

Commands used

  • docker
  • systemctl
  • usermod

Each has a page in lore: lore docker opens it.