Ga naar hoofdinhoud

Install Docker

Docker is a containerization platform that allows applications to run consistently across different environments by packaging them with their dependencies. Containers provide lightweight, isolated environments, making deployment easier and more reliable. Since Docker is widely supported across operating systems and cloud environments, the installation process varies depending on your platform. Below, instructions are given for the most common platforms.

info

The documentation, docker-compose.yaml and .env files are based on a minimum Docker version of 20.04.x, and docker-compose version 2.x.x. Older versions might work as well, but may result in unexpected behavior.

Install Docker on Linux

Follow the official Docker documentation to install the Docker Engine for your Linux distribution. This should also include docker compose.

pas op

By default the docker daemon always runs as the root user. If you don't want to prefix the docker compose commands in this guide with sudo, you can create a Unix group called docker and assign users to it. See Linux post-installation steps for Docker Engine for additional information.

Install Docker on Windows

For Windows, there are several ways to install Docker, namely

waarschuwing

It is currently not possible to install Docker via the Docker Community Edition (CE). This is because Linux containers are not supported.

info

The installation methods have been tested on Windows Server 2022 Datacenter: Azure Edition Hotpatch - x64 Gen2 on Azure.

To install Docker Desktop using WSL 2 or Hyper-V, follow the below steps:

  1. Download Docker Desktop from the official site.

  2. Run the installer. Check Use WSL 2 instead of Hyper-V if you want to use WSL 2 (recommended), uncheck if you want to use Hyper-V.

  3. After the installer is finished, the machine should automatically be restarted.

  4. After restart, Docker Desktop will start. After reading the Docker Subscription Service Agreement, click on 'Accept' if you want to accept. After that, select "Use recommended settings (requires administrator password)".

  5. A new Docker window opens, and asks to log in and provides a welcome survey. This can be skipped by repeatedly click on the "skip" button in the top right of the modal.

  6. Follow the steps to verify the installation.

Docker on WSL 2

To install Docker on top of WSL 2 (Windows Subsystem for Linux), follow the below steps:

  1. Open PowerShell as Administrator and run the following command to install WSL:

    wsl --install
  2. Restart the machine.

  3. In the Windows Search Bar, search for "WSL" and open it. It should display a message that it is installing Ubuntu. Wait for the installation to finish.

  4. Again in the Windows Search Bar, search for "Ubuntu" and open it.

  5. Create a default Unix user account by completing the form.

  6. Follow the steps in Install Docker on Linux to install Docker on WSL. Use the guide for Ubuntu.

  7. Follow the steps to verify the installation.

(Optional) Configure forward proxy

When working in a corporate or restricted network environment, Docker may need to route its traffic through a forward proxy to access external resources, such as container images from Docker Hub or private registries. Docker supports proxy configuration for both Docker Desktop and Docker CE (without Docker Desktop).

Docker Desktop

  1. Open Docker Desktop and go to Settings > Resources > Proxies.

  2. Enter the proxy address in the format:

http://username:password@proxy.example.com:port
  1. Apply changes and restart Docker Desktop.

Without Docker Desktop

To configure a forward proxy on the level of the Docker CLI, edit the Docker config file at ~/.docker/config.json and add the following structure:

{
"proxies": {
"default": {
"httpProxy": "http://proxy.example.com:3128",
"httpsProxy": "https://proxy.example.com:3129",
"noProxy": "*.test.example.com,.example.org,127.0.0.0/8"
}
}
}

Verify installation

To verify the Docker installation, run the following command (in a terminal on Linux, or in Powershell on Windows):

docker run hello-world

This should run a container and display the following lines:

Hello from Docker!
This message shows that your installation appears to be working correctly.