Docker-Compose can't connect to Docker Daemon

Solution 1:

I had the same error, after 15 min of debugging. Turns out all it needs is a sudo :)

Check out Manage Docker as a non-root user to get rid of the sudo prefix.

Solution 2:

I had this problem and did not want to mess things up using sudo. When investigating, I tried to get some info :

docker info

Surprinsingly, I had the following error :

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http:///var/run/docker.sock/v1.38/info: dial unix /var/run/docker.sock: connect: permission denied

For some reason I did not have enough privileges, the following command solved my problem :

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

Et voilà !