[Solved] Docker ERROR: Couldn’t connect to Docker daemon at http+docker://localunixsocket – is it running?

After installing docker in ubuntu 16.04, execute in the directory where the docker-compose.yml file is located.

jing@ubuntu:/tmp/docker$ docker-compose up -d

error:

ERROR: Couldn’t connect to Docker daemon at http+docker://localunixsocket – is it running?

If it’s at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

 

Solution:

The correct one is to add the current user to the docker group
jing@ubuntu:/tmp/docker$ sudo gpasswd -a ${USER} docker

Then quit the current user, switch to root for example, switch to jing again, and run docker-compose up -d and you’re done.

jing@ubuntu:/tmp/docker$ sudo su
root@ubuntu:/tmp/docker$ su jing
jing@ubuntu:/tmp/docker$ docker-compose up -d

Similar Posts: