in Networking

Why You Should Use Alpine Linux for Docker Images

Docker is all the rage right now, used by many container service providers including Amazon ECS.

The only problem, however, when rolling many Docker images is they can come in quite large.  Fortunately, this problem was solved way back in 2016 when Docker switched to Alpine Linux for its official images.

Prior to this Docker used Ubuntu for the official Docker images, which came with a hefty price in the form of size.  Size in itself also comes with its own hefty prices including time and bandwidth.

Although Alpine pre-dates Docker and containers, and it wasn’t designed primarily for Docker you wouldn’t know this because they are a match made in heaven.

Alpine Linux vs. Ubuntu

Alpine Linux images come in at a light-weight 4-5 MB by default, which allows for very small contains of around 8 MB in size.

Compared to a minimal Ubuntu Docker image which comes in as low as 29 MB, which is pretty good for Ubuntu, Alpine blows this away.

While 5x smaller may not sound like a big deal, remember that bandwidth also comes with an expense in most cases.  An image that is smaller also means much less data is transferred.

Alpine Linux Security

Because Alpine Linux was designed for power users, by power users it’s built on the premise of security hardening.

This doesn’t of course mean it is immune to exploits, nothing is.  However, they do aim to take a proactive approach to security when they designed Alpine Linux.

Alpine Linux ships with a hardened kernel by default and all userspace binaries come pre-compiled with stack-smashing protection.

Conclusion

Many third-party official Docker images now offer Alpine variants.  A great example of this is the official Node.JS images which offer Alpine Linux versions on top of the Debian versions.

Alpine Linux also makes a great container for running Chrome (Headless) for automation.  Just install Google Chrome (Headless) on top of Alpine Linux and you have a great light-weight image for running puppeteer tasks.

 

Write a Comment

Comment