paint-brush
You Should Use Alpine Linux Instead of Ubuntuby@moeidsaleem
22,247 reads
22,247 reads

You Should Use Alpine Linux Instead of Ubuntu

by Muhammad Moeid SaleemAugust 29th, 2020
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

Alpine Linux is designed for security, simplicity and resource effectivity. It is designed to run directly from RAM. The latest Alpine Linux version is just around 4MB which is insanely amazing. This tiny size as compared to it most famous competitor makes Alpine Linux stand out. It performs all the major operation of any other distribution here. You should try it out to see it live in action. Save your server costing by 87% by using Alpine Linux. You Should Use Alpine Linux Instead of Ubuntu.

Company Mentioned

Mention Thumbnail
featured image - You Should Use Alpine Linux Instead of Ubuntu
Muhammad Moeid Saleem HackerNoon profile picture

Alpine linux is a linux distribution primarily made for the deploying application on linux distribution and is a rising competitor for the Ubuntu. Alpine Linux is designed for security, simplicity and resource effectivity. It is designed to run directly from RAM.

Currently, the latest version of Alpine Linux is just around 4MB which is insanely amazing. This is the main reason people are using alpine linux for releasing their application. This tiny size as compared to it most famous competitor makes Alpine Linux stand out.

Size Comparison

The following comparison explains what make Alpine Linux distribution our topic of discussing because of its amazing tiny size but the question we all have would be how Alpine Linux achieve the following size?

Alpine Linux - Behind the scenes

The complete secrets and why the alpine linux has such a tiny image size as compared to the above yet it performs all the major operation of any other distribution here.

Alpine Linux is composed of following core components

  1. musl
  2. libc
  3. busybox
  4. apk-tools
  5. toolchain

Musl

MUSL is about 6kb in size as compared to the GNU ( glibc ) , while both are wrapper for implementation of libc having same goals which are actually a bunch of functions written in C wrapped around binary calls that make it easy to write programs. Following are some reasons and advantages over others for Musl small size:

  • Fewer localization data.
  • Less GNU bloats
  • No NSS
  • No network service library

Busybox

Busybox is just around 800kb which is mainly set of shell scripts and libraries for the bash all packed in busybox. for e.g. bzip2, nslookup, wget,etc .

apk-tools

alpine package management can install, upgrade and delete packages. Along with that, it can also load package history from the previous state ( while rebooting system).

apk is the tool used for package management instead of apt.

toolchain

link with relro, bind now & Position independant executables(PIE) - Even for static binaries, Stack smashed protector and fortify source are thing that make it more secure and safe from breaking through.


ALPINE Linux with Docker - Match Made in HEAVEN!

If you are using Docker than you need to have something for the OS layer then the best option is to use Alpine Linux that will reduce your image size to a bare minimum.

The truth is we don't need that many tools to deploy our application to create a Docker image. Even if you want to add more tools you can easily install it in Alpine Linux that will significantly provide you with so many benefits. A Docker container with Alpine Linux is more than perfect.

Using any other distribution will only come with unnecassary tools that are not required and if you are maintaining a private docker registery than this is the best approach.

Though, There are still cases where you would still want to go with Ubuntu most probably that will have to do with the compatability of your application but overall, Alpine Linux is pretty damn insane and you should try it out to see it live in action. Save your server costing by 87%.

Download Alpine Linux from main website here.

Alpine Conclusion

Let us conclude our blog here, we have explored how and why alpine Linux is going to be the default choice for developers when building a Docker Image and had a sneak peek under the hood of Alpine Linux because of which it is able to have such a small size.

Though I haven't written much about Ubuntu which will be the defacto choice for most developers we all know when coming to enterprise development, the size matters! In this case, smaller is better :)

  1. Tiny in size is the biggest advantage and a game changer compared to others.
  2. Less attack surface means more secure.
  3. Highly cost-effective ( save more than 87% percent server cost)
  4. Run directly in RAM.