Sitemap

Member-only story

Sibling Docker Containers

3 min readJul 21, 2019
Photo by Tim Easley on Unsplash

Docker Containers are among the best options when you need to start a repeatable task in a clean context. This is especially common when it comes to CI/CD. As your pipeline requires a step where you run tests against your code, you want to get results from a pristine environment.

A Docker Container comes in hand in that regard. They are great for fire-and-forget tasks like that, where the container does its job and then it’s trashed immediately after. Nevertheless, the image it came from can be used to spawn a brand new container for another round of tests. Wash, rinse, repeat.

Docker-in-docker

But what if you run your CI/CD pipelines with tools, like Jenkins or Travis, which are already running inside a Docker Container? If you run a container from inside another container, you would end up with a Docker-in-Docker scenario. This was a mandatory choice up to a few years ago, but it brings some bad news and some other very bad news, including:

  • need to copy the images on the parent container (or mount a volume at least);
  • issues with AppArmor, SELinux, and whatnot;
  • issues running a copy-on-write filesystem (the child container) on top of a normal filesystem (the parent container);
  • data corruption caused by dirty tricks and shenanigans to…
Andrea Colangelo
Andrea Colangelo

Written by Andrea Colangelo

Technical Lead @ Rapsodoo Italia. Also: Software Engineer, Debian Developer, Ubuntu Developer, Foodie, Jazz lover, Rugby passionate, European