I tried everything in this thread: https://github.com/docker/compose/issues/88
Still no luck.
rept@temponia:~/passenger$ netstat -ant |grep 4243
tcp 0 0 127.0.0.1:4243 0.0.0.0:* LISTEN
rept@temponia:~/passenger$ echo $DOCKER_HOST
tcp://localhost:4243
rept@temponia:~/passenger$ sudo docker-compose build db uses an image, skipping
Building web...
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.
This is the version:
rept@temponia:~/passenger$ sudo docker version
Client version: 1.0.1
Client API version: 1.12
Go version (client): go1.2.1
Git commit (client): 990021a
Server version: 1.0.1
Server API version: 1.12
Go version (server): go1.2.1
Git commit (server): 990021a
Any ideas? I also tried installing fig which works right away without any problem...
I get the same error message when I run docker.
It is solved by adding myself to the user group 'docker'
Try to run the following command to add yourself to the group
usermod -aG docker ${USER}
Or you can run the following command to find out what groups you belong to
groups $USER
Looks like docker-compose is disregarding the $DOCKER_HOST
env var here, because it's trying to connect to the socket in stead of the 127.0.0.1 address.
same issue here
I encountered same error message just now, that time my laptop WiFi is off without wired connection. I enable WiFi and connected to home wireless network then problem solved.
You can try the 5.0.3 (prebuild) at https://www.virtualbox.org/wiki/Testbuilds ? It's fix this issue for me.
i had that problem using docker in my mac, but it got solved one i ran the compose command without sudo, so it seems it is a user issue,
Soleved for me too with sudo command
@rept are you still having this issue? The docker version you reported is over a year old now, which is, well, pre-historic in docker terms :)
I wonder if this issue should be kept open because it's now collecting all kind of _possible_ reasons the daemon cannot be reached (I don't mean this in a bad way; thanks everyone for suggesting solutions, it is appreciated)
I did a new installation on a completely different machine and it's working now. So you van close it.
Thanks, @rept, and good to hear it was resolved!
I get
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
too everytime I activate tty: true
or stdin_open: true
in docker-compose.yml
and running docker-compose up
.
Can it be related?
Docker version 1.9.1, build a34a1d5
docker-compose version 1.5.2, build 7240ff3
I just solved my problem running the "docker-compose run ..." command with sudo.
I ran into this when running docker compose up -d
during vagrant up. User vagrant
has been added to group docker
but the above error appears when running it without sudo
. It works later on if one logs in as user vagrant
but fails during provisioning so it has something to do with env variables?
docker-compose version: 1.4.1
Simple solution: sudo docker-compose up
I ran to same issue with:
[root@c910f05c01bc07 xcat-docker]# docker-compose version
docker-compose version 1.6.2, build 4d72027
docker-py version: 1.7.2
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
docker version:
[root@c910f05c01bc07 xcat-docker]# docker version
Client:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 16:16:33 2016
OS/Arch: linux/amd64
Server:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 16:16:33 2016
OS/Arch: linux/amd64
That is a workaround not a solution, right?
I still often face with this
This is not a compose issue. If you can't connect to the docker daemon from compose there are a few likely causes:
DOCKER_
env variables, which is often done by running eval $(docker-machine env default)
These aren't problems that can be solved by compose.
There is an issue with tty
, which is ticketed here: #3106
I can confirm: This is not a docker-compose issue.
If it helps: I came across the same issue (Couldn't connect...) on a Ubuntu host. Running sudo systemctl status docker.service -l
showed the "real" issue. The solution in my case was to remove all files in "/var/lib/docker/network/files/" and restart the docker service.
hi @dnephin @madflow , I think this is a docker-compose issue.
Since with the same docker image and docker network, the container can be started up successfully with
sudo docker run -it --privileged=true --hostname=xcatmn --name=xcatmn --add-host="xcatmn.clusers.com xcatmn:10.5.107.101" --volume /docker/xcatdata/:/install --net=subnet1 --ip=10.5.107.101 xcat/xcat-ubuntu-x86_64
but failed with "docker-compose up". The docker-compose.yml is right the equivalent of the options and arguments of "docker run":
[root@c910f05c01bc07 xcat-docker]# docker-compose config
networks:
default:
external:
name: subnet1
external_name: subnet1
services:
xcatmn:
container_name: xcatmn
extra_hosts:
xcatmn.clusers.com xcatmn: 10.5.107.101
hostname: xcatmn
image: xcat/xcat-ubuntu-x86_64
networks:
default:
ipv4_address: 10.5.107.101
privileged: true
stdin_open: true
tty: true
volumes:
- /docker/xcatdata:/install:rw
version: '2.0'
volumes: {}
The docker and compose version info:
[root@c910f05c01bc07 xcat-docker]# docker version
Client:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 16:16:33 2016
OS/Arch: linux/amd64
Server:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 16:16:33 2016
OS/Arch: linux/amd64
[root@c910f05c01bc07 xcat-docker]# docker-compose version
docker-compose version 1.7.0dev, build 99d68be
docker-py version: 1.8.0-dev
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
If you can reproduce a connection issue with Compose and not with docker cli please open a new issue. Including all the information you have here is great, and also the error message, and a link to a paste with docker-compose --verbose up
.
I get this if any of my container names have camel casing.
$ cat docker-compose.yml
referenceCombo:
build: referenceCombo
$ docker-compose build
Building referenceCombo
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.
Change the name to "referencecombo" (all lowercase) and it's fine. The error message definitely doesn't help figure this one out :(
@chriskessel I think your issue is covered by #2816, it's a bug in Docker Engine.
after restart docker services , it works for me :(
service docker restart
I had the same error, after 15 min of debugging. Turns out all it needs is a sudo
:)
Check out [Create a Docker group] here https://docs.docker.com/engine/installation/linux/ubuntulinux/ to get rid of the sudo prefix.
Why needs to run with sudo?
@fabiopaiva by default docker connects to a unix socket which is a file with root user and docker group read/write privileges:
$ ls -l /var/run/docker.sock
srw-rw---- 1 root docker 0 Jun 29 23:38 /var/run/docker.sock
so you either need to be root or a member of the docker group to connect to it. If docker was listening on a tcp socket the permissions would not apply.
I delete file /var/run/docker.sock
how could correct?
@pixies restart the docker service should recreate it
This is the correct answer. In many cases you will need to log out and log back in for the change to take effect. Running the command with sudo will work too, but adding the necessary users to the docker group is a better solution so you don't have to give out sudo access.
leoyuholo commented on May 14, 2015
It is solved by adding myself to the user group 'docker'
Try to run the following command to add yourself to the group
usermod -aG docker ${USER}
Or you can run the following command to find out what groups you belong to
groups $USER
it seams really work if restart a machine.
@alexanderadam did u find any solution ? i got the same error now
@CnytSntrk sorry, I solved the problem otherwise. :wink:
But good luck :four_leaf_clover: finding a solution!
@alexanderadam thanks :+1:
I just solved my problem running the "docker-compose run ..." command with sudo.
I solved the problem adding sudo
rebooting did the trick for me
I also had the issue after adding user to docker group to avoid sudo. Rebooting solved everything! Thanks
after adding user to docker group reboot is not required, just log out and login, its working for me
I tryed before rahman. It didn't work. Thanks anyway
+1
This is still an issue on Ubuntu 16.04 and adding myself to the docker group, then relogging worked. This issue should not be closed.
Ubuntu 16.04
https://github.com/docker/compose/issues/1214#issuecomment-102246925
Work perfect but restart before
Ubuntu 16.04 has the same error
Solution (from https://docs.docker.com/engine/installation/linux/debian/, does not only work with Debian):
Add the docker group if it doesn't already exist.
sudo groupadd docker
Add the connected user "${USER}" to the docker group.
Change the user name to match your preferred user.
You may have to logout and log back in again for
this to take effect.
sudo gpasswd -a ${USER} docker
Restart the Docker daemon.
sudo service docker restart
@mikevoets yes I think that should solve this issue.
I had the same thing happen on a new install and realized it was because I wasn't using 'sudo'.
Does anyone knows how to run it without using sudo?
See my reply Marco
2016-11-08 0:15 GMT+01:00 Marco Ordonez [email protected]:
Does anyone knows how to run it without using sudo?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/docker/compose/issues/1214#issuecomment-258994514,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEN6D4Gfir0gehnbenS0IT65wLHAo2VWks5q77ERgaJpZM4D2vHs
.
@mordonez-me, adding into docker group will help.
sudo gpasswd -a ${USER} docker
In general, I have following installation steps in Centos 7 with root
user:
# Remove SELinux for dev VMs
yum remove -y selinux*
# Docker
curl -fsSL https://get.docker.com/ | sh
systemctl enable docker
systemctl restart docker
curl -L https://github.com/docker/compose/releases/download/1.8.1/docker-compose-`uname -s`-`uname -m` \
> /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose
gpasswd -a vagrant docker
And after that it works fine with my non-root vagrant
user.
this only worked for me after logging in and out after adding my user to the docker group.
FWIW, I needed a system restart before it started working for me. This was likely due to the fact the linux-image-extra-*
kernel packages were freshly installed as required by docker on Ubuntu Xenial. See Prerequisites by Ubuntu Version.
Try running dockerd
or sudo dockerd
if required first to start daemon. If you start dockerd
with sudo
you may want to run docker-compose up
with sudo
also. otherwise it's fine.
Since I used some of the suggested commands in this thread, I wanted to share my experiences.
I have the following configuration in the Vagrantfile
:
config.vm.provision "docker"
config.vm.provision "shell", inline: "docker ps", privileged: false
# or
# config.vm.provision "shell", inline: "docker-compose ps", privileged: false
I get the following issue:
when I try to use Docker:
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
when I try to use Docker Compose:
==> default: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
==> default:
==> default: If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
Thanks to this comment I got it working.
Solution:
config.vm.provision "docker"
# The following line terminates all ssh connections. Therefore
# Vagrant will be forced to reconnect.
# That's a workaround to have the docker running with the vagrant user
config.vm.provision "shell", inline:
"ps aux | grep 'sshd:' | awk '{print $2}' | xargs kill", privileged: true
config.vm.provision "shell", inline: "docker ps", privileged: false
this is not a Docker related issue, but more a linux socket permission problem (very common issue between php-fpm and nginx).
1) Docker is a classic HTTP client/server application, the client will speak via a socket or IP to the server
2) The socket is a linux file, with permission, it belongs to an user and a group:
sudo ls -alh /var/run
...
srw-rw---- 1 root staff 0 Jan 22 10:09 docker.sock
....
3) When doing docker ps
, you must have permission to access to docker.sock
file
In this case, just do sudo usermod -aG staff [ME]
to add you in the right group (usually it's docker
) (same thing with php-fpm, where the group is usually www-data).
I had the problem, that I used pip install docker-compose
. I uninstalled it and used sudo pip install docker-compose
. Now the command sudo docker-compose up
works.
Hope that helps.
whenever you have authentication problems with a pip install is best to use pip install [package] —user than using sudo, in some cases using sudo will cause authentication problems while executing the application itself.
On Jan 25, 2017, at 5:38 PM, oesah notifications@github.com wrote:
I had the problem, that I used pip install docker-compose. I uninstalled it and used sudo pip install docker-compose. Now the command sudo docker-compose up works.
Hope that helps.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/docker/compose/issues/1214#issuecomment-275255529, or mute the thread https://github.com/notifications/unsubscribe-auth/AMoEJ_g9iZOd2_BQUgaqgyk2mPLIv43eks5rV88AgaJpZM4D2vHs.
on Fedora Linux
add your user to docker group
sudo usermod -aG docker username
after this command reboot, logout is not enough as on other distros
Nothing is better than recommending the official doc:
https://docs.docker.com/engine/installation/linux/linux-postinstall/
check this out.
The official doc is always the first place where you should go for help.
So I ended up adding the user to the docker group:
sudo groupadd docker
sudo usermod -aG docker $USER
sudo service docker restart
I still had connection issues when running docker ps
as the user giving me the following error:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.27/containers/json: dial unix /var/run/docker.sock: connect: permission denied
Rebooting the server fixed this issue allowing me to run docker commands as the user without using sudo:
sudo reboot now
... (wait for boot) ...
ssh server
docker ps
EDIT:
It was mentioned that you just need to logout/login for this to update, no restart needed to run docker commands without sudo after adding the user to the docker group.
using sudo solved it for me too
Without logout:
sudo usermod -aG docker $USER
su $USER -
As mentioned above indeed:
sudo usermod -aG docker $USER
Logout.
Login.
Done.
I had the same problem and in my case the cause was that I had some files in the folder with Dokcerfile to which I had no access rights. After running chown
all started to work nice.
The solution with usermod
hasn't been working for me.
UPDATE
It has happened again for me and this time the solution was to remove all docker containers with:
docker ps -aq | xargs docker rm
This is actually a problem of installation. Please refer to the official page the for post-installation. I solve this problem with the help of the document.
As @TrkiSF2 said above. After adding your user to the docker group, you need to logout and log back in again for them to take effect.
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.29/containers/json: dial unix /var/run/docker.sock: connect: permission denied
solution: # chmod -Rf 777 /var/run/docker.sock
Restarting solved after doing
sudo usermod -aG docker ${USER}
Got this problem on digital ocean droplet. Setting droplet to internal kernel management fixed this problem for me https://www.digitalocean.com/community/tutorials/how-to-update-a-digitalocean-server-s-kernel#setting-up-the-droplet-for-internal-kernel-management
I had this problem on a code repo that was building fine one moment and then not. I had other repos on the same machine and same account that built just fine, so it wasn't a groups issue or anything with the system configuration. I had no DOCKER_HOST env var set. I suspect this error can be caused by a variety of reasons, but for me it ended up being root ownership of the build artifacts in the repo directory. sudo chown -R
all files in the repo to the user account solved the problem for me.
I personally tried @cloojure 's solution and it worked. But only after I added myself to docker group and re-login. The re-login part is essentail
I ran into this same error message, and just like ChrisPappalardo it was due to a file permission issue not the daemon. sudo chown -R
on the build assets fixed it.
I get the same error message when I run "docker-compose build".
So I added the sudo command and it's works fine. ($ sudo docker-compose build)
this might be another solution:
sudo chmod 777 /var/run/docker.sock
@Farada changing the permissions is dangerous; having access to the Docker API is equivalent to having root access on your machine; changing the permissions to 777 gives anyone on the host root access.
Adding your user to the docker group is the solution for this, as mentioned above you need to reboot your server/computer. Please don't chmod anything to 777!
If you installed docker using sudo command, try sudo YOUR_COMMAND.
In my case, Docker created folders and files in my project folder whenever i ran the container (I use volumes to link all sources etc).
By default a docker image runs with the root user, and this is what caused the issue. Whenever I ran build processes in my image, the output files would have root:root
permissions set, which is reflected in my
filesystem.
It turns out this error is thrown when Docker can't access these files, because when the build starts it runs as the user you executed the command with. When it hits the dirs/files with root:root
it will bail and give a generic ....is it running?
error when it should say permission denied in X, cannot continue
.
In my case I just added the files my Docker image generates into .dockerignore
and it was solved instantly.
So basically, I was given an unrelated error.
Edit I see a lot of people using sudo
as a soultion. The reason this "magically" works is because of the issues I describe in this comment. When running under sudo, permissions is no longer an issue since you run as root. This is not a fix!
I've been getting this:
î‚° docker-compose build
db uses an image, skipping
Building web
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.
The issue was that some files in the context of the Dockerfile had restrictive permissions, a quick sudo chown -R damo ./*
fixed it.
However I would argue there is indeed an issue with docker-compose
here — I should have received an informative error message that accurately specifies that it failed because of a permissions error, rather than an ambiguous connection error which was a red herring in my case as I wasted time messing with the docker daemon service itself.
I got this few times.
For me it is no config issue. Instead, it feels like Docker dies and stop, during some event I still can't tell when it occurs.
Anyway if my intuition is correct, the fix could be sudo service docker restart
but apparently this is not sufficient.
So at the end the only solution that works is a reboot.
The docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can only access it using sudo. The docker daemon always runs as the root user. Linux Post Install
$ sudo groupadd docker
$ sudo usermod -aG docker $USER
reminder: (remember to restart session or reboot VM )
I had the same problem. As others have mentioned, when I ran the docker-compose with sudo, it worked.
Hi, guys I faced the same issue while I'm using Fedora 26 and then I found the solution for Fedora 25, but it does work for me.
Here is the snippet:
$ sudo groupadd docker && sudo gpasswd -a ${USER} docker && sudo systemctl restart docker
$ newgrp docker
REF: https://developer.fedoraproject.org/tools/docker/docker-installation.html
I hope it help you, Thanks
sudo systemctl status docker.service -l
is very useful to find the real problem.
I had the same but only with docker-compose build
. This was finally just a problem of file permission. I created files inside the container, owned by root, and it was not able to build with those files. I simply did a sudo chown -R $USER .
and it works.
I was having the same error creating a mysql container after having deleted my previous one.
The reason was that I had a data folder (for persistence) that was owned by the user in the previous container.
The solution was to delete the data folder. Warning - you will lose your data. If you wish to keep your data maybe move the data folder or assign new owners.
did the trick adding myself to the group
usermod -aG docker ${USER}
reboot and works !
For me this was resolved by login to admin mode : sudo -s
If this helps !
I obtained this same error message by using an image name containing a "+" character. (This came about because I was naming my images after a version control id.)
For example, a docker-compose.yaml
containing:
services:
foobar:
image: "foobar:a-b+c"
....
fails with
Building foobar
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.
But removing the "+" from the image name worked fine.
@fabiopaiva Not sure if someone replyed to you but it needs to be sudo exclusive at first because any user that can execute the docker command can become sudo in the host.
Anyone with docker execution access can launch a simple docker bind the entire host filesystem and access it as root (i.e shadow files for passwords or modify permission for the entire system).
So you have to be very carefull who can use this command.
Thanks @Gronan, I don't remember clearly about this thread.
But, regarding your explanation, if you run with sudo you give this control anyway.
Thank you for the explanation
Dont need sudo.
Add your user to the docker group , docker
and restart the docker service , service restart docker , or , systemctl restart docker.service
No reboot of the system is needed.
This issue is related to how a linux process run under which user and which group and what happens when you change the membership to the process group and how it will take effect.
usermod -aG docker ${USER}
then _reboot_.
This is because the docker daemon runs as the root user and docker-compose as a regular user
Three steps to fix it:
More details in:
https://docs.docker.com/engine/installation/linux/linux-postinstall/#manage-docker-as-a-non-root-user
Instead of rebooting you can just type su - ${USER}
. I guess this reloads the currently active user in the Terminal.
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
This worked for me without the reboot:
sudo usermod -aG docker ${USER}
id
My problem ended up being that in my docker build context, I had files that were neither owned by my user nor my group. For example, I mounted a folder in my docker build context to a mongo container, so these files were owned by the mongodb user and group. To fix this, I just deleted that folder, and used a volume generated by docker for my mongodb service instead, and then I was able to run docker-compose without sudo
I can confirm @alexcdot observation: Had files in my project repository owned by root (dunno how they got there). Deleting them resolved the issue. Now I can run docker-compose without sudo privileges.
Also confirming the @alexcdot and @tbuss93 solution. Worked for me as well. I think that in such case, the error should be more user-friendly and ideally show problematic files.
i had this issue today for a new Dev notebook. I solved it like this
1) Stop Docker
sudo service docker stop
if you look at this file permission you'll see that without sudo
you won't be able to get access to Docker daemon
sudo ls -la /var/run/docker.sock
srw-rw---- 1 root docker 0 Dec 21 19:16 /var/run/docker.sock
2) I remove this docker.sock
sudo rm /var/run/docker.sock
thanks @rbahumi
3) i run this command
sudo usermod -aG docker ${USER}
and now you are almost done just Log out or better just restart the computer you don't have to start the service because it start automatically
@cooljl31 removing the socket seems to be unnecessary, as the permissions show that members of the docker group have rw access. You will have to restart docker and the session though.
This fix, however, seems to be unrelated to the issue
This solved my problems: https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user
Just remember to log out and log back in. Run the commands as the user you want to use docker.
sudo usermod -aG username
then Logout and login to make it work.
Worked like a charm for me.
I had to also start the docker service manually after a new installation of docker-ce (17.12.0~ce-0~ubuntu) and docker-compose to make the error message disappear:
sudo service docker start
Following the steps described in the documentation resolved the issue with my new Ubuntu 16.04 installation.
I had to reboot the system after applying those changes though.
Use command: sudo docker-compose up -d
if u met:
$ docker-compose up
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.
u should check if current login user belongs to /var/run/docker.sock
user group docker
.
Try run Compose as sudo.
To solve this without sudo
do as @leoyuholo said in the second comment and logout and back in.
I get the same error message when I run docker.
It is solved by adding myself to the user group 'docker'Try to run the following command to add yourself to the group usermod -aG docker ${USER}
Or you can run the following command to find out what groups you belong to groups $USER
After that logout and log back in and it works
link to comment https://github.com/docker/compose/issues/1214#issuecomment-102246925
ps. this is for people like me that skip the first couple comments -_-
Just because it takes my a long time to re-dsicover this, and is the first thing I hit on google. There is nothing wrong with my user permissions on my laptop. The problem was the file permissions on one of the mounted folders. If you either fix the permissions so you don't need root to access them, or delete them (in my case it is cached assets for rails) it successfully goes through.
The real problem is the error message does not tell you what the specific problem is when you build via docker-compose.
I met the issue also. It is a user access issue.
I solved it by install docker-compose in root mode and run docker-compose also in root mode.
@zjhken that is not really a solution, but rather a workaround.
There is something wrong with either the file permissions in your project folder or your group permissions. See @alexcdot and my observations for the first case, and try sudo usermod -aG docker <your username>
followed by re-logging-in for the latter.
@tbuss93 you're right. I have use you solution to solve it. It works. This might be the best solution.
write => sudo docker info
Just add sudo
before the command which you are trying to run!
So in my case the gitlab_ci_multi_runner
user is part of the docker group. So that is not my issue:
groups $USER
gitlab_ci_multi_runner : gitlab_ci_multi_runner docker
But for some reason I'm still getting SOMETIMES (notice that this is sometimes the case): Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Meaning I have the feeling my daemon is crashing or is instable? This is not handy, since I would like to have a stable and reliable continuous integration by using Docker. Any thoughts how I could debug this instability any further?
Thanks!
People, firts at all my apoligize for my english. i'm have th same problem but a realize that its happen on konsole inside kde, but when i run in a terminal crt alt f1 i dont need use sudo!. Iḿ already have $USER on docker group. I hope you ca understand me.- thanks
Just run;
sudo chown $USER:docker /var/run/docker.sock
I too faced the issue 'Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?' .Later I noticed the following.
[ec2-user@ip-172-28-6-201 docker-elk]$ which docker-compose
/usr/local/bin/docker-compose
[ec2-user@ip-172-28-6-201 docker-elk]$ which docker
/usr/bin/docker-compose
Since docker-compose binary is inside /usr/local, I was able to execute docker-compose command without 'sudo'. To execute 'docker' command, I needed sudo access.
I fixed using following commands.
cp /usr/local/bin/docker-compose /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose
sudo rm /usr/local/bin/docker-compose
Now verify 'docker-compose' command needs 'sudo' to execute.
AFter the above steps are executed, docker-compose command works for me.
after adding user to docker group
restarting the machine will do.
For me its working.
[ec2-user@ip-172-31-7-179 docker-elk]$ sudo docker-compose up -d
My docker and docker compose version are.
[ec2-user@ip-172-31-7-179 docker-elk]$ sudo docker version
Client:
Version: 17.06.2-ce
API version: 1.30
Go version: go1.8.4
Git commit: 3dfb8343b139d6342acfd9975d7f1068b5b1c3d3
Built: Fri Nov 10 00:50:37 2017
OS/Arch: linux/amd64
Server:
Version: 17.06.2-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.4
Git commit: 402dd4a/17.06.2-ce
Built: Fri Nov 10 00:51:08 2017
OS/Arch: linux/amd64
Experimental: false
[ec2-user@ip-172-31-7-179 docker-elk]$ sudo docker-compose version
docker-compose version 1.21.2, build a133471
docker-py version: 3.4.0
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017
after following add user procedure make sure u restart your machine.
I can reliably produce this message with a project structured like this:
├── docker-compose.yml
├── Dockerfile
└── volumes
If 'volumes' exceeds a certain size, I get the following error, when running 'docker-compose build':
Running the command with sudo begins to build the image, but, it's nice to not have to rely on sudo for automation.
It seems the cause of this issue in my instance is my volumes dir being passed into the build context. I guess some limitation on non-sudo users for build context size? or timeout?
So in my instance the fix is to either move the volumes dir, or add it to a .dockerignore, resolving this particular flavour of this error message.
cd /var/run
sudo chmod 777 docker.sock
sudo service docker start
docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
Solved the problem :)
solved with sudo
If everything said here don't work, reinstall docker. It worked for me.
No need to restart the machine in my experience which is helpful if you're in a production environment - after sudo usermod -aG docker $USER
, log out and log back in. That should pass the new user group assignment to any program or app that needs it.
Failing that, @praveenbaliga 's response 3 comments up from my comment will work in a pinch if the permissions were incorrect to begin with or you're in a staging environment, but may violate security policies if you're working in a hardened production environment. You really only want root
and docker
group members to have access to the docker.sock
and chmod 777
will give rwx
access to every user.
/usr/lib/python2.7/dist-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.23) or chardet (3.0.4) doesn't match a supported version!
RequestsDependencyWarning)
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.
I was having the same issue just now running $ sudo docker-compose
. I became root first by doing $ sudo su
, and then ran the docker-compose
normally.
use this link to solve the problem as it works for me. I had the same problem but now it works fine
I get the same error message when I run docker.
It is solved by adding myself to the user group 'docker'Try to run the following command to add yourself to the group
usermod -aG docker ${USER}
Or you can run the following command to find out what groups you belong to
groups $USER
And then restart your computer
This thread is helpful.
I entered the same issue. On the contrary, I add sudo at the beginning of my command line and it solved!
Just run;
sudo chown $USER:docker /var/run/docker.sock
This one worked for me. Not sure why adding $USER to docker group didn't solve it.
Edit: it turns out, docker service regenerates /var/run/docker.sock
every time it reloads. You need to redo the said trick every time you restart docker (won't happen too much, eh?)
Most helpful comment
Soleved for me too with sudo command