How to Make Docker Images Smaller: Base OS Images

By richardtylee

Building a base image starts with choosing a Linux distribution image. There are quite a few options:

  • gliderlabs/alpine is by far the smallest and minimalist. Google search: 499,000 results.
  • debian is used by the Docker Ruby and Rails community, which it will require the least maintenance. Google search: 32,900,000 results.
  • ubuntu is used by the Docker populous at large, which means a large community. Google search: 65,400,000 results.

REPOSITORY          TAG           VIRTUAL SIZE
gliderlabs/alpine   latest        5.03 MB
debian              latest        84.98 MB
ubuntu              latest        188.3 MB
centos              latest        210 MB

Our team looked at a number of factors before choosing debian as our base. As ruby is our primary development language, we wanted to base our images on a distro that had strong community support. Debian also provides tooling that our dev ops team is familiar with.

There have been a few shops that are using alpine in production: https://blog.codeship.com/build-minimal-docker-container-ruby-apps/

While alpine isn't something we'll be using, it may be worth revisiting in the future as adoption picks up.

UPDATE: (03/24/2016) Docker just announced that they build their new engine on Alpine Linux.  There looks to be some momentum building for Alpine.