Skip to main content

2 posts tagged with "Docker"

View All Tags

Alpine Linux Containers

· 4 min read

What is Alpine Linux?

Many official Docker container images come in an alpine variant. They are based on [Alpine Linux][alpine], an incredibly lightweight distribution that results in smaller image sizes. For example, the official Alpine-based Golang image is almost 3x smaller than its Debian-based counterpart:

docker pull golang:1.19-bullseye
docker pull golang:1.19-alpine
docker images --filter 'reference=golang' \
--format '{{ .Repository }}:{{ .Tag }}\t{{ .Size }}'
golang:1.19-bullseye    993MB
golang:1.19-alpine 354MB

Alpine Linux achieves these gains by omitting many packages that are useful for a desktop OS, but are less important for a container image. The distribution uses musl libc instead of glibc, and busybox instead of dash or bash. Unfortunately, the barebones environment does result in a steeper learning curve and may cause incompatibilities with some projects.

An Intro to Dev Containers in VS Code

· 5 min read

The Problem with Host Workflows

Running a development instance of your application often means installing its dependencies on your host computer. You'll need to consider operating system packages, compilers, and language-specific frameworks. For example, even a simple project like this blog site requires a particular version of Ruby, Jekyll, and other gems.

Problems arise when you have larger projects with complex installation requirements, or multiple projects with conflicting dependencies. Framework-level issues can be solved with tools like RVM, which allow the developer to switch between multiple concurrent installations of Ruby. OS-level issues are often trickier. For instance, on Debian Bullseye, apt-get install gcc provides GCC version 10. What if your project requires a newer or older compiler?

On the deployment side we have solved these problems using Docker containers. Each application can have its own set of container images with an isolated environment. We can apply the same techniques for local development.