"docker-compose up" error "Couldn't connect to Docker daemon"

I got this error trying to run the "docker-compose up" command:

$ docker-compose up -d                                                                                                           
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?                                                                                                                             
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

A quick fix is:

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

Comments