Create a container image for Docker-in-Docker

“Docker-in-docker” is an often useful technique to help running multiple instances of container clusters (e.g. swarm services, docker-compose) on the same container host. It consists of:

- A conventional container image with docker server daemon and client utilities.
- A privileged container running the image, which has its entrypoint script to start the nested docker server daemon.
- Other techniques applied optionally to enhance the server daemon performance.

Let’s build the container image. First, prepare a utility script called `modprobe`:

set -eu

# “modprobe” without modprobe:
for module; do
if [ “${module#-}” =…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store