0

I am working on a jenkins ssh agent for my builds I want to have docker installed so it can run and build docker images

I currently have the following in my Dockerfile

RUN curl -fsSL get.docker.com -o /opt/get-docker.sh
RUN chmod +x /opt/get-docker.sh
RUN sh /opt/get-docker.sh

This works fine when I run docker with

docker run <image> -v /var/run/docker.sock:/var/run/docker.sock

Issue I'm having is when I run docker ps with in the container, it shows all my parent containers as well, is there a way to prevent this?

jaekie
  • 2,283
  • 4
  • 30
  • 52

1 Answers1

0

If you mount the host's /var/run/docker.sock your docker client will connect to the host's docker daemon, and so see everything that is running on the host.

To make it so your containers can run docker in a way that appears isolated from the host you should investigate Docker-in-docker.

Jack Ukleja
  • 13,061
  • 11
  • 72
  • 113