Alpine Linux containers

3 posts / 0 new
Last post
#1 Sun, 2014-12-14 12:17
raul
  • raul's picture
  • Offline
  • Last seen: 1 year 9 months ago
  • Joined: 2014-10-29

Hi,

I wanted to share some initial findings with the community. I am a part of the Flockport team. Flockport provides ready to deploy containers of popular web apps. I have been curious about Alpine and was having a look at it.

There are a number of interesting decisions the Alpine developers have made. It's lightweight, network oriented and security focused. All these makes it an excellent host for VMs and containers and due to its lightweight nature also an excellent VM and container OS.

LXC is an open source project and part of the kernel, that uses cgroups and namespaces to create lightweight OS environments, so you could be running a Debian host and multiple Ubuntu, Fedora, Centos or Alpine containers and vice versa.

Containers are isolated from the host system, give you near bare-metal performance and are portable, so you can have a minimal host and have your apps in containers that are portable across Linux hosts.

The LXC project provides container management tools and lightweight container OS templates. There are templates for Debian, Ubuntu, Centos, Fedora and there is even a nice minimalist Alpine Linux one.

Flockport uses LXC to provide prebuilt containers of apps like Wordpress, Discourse, Redmine, Drupal etc even a multi-domain mail server. These containers have the stack ie mysql, php, nginx and the apps installed and ready to launch.

We have been using Debian as the base our containers and also Ubuntu for the 32 bit ones. The base containers are around 200MB uncompressed and once you install the stack and apps they end up around 600MB for the Wordpress container and around 1.5GB for the Discourse container (with build environment, Ruby etc) We use XZ to compress the containers for distribution and they end up in the range of 120MB to 330MB compressed.

Yesterday I tried to create a number of Alpine Linux containers and here are the results. The Alpine Linux Nginx container is 14MB uncompressed and only 3.5MB compressed! In contrast the Nginx container based on Debian Wheezy is around 337MB uncompressed and 72MB compressed.

The Wordpress container based on Alpine Linux is around 155MB uncompressed and only 27MB compressed! The Wordpress Debian container is around 619MB uncompressed and around 130MB compressed.

Those are huge differences in size and bandwidth for us and users. A container needs a lightweight execution environment and Alpine makes perfect sense both as the host, and as a container. But of course its more than us just shipping it, users have to be familiar with Alpine Linux and know how to use it. I just wanted to put this out there.

Fri, 2014-12-26 14:18
raul
  • raul's picture
  • Offline
  • Last seen: 1 year 9 months ago
  • Joined: 2014-10-29

We released 2 preview micro containers based on Alpine Linux 3.1.0. An Nginx container weighing in at 4.5MB compressed and 18MB uncompressed and a Wordpress container at 23MB/145MB.

They are currently live on Flockport and we have a blog post to help users along. We will add more micro containers, depending on user feedback.

The current Alpine Linux container OS template distributed with LXC fails unless you specify the release with a -R v.3.1 flag when creating the container. This appears to be a known issue with the Alpine template unable to locate the latest release.

Also I ran into an 'set hostname error' if /etc/hostname or /etc/hosts in the container has a hostname specified. This is also known and filed as bug 3057 and marked resolved but it seems to show up if you use the setup-alpine or setup-hostname script inside the container. This prevents the cron service from running, and the workaround is to not to use the 2 scripts and setup networking manually.

The Nginx package in Alpine is also missing a number of useful modules, for instance when using Nginx as a reverse proxy to serve content from multiple containers you need the realip module so the real IP is passed on. Have yet to investigate compiling packages for Alpine.

Sun, 2015-04-26 10:57
jch
  • jch's picture
  • Offline
  • Last seen: 2 years 1 month ago
  • Joined: 2015-01-10

I, for one, am happy to see the Fockport guys to have a look at AL ^^
I did give a try to Flockport containers to start with new tools (usually I switch to own install when familiar with it).

Log in or register to post comments