I want to create a Docker image with Java and Docker installed on it. The idea is that the eventual docker container should be able to create Docker images. My Java application executes commands like docker build -t my-image .
.
That is why I need Docker installed in my Docker container
CodePudding user response:
In the past I solved the same issue writing the following Dockerfile
:
FROM maven:3.6.3-jdk-8
USER root
# Install docker CLI for docker images generation inside the container itself
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 with your instructions...
Of course, you can change the FROM
image as per you needs.