![Lead Image © it studiom1, 123RF.com Lead Image © it studiom1, 123RF.com](/var/ezflow_site/storage/images/archive/2021/61/building-sustainably-safe-containers/studiom1_123rf-numbers.png/180365-1-eng-US/studiom1_123RF-numbers.png_medium.png)
Lead Image © it studiom1, 123RF.com
Building sustainably safe containers
Build by Number
Among other things, my job involves developing applications in the field of network automation on the basis of the Spring Boot framework, which requires a running Java environment. At the same time, some infrastructure applications are required, such as DNS servers.
Before containers existed, infrastructure services ran in minimal change root environments, containing only the necessary binaries (e.g., chroot/named
), configuration files, and libraries. This setup reduced the number of potential attack vectors for exposed services. For example, an attempt by the attacker to call /bin/sh
would fail because the environment would not have a shell.
Classical Docker build files, which use FROM ubuntu
to include a complete Ubuntu environment, are the exact opposite of the approach just described. The resulting container is easier to debug because, for example, a shell is available. However, it is also far larger and less secure because an attacker could find and use the shell binary.
Manufacturers keep their official containers up to date, which means that when the container is rebuilt, an updated Ubuntu would also be dragged in. However, no mechanism automatically triggers such a rebuild. One of my goals was therefore to rebuild automatically all containers that contain components for which patches are available. At the same time, I wanted the containers to be leaner.
Dockerfiles
Docker supports the ability to import the compressed tarball of a change root environment, but the build process is hard to maintain. It makes more sense to use a Dockerfile that contains the components of the image and also lets you import single files from other images. Calling scripts or entire installations might be possible, as well. To create such a container, you would use docker build
. To begin, though, copy an archive (usually a
Buy this article as PDF
(incl. VAT)