Skip to content

Setting up tools

First, we'll need to set up an environment for running and building containers.

For that purpose, we can use Docker. In this section, we'll install the latest version of the Docker Community Edition.

Docker installation

The most up-to-date guides can be found from Docker's documentation site, but in these exercises, we assume you've set up your environment in a particular way. More details per operating system below.

Note

There are a few key distinctive differences in how Docker works for the different Operating Systems.

Docker is primarily a tool for running Linux containers, which means that it cannot natively run on Mac and Windows systems. To get around this limitation, Docker for Mac and Windows launch a dedicated virtual machine to run Docker and the containers in. This means that, when it comes interfacing with the host system, the user experience on Mac and Windows slightly differ from running Docker natively on Linux.

Mac

If you use a Mac, install Docker Desktop for Mac.

Windows 10

First, install and set up WSL version 2 (aka WSL2), if you haven't done so already. WSL allows you to run a Linux operating system within your Windows environment. It is also used for running all of the containers launched by Docker.

Once you have installed and set up WSL, you can install Docker:

Linux

If you use Linux, follow the guide appropriate for your distribution:

Command-line environment

The exercises are built around running Linux containers using Docker. Therefore, in order to complete the exercises, you must use a similar command line environment to run various Docker and Docker related commands. More details per operating system below.

Mac

Mac OS is a Unix-like operating system at core and therefore it has many compatible command-line utilities pre-installed. While Mac OS is not a Linux distribution, its tools are compatible enough with a Linux environment for the purpose of the exercises.

You can access the command line using the Terminal application in Mac. Alternatively, you can choose to use one of the many other terminal applications such as iTerm2.

In the latest versions of Mac OS, the Terminal opens ZSH shell as the command-line interface, which is enough for completing the exercises. However, you can also install and use Bash shell using Brew (or another similar package manager), if you prefer using it.

Windows 10

On Windows 10, it's possible to install and use a Linux operating system using WSL. WSL is also required to run Docker and containers on Windows.

If you use a Windows environment for running Docker, the exercises assume that you use the WSL for running the command-line utilities. We recommend using the Windows Terminal for accessing the command-line interface of your WSL environment.

Most Linux distributions available for WSL use Bash shell as the default command-line interface in terminal, which is enough for completing the exercises. However, you can also install and use ZSH shell using the package manager available in your WSL environment, if you prefer using it.

Note that while it is possible to access Docker through a Windows command-line tool such as PowerShell, the exercises assume that you are using the command-line from the WSL environment instead. The exercises are not compatible with PowerShell or Windows CMD.

Linux

All desktop Linux distributions have some terminal application pre-installed (e.g. GNOME Terminal, KDE Konsole, Terminator, Tilix, xterm). You can use which ever terminal application on Linux you can get your hands on.

Most Linux distributions use Bash shell as the default command-line interface in terminal, which is enough for completing the exercises. However, you can also install and use ZSH shell using your Linux distribution's package manager, if you prefer using it.

Docker Compose installation

Later, we'll also use Docker Compose in the exercises. It's pre-installed as part of the Docker Desktop (Mac, Windows). On Linux, follow the official installation instructions to install Docker Compose.

Post-installation

You should now have docker command available in your terminal. This tool will be used extensively throughout the exercises.

Make sure you can run docker.

$ docker ps

Note

On Linux: If the command fails because of permission issues, add yourself to the Docker group.

$ sudo usermod -aG docker $(whoami)

Now re-open your terminal, and try docker ps again.

If it still doesn't work, logout and log back into desktop.

If it still doesn't work, consult with the instructor to fix the problem.

Alternatives

Docker is essentially based on features that the Linux kernel provides. Therefore, there exists alternatives for running containers.

For example, Podman can be used as a drop-in replacement for Docker.

Note that the exercises in this site are only tested with Docker but some of them might work with the alternatives. If you're unable to complete some of the exercises using the alternative tool, we recommend you to give Docker a try.

Next

After you've successfully installed Docker and the related tools, head over to the next section where we'll run our first container application.