2

I am facing the below error with docker dind when running docker image ls inside container
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Below is my dockerfile

    FROM docker:latest

RUN apk add --no-cache --update --virtual .build-deps python3-dev build-base \
            linux-headers libffi-dev openssl-dev py3-pip

RUN pip install --upgrade pip

RUN pip3 install cryptography==2.8

RUN pip3 install docker-compose


COPY . /src/onboarding

COPY Portal_TEST /usr/lib/python3.8/site-packages/Portal_TEST
~

Do I need some libraries ??

David Maze
  • 130,717
  • 29
  • 175
  • 215
  • Why the `python` tag though? This has nothing to do with python... – GPhilo Jun 24 '21 at 08:20
  • Why are you building your image `FROM docker`, when it seems to be a Python application? This doesn't seem to be a complete reproduction (there's no `CMD` and nothing you show here would cause that error); can you edit the question to include more details, including the actual application code and the actual error message? – David Maze Jun 24 '21 at 09:55

1 Answers1

1

You need to map the host's docker socket into the container, if you want to be able to run docker commands inside of it. When you docker run, add:

-v /var/run/docker.sock:/var/run/docker.sock
GPhilo
  • 18,519
  • 9
  • 63
  • 89