Yossi Gilad
Yossi Gilad

Reputation: 11

docker-compose | Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I'm getting this error on alpine base docker container: "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?" when I running the following command: docker images I'm using the following docker-compose:

services:
  alpine:
    build:
      context: ./
      dockerfile: Dockerfile
#      command: -H unix:///var/run/docker.sock
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

and this is my dockerFile:

FROM yossigilad/alpine8:v1 AS prepare
#FROM openjdk:8-jdk-alpine AS prepare
RUN mkdir -p /app/source
#copying all project files to docker
COPY  . /app/source
WORKDIR /app/source
RUN docker images

when I running the container with this command its ok docker run -ti -v /var/run/docker.sock:/var/run/docker.sock DOCKER_ID

What I'm missing?

Upvotes: 0

Views: 1993

Answers (1)

Ashok
Ashok

Reputation: 3581

Try the below steps which worked for me

  1. service docker stop
  2. cd /var/run/docker/libcontainerd
  3. rm -rf containerd/*
  4. rm -f docker-containerd.pid
  5. service docker start
  6. docker run

Upvotes: -1

Related Questions