You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running? #1214
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...
Reacted by Stanislav Mayorov, Andreas Kuckartz, fabienchn-zz, Claudio Cardozo, Tofunmi Ajayi, Yugloocamai, Zack Cao, Bowen Street, Serhii Potapov, AirCrk and 3 more
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
Reacted by 小水手, Luca De Franceschi, Manuel Salvadores, jason, Anton Belonovich, Justin , Charles Mulder, Pawel Zareba, Vadim Peretokin, John McGrath and 300 more
Reacted by jalciné, Cara Wang, Mário de Sá Vera, Shariful Islam, Artem Brezhniev, Evanilson Braulio, Austin Pray, Sam, sagar30051991, Nandini Ramesh and 62 more
Reacted by Daniel Zorro, IMBrianr, Jonathan Hu, Alejandro Acevedo, Federico Matteo Benčić, Sam, manasa96, Wouter, Corey Slaven, Simon and 16 more
Reacted by Daniel Zorro, Marcus Pohorely, Julián Perelli, Jonathan Hu, Sam, Wouter, Lucas Mansur, Chris Martin, Stian Lind Petlund, Corey Slaven and 27 more
Reacted by jalciné, Alejandro Sobko, Paul, Evanilson Braulio, Micooz Lee, Patrick Safarov, sagar30051991, Richard Popeliš, Ramil, Dmitri Lebedev and 18 more
Reacted by Ante Sepic, Jason Yeo, Daniel Zorro, Julián Perelli, Jonathan Hu, gt510, David Poggi, Denislav Dimitrov, Johannes Siebel, Raphael D. Pinheiro and 36 more
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.
Reacted by Cara Wang, Philippe Arteau, Catherine Hurley, Gunther Cox, Benjamin Song, Hemanth Kumar Veeranki, sriharshagondi, manu, Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి), David Sarmiento and 3 more
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.
Reacted by Nastia, kwoolery, Hassan Magdy Saad, Max Baluev, Lara Aasem Ahmed and Diana Baburina
Reacted by kiran ps, Ferran Llamas, Gary (Gurpreet) Singh Bains, Francisco Fiorillo, Mohammad TRABELSI, Max Baluev, Omar Yousry B, Lomanic, AndrianD, Sandesh S and 3 more
Reacted by Omar Yousry B, Manasa Maheswaran and Diana Baburina
Reacted by Alaeddine Messadi, Sedigheh (Sarah) Eslami, Jose Berrocal, Anusree Prakash, Barys Malaichyk, Tara Firoozian, Diana Baburina and Israel Mendes
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,
Reacted by Tihomir Kehayov, Barry Els, Ton Oguara, Geoffroy Givry, HeroInGitHub, Peeyush Chandel, Julio Gracia Gutiérrez, Marcelo Lotif, Burak Ergenc, tomas-arce and 35 more
Reacted by Hamza Hamidi, Georgy Kagan, Augusto Russo, Brian Mayrose, Malki Davis, Nabiha Asghar and Lattice 0
Reacted by Asbat, Brian Mayrose, Malki Davis and Pascal Schulze
Reacted by Michał Romańczuk, andrew ananta gondo 🎏, Vamsi Krishna B, anton6, Radu Aftinescu, Marcelo Tosco, Sung, 小水手, Breena Theseira, Gregor Karetka and 460 more
Reacted by Ofelquis G, jalciné, Victor Copque, Damian, Natalie Lien, Masry, Salah Eddine Taouririt, AlexNothing, sagar30051991, Chris Poyzer and 73 more
Reacted by Pablo P Varela, Victor Copque, rf-sys, Bryan Cote, Max, Praditha Hidayat, Gabriel Guimarães, Giovanni Bernini, shelly jindal, Nick DeCoursin and 26 more
Reacted by Pablo P Varela, Victor Copque, Baruch Velez, Praditha Hidayat, Marc Bernat, galli-leo, Gabriel Guimarães, Angel D. Munoz, Giovanni Bernini, shelly jindal and 39 more
Reacted by Ramkhad, Denis Grushkin and conkerts
Reacted by biglynch, makten, Daniel Shneyder, René Jochum, NicoD, Nikita Shupeyko, Mário de Sá Vera, (Rew) Andrew McLagan, Gabriel Pedrosa, ashutosh chaudhary and 46 more
@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 just solved my problem running the "docker-compose run ..." command with sudo.
Reacted by Viktor Rak, Jinli Liang, Yuankui Li, Vasil Dakov, Alex Parij, ajeet, Boris Gordts, Igor Zupet, Maksym Cherevko, Johannes Gangsö and 124 more
Reacted by Max Ludwig, Salah Eddine Taouririt, AlexNothing, sagar30051991, Roman Kiselenko, lpan, Lukáš Lukáč, Björn Richter, Samuel Fraga, Eugene Tsymbal and 47 more
Reacted by Eric Yong Yeon Kim, mz3216, Farrukh Kholmukhamedov, shelly jindal, Magdalena Waligórska, Betmart Aguilar, Tchoupinax, Yuri Mironenko, Reginaldo Junior, knnth and 10 more
Reacted by mz3216, Sharnisha, Chris Papidas, Eugene Kutas, David Mendez, shelly jindal, Randy Gupta, Enrique Tuya, Betmart Aguilar, Tchoupinax and 13 more
Reacted by knnth, Niklas Ravnsborg, Nivolk, Bishal Dey, Ilkham Gaysin, Christophe V, Romain DARY, Shikhar Jaiswal, Mattekenpis, benmackerras and 3 more
Reacted by Chris Papidas, Eugene Kutas, David Mendez, shelly jindal, Jonas Erik, Betmart Aguilar, Tchoupinax, Vaibhav Sood, Nikita Belayev, knnth and 15 more
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?
Reacted by Thibaut Guirimand, Guilherme Paixão, Yuankui Li, Tome Pejoski, Vasil Dakov, Slava, Alex Parij, ajeet, r0c, Chad Miller and 132 more
Reacted by Max Ludwig, Oleg Butuzov , Steve Coffey, Ramil Iksanov, Deni, Vlad Filippov, carolinadominguez, Gonzalo Garcia, Masry, AlexNothing and 114 more
Reacted by Tchoupinax, Vipin Tiwari, Renato Francia Castillo, acrolisnun, ldar, Manuel Imperiale, Chet-S and ArthurBarre
Reacted by Andrew Spencer, Marko Marjanovic, Ramolec, Victor Martins, Tchoupinax, Raquel Machado Souza, Xi Huang, Talitha Pumar, David Sarmiento, Iain Collins and 10 more
Reacted by Tomáš Dvonč, Václav Pelíšek, Ruan Mer, Guto Maia, Arunlal S, Markus Ylinen, Filippo Conti, Shikhar Jaiswal, Renato Dehnhardt, Max Wittig and 9 more
Reacted by Hervé Kyle MUTOMBO MATANDA, Purinda Gunasekara, Vlad Filippov, Filip Aleksić, Daniela Quiroz Olguin, armanbhuiyan-dsi, Victor Martins, Tchoupinax, Vaibhav Sood, Raquel Machado Souza and 19 more
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':
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.
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.
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.
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?)
Reacted by Adrian C., Tomas Ohlson, Roman Varkuta and Felipe Bergamo
Activity
leoyuholo commentedon May 15, 2015
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 $USERthaJeztah commentedon May 26, 2015
Looks like docker-compose is disregarding the
$DOCKER_HOSTenv var here, because it's trying to connect to the socket in stead of the 127.0.0.1 address.francescolofranco-dev commentedon Aug 11, 2015
same issue here
tylerteh commentedon Aug 20, 2015
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.
comxd commentedon Aug 28, 2015
You can try the 5.0.3 (prebuild) at https://www.virtualbox.org/wiki/Testbuilds ? It's fix this issue for me.
dagisus commentedon Sep 6, 2015
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,
vkeziah commentedon Sep 18, 2015
Soleved for me too with sudo command
thaJeztah commentedon Sep 18, 2015
@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)
rept commentedon Sep 18, 2015
I did a new installation on a completely different machine and it's working now. So you van close it.
thaJeztah commentedon Sep 18, 2015
Thanks, @rept, and good to hear it was resolved!
alexanderadam commentedon Jan 4, 2016
I get
ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?too everytime I activate
tty: trueorstdin_open: trueindocker-compose.ymland runningdocker-compose up.Can it be related?
romerobrjp commentedon Jan 19, 2016
I just solved my problem running the "docker-compose run ..." command with sudo.
jurajseffer commentedon Feb 1, 2016
I ran into this when running
docker compose up -dduring vagrant up. Uservagranthas been added to groupdockerbut the above error appears when running it withoutsudo. It works later on if one logs in as uservagrantbut fails during provisioning so it has something to do with env variables?docker-compose version: 1.4.1cloojure commentedon Feb 24, 2016
Simple solution: sudo docker-compose up
103 remaining items
kuhajeyan commentedon Jun 14, 2018
after adding user to docker group
restarting the machine will do.
roshangl commentedon Jun 27, 2018
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
orapradeep commentedon Jul 26, 2018
after following add user procedure make sure u restart your machine.
mikeyjk commentedon Aug 3, 2018
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.
praveenbaliga commentedon Aug 25, 2018
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 :)
bitbd83 commentedon Aug 27, 2018
solved with sudo
joao-pedro-alves commentedon Aug 29, 2018
If everything said here don't work, reinstall docker. It worked for me.
jerryrelmore commentedon Sep 1, 2018
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
rootanddockergroup members to have access to thedocker.sockandchmod 777will giverwxaccess to every user.nileshparwan commentedon Sep 8, 2018
use this link to solve the problem as it works for me. I had the same problem but now it works fine
https://techoverflow.net/2017/03/01/solving-docker-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket/
soscler commentedon Sep 25, 2018
And then restart your computer
leimao commentedon Feb 8, 2019
This thread is helpful.
zhongw117 commentedon Feb 15, 2019
I entered the same issue. On the contrary, I add sudo at the beginning of my command line and it solved!
adonese commentedon Feb 17, 2019
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.sockevery time it reloads. You need to redo the said trick every time you restart docker (won't happen too much, eh?)Synchronize common files from prometheus/prometheus (docker#1214)