0

I want to run docker daemon inside my docker image. I know I can easily achieve this by exposing outer docker process during running my docker image, but unfortunately I have no possibility to control how my image is run. I CAN NOT use DIND.

Therefore I would like to start docker service inside either Dockerfile or some script that is my entrypoint. I tried invoking command:

CMD service docker start

after downloading and installing docker in the image and also including this command in some script start.sh and calling it:

ENRYPOINT ["path/to/script/start.sh"]

None of this worked. Is it at all possible to run docker as I want or am I doing something incorrectly or it is just not possible in my execution environment?

2 Answers2

1

Per your requirements, you can't.

To run the docker service inside of a docker container, you need to modify how the container is launched to give the inner docker service privileges the outer docker service restricts by default.

BMitch
  • 188,157
  • 34
  • 411
  • 383
0

I would suggest to use the DIND Container (Docker in Docker)

docker run --privileged --name some-docker -d docker:1.8-dind

Link to Docker Hub: https://hub.docker.com/_/docker/

opHASnoNAME
  • 19,486
  • 25
  • 95
  • 139