Skip to content

Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running? #1214

Closed

Description

@rept

I tried everything in this thread: #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...

Activity

  1. leoyuholo commented on May 15, 2015

    @leoyuholo

    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

  2. thaJeztah commented on May 26, 2015

    @thaJeztah
    Member

    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.

  3. francescolofranco-dev commented on Aug 11, 2015

    @francescolofranco-dev

    same issue here

  4. tylerteh commented on Aug 20, 2015

    @tylerteh

    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.

  5. comxd commented on Aug 28, 2015

    @comxd
  6. dagisus commented on Sep 6, 2015

    @dagisus

    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,

  7. vkeziah commented on Sep 18, 2015

    @vkeziah

    Soleved for me too with sudo command

  8. thaJeztah commented on Sep 18, 2015

    @thaJeztah
    Member

    @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)

  9. rept commented on Sep 18, 2015

    @rept
    Author

    I did a new installation on a completely different machine and it's working now. So you van close it.

  10. thaJeztah commented on Sep 18, 2015

    @thaJeztah
    Member

    Thanks, @rept, and good to hear it was resolved!

  11. alexanderadam commented on Jan 4, 2016

    @alexanderadam

    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
    
  12. romerobrjp commented on Jan 19, 2016

    @romerobrjp

    I just solved my problem running the "docker-compose run ..." command with sudo.

  13. jurajseffer commented on Feb 1, 2016

    @jurajseffer

    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

  14. cloojure commented on Feb 24, 2016

    @cloojure

    Simple solution: sudo docker-compose up

  15. 103 remaining items

  16. kuhajeyan commented on Jun 14, 2018

    @kuhajeyan

    after adding user to docker group
    restarting the machine will do.

  17. roshangl commented on Jun 27, 2018

    @roshangl

    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

  18. orapradeep commented on Jul 26, 2018

    @orapradeep

    after following add user procedure make sure u restart your machine.

  19. mikeyjk commented on Aug 3, 2018

    @mikeyjk

    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.

  20. praveenbaliga commented on Aug 25, 2018

    @praveenbaliga

    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 :)

  21. bitbd83 commented on Aug 27, 2018

    @bitbd83

    solved with sudo

  22. joao-pedro-alves commented on Aug 29, 2018

    @joao-pedro-alves

    If everything said here don't work, reinstall docker. It worked for me.

  23. jerryrelmore commented on Sep 1, 2018

    @jerryrelmore

    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.

  24. nileshparwan commented on Sep 8, 2018

    @nileshparwan
  25. soscler commented on Sep 25, 2018

    @soscler

    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

  26. leimao commented on Feb 8, 2019

    @leimao

    This thread is helpful.

  27. zhongw117 commented on Feb 15, 2019

    @zhongw117

    I entered the same issue. On the contrary, I add sudo at the beginning of my command line and it solved!

  28. adonese commented on Feb 17, 2019

    @adonese

    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?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions