Docker Base Image OS Size Comparison

Docker Base Image OS Size Comparison

The race to zero is a theme that is catching on with Docker Images. Developers are racing to create the thinest most usable image possible. But why, do you ask?

If you've used Docker for any period of time then you will quickly realize that you spend a lot of time downloading or distributing images. This is not necessarily a bad thing for some but for others that scale their infrastructure are required to store a copy of every image that's running on each Docker host. If you are running the Ubuntu base image then you will need to store the 188MB image on each host. However, if you have a scenario that scales your application to a new host then you will not want to wait for the download of 188MB to complete before your container starts. Feel me?

Developers are working in much the same way as a race car mechanic would. The goal is to strip all the unnecessary weight off the race car leaving just the bare essentials. Same goes for our Docker images. Do we need every Linux commands, library, etc inside of our container to run a Hello World script? Probably not. Why not install just the bare essentials required to run the application thats inside of your container.

Benefits of Smaller Docker Images

What are the benefits of smaller images you ask? Besides the obvious which is pure size it also makes your environment small and efficient. Small images all increase security as you reduce your security footprint size.

Docker Image Size Comparison

The team over at CenturyLink Labs continue to crank out some very impressive tools. Below is a screenshot from ImageLayers which is a tool to visualize Docker images. But the tool doesn't stop there. You can actually compare the images per layer and visualize every what each layer is doing.
Docker Image Size Comparison

So what does our comparison show us? Reading from left to right the number of layers in each image decreases as you read to the right. We also notice that Ubuntu for example has 4 Layers and is 188MB while Alpine Linux has 1 Layer and is 5MB. However, Busybox is the smallest image but has 2x0 byte layers which are not bad.

Docker Image Size Run Down

We compiled a list of some of the most popular Base OS Images based on Docker Hub downloads and File Size. The list is not who is best or worst but a an overview of the usage by the community and image size. The best image will depend on your environment and application requirements.

  • Ubuntu 6.5 Million Downloads and 188 MB in size - The most downloaded OS image of the bunch. But it is also the fattest cat on the block as well.

  • Debian 3.3 Million Downloads and 125 MB in size - Debian uses the Linux kernel and the basic tools are based on the GNU Project.

  • BusyBox 2.5 Million Downloads and 2 MB in size - BusyBox website states "Busybox has been written with size-optimization and limited resources in mind. It is also extremely modular so you can easily include or exclude commands (or features) at compile time. This makes it easy to customize your embedded systems. To create a working system, just add some device nodes in /dev, a few configuration files in /etc, and a Linux kernel."

  • CentOS 1.2 Million Downloads and 172 MB in size - Derived from Red Hat Linux Enterprise RHEL and each version is supported for 10 years.

  • Fedora 1.2 Million Downloads and 187 MB in size - Sponsored by Red Hat Linux Enterprise and strives to drive new innovation.

  • Alpine 40K+ Downloads and 5 MB in size - A more complete Busybox image with access to a package repository. My personal favorite at the moment.

  • Cirros 23K+ Downloads and 8 MB in size - Is a tiny OS that specializes running in the cloud. It is also the image that has the most amount of layers at 5.

Here's the link to the comparison so you can dive deeper per image - Docker OS Image Comparison


Busybox wins the size war weighing in at only 2MB. However, Ubuntu has the biggest installation base by far and is also the fattest image. What can we learn from these stats? At first glance it appears a lot of Docker users have a lot of room for optimization and making their infrastructures more efficient.

Ubuntu is a good Image and has many use cases. However, if you want to cut out all the fluff and only run the necessary components for your application I would recommend either Busybox or Alpine.

I will dive deeper in the next article uncovering best practices for Docker Images and why we should limit the amount of OS images we install on our hosts.

Follow me

If you liked this article be sure to Follow Me on Twitter to stay updated!