Our Blog

Ongoing observations by End Point Dev people

Docker and containers boot camp

Phineas Jensen

By Phineas Jensen
May 16, 2022

Shipping containers stacked at a port Photo by Samuel Wölfl

In the modern landscape of web development, it’s almost impossible to avoid seeing or using containers: isolated, virtualized, user space for programs to run in. Containers make it easy to develop and deploy various components of applications without respect to the specific system and dependencies they run on.

If that’s confusing, worry not; this post and the tutorials in this boot camp aim to clarify things for new developers and experienced developers who haven’t gotten around to using containers yet.

Linux containers are all based on the virtualization, isolation, and resource management mechanisms provided by the Linux kernel, notably Linux namespaces and cgroups.

—Wikipedia, OS-level virtualization

Introduction

The terminology surrounding containers can get pretty confusing, but the basic idea is this: A container is just a sandboxed process which is limited by the operating system in its ability to see and interact with other processes and parts of the system. This can:

  • provide security benefits (e.g. a container may only be given access to certain parts of the filesystem),
  • help with performance (e.g. by limiting the amount of RAM or CPU given to a container), and
  • help solve version and dependency problems (e.g. containers can be used to run multiple incompatible versions of one program on the same system).

Contrast this with virtual machines, which virtualize hardware to run an entire operating system including its kernel. Unlike virtual machines, containers are isolated processes running on a single operating system. Because of this, containers are lighter weight and faster than VMs.

From a developer’s perspective, containers are usually run from images, which are special packages of files needed to run a program. For example, a container image might contain the libraries, binaries, and source necessary to run a Node.js web application server, while another image might contain everything needed to run the PostgreSQL 14 database.

Docker

Docker is the most popular container management suite, and you’ll most likely end up using it at some point in your career if you haven’t already. As such, it’s the best place to start learning about containers. Start with the official getting started guide published by Docker Inc. which gives a great overview of containers, images, and container composition (i.e. using multiple containers together).

For our End Point staff, we point out a few things about this tutorial:

  • It makes repeated reference to the non-free Docker Desktop tool, which can be useful but shouldn’t take priority in learning. For everything done in Docker Desktop, there are equivalent instructions for the CLI (command-line interface). Make sure to learn those!
  • It tells you to create a Docker Hub user for one part where you publish a “getting started” image that you create as part of the tutorial. Everything else is possible without creating an account or publishing an image, so feel free to just read this section without creating an account.

After completing the tutorial, you should be familiar with the basics of creating and orchestrating Docker containers. Of course, there is a lot more to learn and other projects may require much more complicated setup. As you continue to use Docker, keep these reference pages handy:

Container standards and tools

While Docker popularized containers, a number of other tools have since been created for building, managing, and deploying containers. These are some of the most enduring:

  • Kubernetes (also called K8s), a system for managing large-scale deployments of containers
  • containerd, a container runtime (but not an image-building tool) which was created for Docker
  • Podman, a container engine that doesn’t require a running daemon like Docker does; it provides Docker compatibility as well as support for other systems

These systems are based on open standards such as the Open Container Initiative’s image and runtime specifications and the Container Runtime Interface (an API standard for working with containers designed for Kubernetes). If you’re interested in understanding more, see this post on the differences between these tools and systems.

End Point’s container expertise

Containers are one of our areas of expertise, and we’ve written a number of articles about containers. Here are a few highlights:

Try it!

If you are new to containers and read this far without actually working through the hands-on tutorial mentioned above, do it now!

Using Docker on your own computer is the best way to learn, so do the exercises described in the Docker getting started guide and gain your own experience with these tools.

docker containers


Comments