It’s been some time since my last blog post about possible Docker base images and we’ve decided to use the empty base image for Icinga DB. As it’s written in Go, the binary already contains all dependencies and building it with CGO_ENABLED=0 removes even the need of libc.

Also users have no reason to enter the container via docker exec. In opposite to Icinga 2 or Icinga Web 2, Icinga DB is not extensible by plugins or modules – no need for apt install. There isn’t even the need to edit any config file as the entrypoint generates it from the environment variables – no need for Vim.

By including just two executables and the SQL database schema, the image became pretty small. But then I’ve stumbled over the following two ways of making the Image even smaller:

go build -ldflags -s -w

-ldflags tells go build to pass the given flags to go tool link. That command is told to drop several symbol tables via the flags -s and -w.

This reduces the image’s size by 28% (from 25.1MB to 18.1MB).

upx

upx compresses executables in-place. The resulting executable allocates some memory, extracts the actual executable there and jumps there.

This reduces the image’s size by 51% (from 25.1MB to 12.3MB).

Both of them

… reduce the image’s size by 74% from 25.1MB to 6.45MB!

Conclusion

Try out the Icinga DB Docker image via docker pull icinga/icingadb:master!

Even with ADSL it will take you only about two minutes instead of nine due to the compression.