[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.

[email protected]:/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
[email protected]:/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.

[email protected]:/tmp/docker$ sudo su
[email protected]:/tmp/docker$ su jing
[email protected]:/tmp/docker$ docker-compose up -d

Similar Posts: