Running Containers

Basics of running containers.

Windows containers vs. Linux containers

It’s vital to understand that a running container shares the host machine’s kernel it is running on. This means that a containerized Windows app will not run on a Linux-based Docker host and vice-versa. Windows containers require a Windows host, and Linux containers require a Linux host; only, it’s not always that simple.

It is possible to run Linux containers on Windows machines. For example, Docker Desktop running on Windows has two modes: “Windows containers” and “Linux containers.” Depending on your version of Docker Desktop, Linux containers run either inside a lightweight Hyper-V VM or using the Windows Subsystem for Linux (WSL). The WSL option is newer and the strategic option for the future, as it doesn’t require a Hyper-V VM and offers better performance and compatibility.

What about Mac containers?

There is currently no such thing as “Mac containers.”

However, you can run Linux containers on your Mac using Docker Desktop. This works by seamlessly running your containers inside of a lightweight Linux VM on your Mac. It’s extremely popular with developers who can easily develop and test Linux containers on their Mac.

What about Kubernetes?

Kubernetes is an open-source project out of Google that has quickly emerged as the de facto orchestrator of containerized apps. That’s just a fancy way of saying: Kubernetes is the most popular tool for deploying and managing containerized apps.

Note: A containerized app is an application running as a container.

Kubernetes

At the time of writing, Kubernetes uses Docker as its default container runtime, which is the low-level technology that pulls images and starts and stops containers. However, Kubernetes has a pluggable container runtime interface (CRI) that makes it easy to swap-out Docker for a different container runtime.

In the future, Docker might be replaced by containerd as the default container runtime in Kubernetes, but more on containerd later in the course. For now, it’s enough to know that containerd is the small specialized part of Docker that does the low-level tasks of starting and stopping containers.

The important thing to know about Kubernetes, at this stage, is that it’s a higher-level platform than Docker, and it currently uses Docker for its low-level container-related operations.