-
Book Overview & Buying
-
Table Of Contents
Containers for Developers Handbook
By :
In this first chapter, we covered a lot of content, learning what containers are and how they fit into the modern microservices architecture.
In this lab, we will install a fully functional development environment for container-based applications. We will use Docker Desktop because it includes a container runtime, its client, and a minimal but fully functional Kubernetes orchestration solution.
We could use Docker Engine in Linux directly (the container runtime only, following the instructions at https://docs.docker.com/) for most labs but we will need to install a new tool for the Kubernetes labs, which requires a minimal Kubernetes cluster installation. Thus, even for just using the command line, we will use the Docker Desktop environment.
Important note
We will use a Kubernetes desktop environment to minimize CPU and memory requirements. There are even lighter Kubernetes cluster alternatives such as KinD or K3S, but these may require some customization. Of course, you can also use any cloud provider’s Kubernetes environment if you feel more comfortable doing so.
This lab will guide you through the installation of Docker Desktop on your laptop or workstation and how to execute a test to verify that it works correctly.
Docker Desktop can be installed on Microsoft Windows 10, most of the common Linux flavors, and macOS (the arm64 and amd64 architectures are both supported). This lab will show you how to install this software on Windows 10, but I will use Windows and Linux interchangeably in other labs as they mostly work the same – we will review any differences between the platforms when required.
We will follow the simple steps documented at https://docs.docker.com/get-docker/. Docker Desktop can be deployed on Windows using Hyper-V or the newer Windows Subsystem for Linux 2 (WSL 2). This second option uses less compute and memory resources and is nicely integrated into Microsoft Windows, making it the preferred installation method, but note that WSL2 is required on your host before installing Docker Desktop. Please follow the instructions from Microsoft at https://learn.microsoft.com/en-us/windows/wsl/install before installing Docker Desktop. You can install any Linux distribution because the integration will be automatically included.
We will use the Ubuntu WSL distribution. It is available from the Microsoft Store and is simple to install:
Figure 1.9 – Ubuntu in the Microsoft Store
During the installation, you will be prompted for username and password details for this Windows subsystem installation:

Figure 1.10 – After installing Ubuntu, you will have a fully functional Linux Terminal
You can close this Ubuntu Terminal as the Docker Desktop integration will require you to open a new one once it has been configured.
Important note
You may need to execute some additional steps at https://docs.microsoft.com/windows/wsl/wsl2-kernel to update WSL2 if your operating system hasn’t been updated.
Now, let’s continue with the Docker Desktop installation:
Figure 1.11 – Docker Desktop download section
Docker Desktop Installer.exe binary. You will be asked to choose between Hyper-V or WSL2 backend virtualization; we will choose WSL2:
Figure 1.12 – Choosing the WSL2 integration for better performance
Figure 1.13 – The installation process will take a while as the application files are decompressed and installed on your system
Figure 1.14 – Docker Desktop has been successfully installed and we must log out
Once we’ve accepted the Docker Subscription license terms, Docker Desktop will start. This may take a minute:
Figure 1.15 – Docker Desktop is starting
You can skip the quick guide that will appear when Docker Desktop is running because we will learn more about this in the following chapters as we deep dive into building container images and container execution.
Figure 1.16 – Docker Desktop main screen
Figure 1.17 – Enabling our previously installed Ubuntu using WSL2
docker, and, after that, docker info:
Figure 1.18 – Executing some Docker commands just to verify container runtime integration
As you can see, we have a fully functional Docker client command line associated with the Docker Desktop WSL2 server.
We can execute docker run-ti alpine to download the Alpine image and execute a container using it:
Figure 1.19 – Creating a container and executing some commands inside before exiting
Figure 1.20 – Docker Desktop – the Images view
exit inside its shell:
Figure 1.21 – Docker Desktop – the Containers view
Now, Docker Desktop works and we are ready to work through the following labs using our WSL2 Ubuntu Linux distribution.