Home > front end >  Call docker in docker-container
Call docker in docker-container

Time:03-30

I have docker-compose like

myservice:
   tty: true
   restart: on-failure
   container_name: myname
   volumes:
      - /var/run/docker.sock:/var/run/docker.sock
   env_file:
      - env_file
   ports:
      - "7777:7777"

why docker ps for example don't work in container?

CodePudding user response:

About you answer to my comment (docker not installed inside your container) here is my working solution:

FROM <<YOUR_DOCKER_BASE_IMAGE>>

# Docker Compose installation for "Build / Container" stage
# https://medium.com/@schogini/running-docker-inside-and-outside-of-a-jenkins-container-along-with-docker-compose-a-tiny-c908c21557aa

USER root

RUN apt update -y
RUN apt install -y curl
RUN curl https://get.docker.com/builds/Linux/x86_64/docker-latest.tgz | tar xvz -C /tmp/ && mv /tmp/docker/docker /usr/bin/docker

# Customize here your container...

PS: the /var/run/docker.sock, as you wrote, is mandatory.

  • Related