Container of the Week – busybox

This week we are going to look at a fairly popular container that is often used as a base for larger images – busybox.  We’re also going to look at some of the upsides and downsides of busybox, a somewhat tempestuous project in the free software world.

The different versions of the busybox container are made up of two components: the C library and busybox itself.

C library

The busybox base container is, as base containers are, very small. It also comes in three flavours, depending on your preference for C library.

  • uclibc, the default is 1.11MB
  • musl, another embedded C library is 1.32MB
  • glibc, the most common deployed C library is 4.34MB

Which library should you choose? Both uclibc and musl libc are embedded C libraries, that is they’re written with size in mind to run on small devices where storage and memory space is a premium. Both of these libraries aim to be correct, in the sense that they conform to the POSIX standard and behave how people expect.

Glibc is by far the most popular C library and has been part of Linux for decades. This means whatever bugs and misfeatures glibc has are now effectively a standard in themselves (this is called bug compatibility) and the majority of Linux software expects to be running under glibc.

However it’s pretty unlikely that you will run into a uclibc/musl/glibc incompatibility so in reality there is effectively no discernible difference between the three libraries. Personally I would just pull the busybox:latest image which happens to be built using uclibc.


The other part of the busybox container is busybox itself. Like uclibc and musl, busybox is software designed to run on embedded systems. Busybox has the unfortunate property of seeing a lot of legal action around the GPL, and has the dubious distinction of being the first court case in the United States to force compliance with the GPL.

In some sense Busybox has been a victim of its own success, as embedded systems vendors pick it up to use in their product and don’t provide source code. However Busybox is just fine to use in development, production and distribution as long as you comply with the GPL.

Busybox itself is a re-implementation of many common low-level command line tools that you might use every day in a Linux distribution. Command such as ls, cp, mv and many others have been rewritten with size optimisation in mind. Most of the tools that busybox implements are part of the coreutils package in Debian and Ubuntu which weights in at 14MB; busybox is only 2.1MB.

The size savings achieved using Busybox come at a price though. The authors have done their best to choose a set of commands and behaviours that will satisfy their users, but some incompatibilities and features are missing. For example the Busybox versions of tar and sed are missing some of the less popular, but still useful options of GNU tar and GNU sed.

The usefulness and very small size of the busybox container cannot be ignored. If your use case is simple and you are not concerned about possible C library and command incompatibility then the busybox container should definitely be one of the tools in your container toolbox.