• Register
0 votes
632 views

Problem :

I have installed docker-machine 0.1.0 and docker-compose 1.1.0 on my Mac OS 10.8.5.
My Docker-machine is running normally and it can be connected by docker-machine ssh as follows:

$ docker-machine ls

NAME   ACTIVE   DRIVER       STATE     URL                         SWARM

dev    *        virtualbox   Running   tcp://192.168.99.100:2376  

But I am unable to 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.

My Dockerfile and docker-compose.yml are as follows:

Dockerfile

FROM centos:centos7

DOCKER_HOST tcp://192.168.99.100:2376

docker-compose.yml

web:

  build: .

Why can't I connect? Any clues?

6 5 3
7,540 points

Please log in or register to answer this question.

2 Answers

0 votes

Solution :

The docker daemon always runs as the root user so you need to write sudo before your Docker command(s).

If you cant use sudo when you use the docker command. Then please create a Unix group called docker and add your users to it. So when the docker daemon starts it will mak the ownership of the Unix socket read or writable by the docker group.

Please follow below steps to create the docker group and add your user to it:

1. Create the docker group by below command.

$ sudo groupadd docker

2. Add your user to the docker group by below command.

$ sudo usermod -aG docker $USER

3. Log out and log back in to it so that your group membership is re-evaluated.

4. Now Verify that you can use the docker commands without the use of sudo by below command.

$ docker run hello-world

This command will download a test image and will run it in a container. When the container runs it prints an informational message and exits.

Further Readings:

https://docs.docker.com/install/linux/linux-postinstall/

9 7 4
38,600 points
0 votes

The Docker machine is running but you need to export some environment to establish the connection with the Docker machine. By default, the Docker CLI client is trying to communicate to the daenon using http+unix://var/run/docker.sock. Export the correct environment variables using eval and then try again. You can also just run docker-machine env dev to see the environment variables it will see.

Reasons:

There are two possible reasons for this error message;

  • The most common reason is that you are running the command as does not have the permission to access docker.
  • The other reason is that you have not started the docker.

Solutions:

Solution for permission denied:

If you don’t have the permission to access docker, then you can fix this either by running the command as root using sudo since the root has permission to access the docker or adding your user to the docker group.

sudo usermod –a –G docker $USER

After this the user has to log out and log back in completely.

Docket not started:

If you don’t have started docker on Ubuntu, then you can start it by using;

sudo systemct1 enable docker # Auto-start on boot

sudo systemct1 start docker #start right now

 

11 5 2
3,890 points

Related questions

0 votes
1 answer 501 views
501 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 ... 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?
asked Jan 20, 2020 jwilliam 3.9k points
1 vote
1 answer 158 views
158 views
Problem : Facing the weird following issue cannot connect to the docker daemon at unix:///var/run/docker.sock. is the docker daemon running?
asked Nov 8, 2019 peterlaw 6.9k points
1 vote
1 answer 134 views
134 views
Problem : Encountered bellow docker error cannot connect to the docker daemon at unix:///var/run/docker.sock. is the docker daemon running?
asked Nov 8, 2019 peterlaw 6.9k points
0 votes
1 answer 61 views
61 views
Problem : After I tried to update my Docker version to 0.8.0, I face an error message while I try to enter sudo docker version as below : Client version: 0.8.0 Go version (client): go1.2 Git commit (client): cc3a8c8 2020 ... 12:55:57 initserver: open /var/lib/docker/aufs/layers/cf2414da53f9bcfaa48bc3d58360d7f1cfd3784e4fe51fbef95197709dfc285d: no such file or directory How can I resolve the issue?
asked Jan 3, 2020 alecxe 7.5k points
1 vote
1 answer 978 views
978 views
Problem : Currently I am learning Docker. Recently I came across below Docker error in one of the projects: “Invalid reference format: repository name must be lowercase” I am trying to understand the causes of this message and way to fix above error message. Can someone guide me in solving above error message?
asked Mar 28, 2020 morrisBson 3.2k points
0 votes
1 answer 25 views
25 views
Problem: I have only basic knowledge in docker. I am trying to follow the online tutorial to create the first docker Image and luckily for me it went successfully. I have successfully logged in into the docker and now I am trying to push the Image into the docker ... type of error. Denied: Requested access to the resource is denied. Can anyone give me a little bit of hint towards fixing problem?
asked Jul 25, 2020 Raphael Pacheco 4.9k points
0 votes
2 answers 138 views
138 views
Problem : I am using Mac. I want to run my docker code. Following is my command: docker run -d -p 80:80 --name webserver nginx However I am facing below error: docker: Error response from daemon: driver failed programming external connectivity on endpoint webserver ( ... userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE). Please let me know if any solution on my error.
asked Dec 3, 2019 alecxe 7.5k points