• Register
0 votes
838 views

Problem :

I installed the docker-machine 0.1.0 and docker-compose 1.1.0 on the Mac OS 10.8.5.
Docker-machine is running normally and able to connect by the docker-machine ssh.

But can't connect from docker-compose getting following error:

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

Why can't I connect? Any clues?

3.9k points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

By default a docker daemon always runs as a root user, so you need to prepend sudo to the Docker command(s).

If you don’t want to use the sudo when you use a docker command, create the Unix group called docker and add the users to it. When a docker daemon starts, it makes a ownership of a Unix socket read/writable by a docker group.

To create a docker group and add to your user:

  1. Create a docker group.

          $ sudo groupadd docker

  1. Next add your user to a docker group.

          $ sudo usermod -aG docker $USER

  1. After that log out and log back in so that the group membership is re-evaluated.
  1. Next verify that you can docker commands without sudo.

          $ docker run hello-world

This command downloads the test image and runs it in the container. When a container runs, it prints the informational message and exits.

38.6k points