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?
docker images
inside a build ? What are you trying to achieve ? The volumes are mounted for the container launched after the build from the resulting image, not during the build. So you won't see any docker service running unless you launch one yourself directly in the layer your are currently building. But I don't really get where this is going. – Zeitounator