0

It seems that I can run every docker command except for --build without sudo. I noticed this because the script that starts my services suddenly failed during the latest deployment. That script includes the command

docker-compose up -d --build

and it's been like that unchanged and working without problem for a long time now, but apparently something in the system must have changed. I have tried to follow the steps outlined in many similar questions here on Stack Overflow and other sites, where the suggested solution is to add the user to the docker group and restart the service. For example, from Docker's own forums. But the problem is still the same:

$ docker-compose up --build
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

I also tried

sudo chown $USER /var/run/docker.sock

which didn't work either. But problem only appears from --build, I can run other docker commands such as docker-compose up or any of the others such as docker ps etc without getting any errors. What could the problem be here?

Anonymous Entity
  • 3,254
  • 3
  • 27
  • 41

1 Answers1

0

According to the docs:

  1. Create the docker group.
    sudo groupadd docker
  2. Add your user to the docker group.
    sudo usermod -aG docker $USER

Log out and log back in so that your group membership is re-evaluated.

Fugi
  • 466
  • 8
  • 18