Chapter 5. Configuration management—getting your house in order

 

This chapter covers

  • Managing the building of images using Dockerfiles
  • Building images using traditional configuration management tools
  • Managing the secret information required to build images
  • Reducing the size of your images for faster, lighter, and safer delivery

Configuration management is the art of managing your environments so that they’re stable and predictable. Tools such as Chef and Puppet have attempted to alleviate the sysadmin burden of managing multiple machines. To an extent, Docker also reduces this burden by making the software environment isolated and portable. Even so, configuration management techniques are required to produce Docker images, and it’s an important area to be aware of.

As you get more experience with Docker, these techniques will give you more tools for building images for whatever configuration needs you’re trying to satisfy.

5.1. Configuration management and Dockerfiles

Dockerfiles are considered to be the standard way of building Docker images. Dockerfiles are often confusing in terms of what they mean for configuration management. You may have many questions (particularly if you have experience in other configuration management tools), such as

  • What happens if the base image changes?
  • What happens if the packages I’m installing change and I rebuild?
  • Does this replace Chef/Puppet/Ansible?

Technique 40 Create reliable bespoke tools with ENTRYPOINT

Technique 41 Avoid package drift by specifying versions in your build

Technique 42 Replacing text with perl -p -i -e

Technique 43 Flattening images

Technique 44 Managing foreign packages with alien

Technique 45 Reverse-engineer a Dockerfile from an image

5.2. Traditional configuration management tools with Docker

Technique 46 Traditional: using make with Docker

Technique 47 Building images with Chef Solo

Technique 48 Source-to-image builds

5.3. Small is beautiful

Technique 49 Dockerfile tricks for keeping your build small

Technique 50 Tricks for making an image smaller

Technique 51 Tiny Docker images with BusyBox and Alpine

Technique 52 The Go model of minimal containers

Technique 53 Using inotifywait to slim containers

Technique 54 Big can be beautiful

5.4. Summary