Using Docker in docker container. This container can using the Docker daemon on the host to simulate the nested docker container.
-
Run this cntainer. Rememver you must mount the docker daemon to this container
docker run -it --name did -v /var/run/docker.sock:/var/run/docker.sock chenjr0719/did
-
Use docker command
docker ps docker images
Its quiet simple, just using the docker CLI to access the Docker daemon socket on the host.
-
Run a container with docker daemon
docker run -it -v /var/run/docker.sock:/var/run/docker.sock ubuntu:18.04 bash
-
Add Docker repository
apt-get update apt-get install -y \ apt-transport-https \ ca-certificates \ curl \ software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - apt-key fingerprint 0EBFCD88 add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
-
Install Docker CLI in container
apt-get update apt-get install -y docker-ce-cli
-
Using Docker in container
docker ps docker images