Docker: Couldn't connect to docker daemon at http+docker://localunixsocket -is it running?

jenkins couldn't connect to docker daemon at http+docker://localhost - is it running?
error: couldn't connect to docker daemon at http://127.0.0.1:2375 - is it running?
couldn't connect to docker daemon windows
couldn't connect to docker daemon. you might need to start docker for windows
devilbox couldn t connect to docker daemon
cannot connect to the docker daemon at tcp://127.0.0.1:2375. is the docker daemon running?
docker-compose
install docker

I have a somewhat peculiar scenario. I tend to execute command docker-compose -f dev.yml up --build to get the containers up and work. Here, dev.yml is development version of docker-compose.yml. Till this very morning every thing was working fine, and all of the sudden, I started getting error regarding failure to connect to docker-daemon.

Now, this problem only occurs when I have --build included in the command. If I only execute docker-compose -f dev.yml up it works fine. If I include --build into the command and execute it using sudo it works fine again.

Things verified:

  • User executing the command is added to docker group which has permissions for /var/run/docker.sock

Details of dev.yml

version: '2'

volumes:
  postgres_data_dev: {}
  postgres_backup_dev: {}

services:
  postgres:
    build: ./compose/postgres
    volumes:
      - postgres_data_dev:/var/lib/postgresql/data
      - postgres_backup_dev:/backups
    environment:
      - POSTGRES_USER=rocky


  django:
    build:
      context: .
      dockerfile: ./compose/django/development/Dockerfile
    depends_on:
      - postgres
    environment:
      - POSTGRES_USER=rocky
      - USE_DOCKER=yes
    volumes:
      - .:/app
      - /tmp/
    links:
      - postgres
      - redis
    expose:
      - "8000"
    env_file:
      - ./dev.env


  nginx:
    build: 
      context: .
      dockerfile: ./compose/nginx/development/Dockerfile
    depends_on:
      - django
    ports:
      - "0.0.0.0:80:80"
    links:
      - django
    volumes_from:
      - django


  redis:
    image: redis:latest
    hostname: redis


  celeryworker:
    build:
      context: .
      dockerfile: ./compose/django/development/Dockerfile
    env_file: ./dev.env
    depends_on:
      - django
      - redis
      - postgres
    volumes_from:
      - django
    command: celery -A rocky.taskapp worker -l INFO
    restart: on-failure


  celerybeat:
    build:
      context: .
      dockerfile: ./compose/django/development/Dockerfile
    env_file: ./dev.env
    depends_on:
      - django
      - redis
      - postgres
      - celeryworker
    volumes_from:
      - django
    command: celery -A rocky.taskapp beat -l INFO

Update: My colleague got stuck with same issue. I have my doubts on config for celerybeat, celeryworker. Can anyone please verify? Thanks.

For me the following command worked,

sudo chown $USER:$USER -R .

Check this conversation I had on github, Issue

If you faced an issue like “Couldn't connect to Docker daemon at http , Check whether docker engine service running or not. Docker-compose maybe can't access to docker engine. You need to use sudo if your user  Make It Easier to Create & Deploy Applications with Containers on AWS. Try Today

I just included sudo before docker-compose, and that did it.

Can't connect to docker from docker-compose, 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  Browse our Great Selection of Dockers Clothing & More. Shop Now & Save Big!

This is most like a permissions issue and docker-compose is giving entirely the wrong error.

Try building the images by hand with docker instead of docker-compose, e.g. docker build -f=./compose/django/development/Dockerfile . and likely you will see what the real issue is.

Couldn't connect to Docker daemon at http+docker://localhost, ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running? If it's at a non-standard location, specify the URL with the  Docker service was running fine, docker ps and info were also reporting no issues, just launching that compose file was the issue. Ubuntu 18.04 docker 19.03.6 docker-compose 1.17.1 (compose file version 3)

I ran into this issue after a fresh install of docker and docker-compose on Ubuntu, trying to run docker-compose up. I managed to solve it as described here by adding my user to the docker group:

sudo usermod -aG docker ${USER}

and logging out and back in.

You may be able to avoid having to log out and back in as described here by running

su - $USER

Docker frequently asked questions (FAQ), Why is DEBIAN_FRONTEND=noninteractive discouraged in Dockerfiles? but inform you that the installation process tried to open a dialog box, but couldn't. docker: Couldn't connect to Docker daemon. Ask Question Asked 3 years, 11 months ago. Active 1 month ago. Viewed 10k times 5. I am running Ubuntu with the following

$ sudo service docker start or $ sudo systemctl docker start this will start running the docker daemon back again if it was stopped somehow, and don't forget to add your user to the docker group too sudo usermod -aG docker $(whoami)

Docker-Compose Couldn't connect to Docker daemon, When I run docker-compose build ; i get the following error: "redis uses an image, skipping Building web ERROR: Couldn't connect to Docker daemon at  Docker Desktop. The preferred choice for millions of developers that are building containerized apps. Docker Desktop is a tool for MacOS and Windows machines for the building and sharing of containerized applications and microservices. Access Docker Desktop and follow the guided onboarding to build your first containerized application in minutes.

How To Install and Use Docker Compose on CentOS 7, ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running? If it's at a non-standard location, specify the URL with the DOCKER_HOST  Hi, I can reproduce the issue by the clicking the 'docker' icon directly in the window open up after opening the dmg file. This is not the standard way to run the application. So the problem probably occurs when the docker application is run outside the Application folder.

Deploying with Docker, ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running? service docker start; Try sudo: sudo docker-compose up -d. Docker Desktop. The preferred choice for millions of developers that are building containerized apps. Docker Desktop is an application for MacOS and Windows machines for the building and sharing of containerized applications. Access Docker Desktop and follow the guided onboarding to build your first containerized application in minutes.

Docker / Action server error: Failed to run custom action / Couldn't , I'm trying to get docker working so I can deploy it to a server for testing. Here is my docker-compose.yml file services: rasa: image:  If the Docker daemon fails to start up with Windows, or stops for some reason, you can get network connection errors or warnings regarding the Docker daemon service

Comments
  • you find a solution? the docker command works fine for me, but docker-compose fails.
  • Thank you. I spent hours, adding myself to the docker group, reinstalling docker, launching docker-compose with sudo wasn't an option... This finally did it!
  • I myself struggled with it for long time before finding it out. Glad it helped.
  • OMG, I can finally stop pulling my hair out. Sounds like this is common after docker updates?
  • It was never about user. The problem was a corrupt tar ball generated. You can take a look at the answer I have given. It has a link to discussion on github with one of the guys from docker contributors.
  • @RajeshYogeshwar I understand. However, I ran into the exact same error as described in the title and this was the solution. It may help others, so I added it as an answer, but you should certainly accept the answer that solved your particular problem.
  • Oh yes definitely, I was not trying to discard your answer. I just thought you might have missed something while reading up that big piece of question :P
  • I am all in for help, because for this things like this there are no single solutions.
  • That solved it for me. Running the su command allowed me to not log out and in again.