Hopp til innhold

Docker - Install Docker Engine

Skip to content

This is a machine-translated text that may contain errors!

Install Docker Engine

Here you will install Docker Engine and the Compose plugin on a Linux server. You are done when hello-world responds and Compose displays a version number. Work in the VM’s terminal, one command at a time.

If you already have a working installation, proceed to [[Containerbruk Level 1 - Kjor og undersog en container|Run and inspect a container]].

What is Docker? explains images, containers, and registries. Containers and virtual machines shows the relationship with the Linux VM.

Prerequisites

You need a Debian or Ubuntu server in Proxmox and administrative privileges. Open the Console on your own VM and log in. Docker is installed and used inside the VM, not in the Proxmox host’s Shell. The entire installation can be done in the console. Logging in from your local machine using 🔐 SSH is a separate topic that you can tackle later.

You must know how to display the current directory with pwd, view its contents with ls, and change directories with cd. The CLI exercise provides support for working in the terminal. Users and permissions in Linux explains users and groups; the actual root/sudo setup is described in the installation guide below.

New to Proxmox or networking fundamentals?

[[Server Installation Level 2 - VM in Proxmox|🖥️ Server Installation - VM in Proxmox]] shows how to create a VM and install Ubuntu or Debian, step by step. If you do not have access to Proxmox, [[Server Installation Level 1 - Bare Metal|🖥️ Server Installation - Bare Metal]] demonstrates the same directly on physical hardware. [[Virtualization Level 1 - VM Tutorial|🖫️ Virtualization]] is the assessment task where you later document that you master this independently. [[Protocols Level 1 - Network Protocols|🌐 Network Protocols]] covers IP addresses and ports.

Install Docker Engine

Follow the official installation guide for Docker Engine on Debian or Docker Engine on Ubuntu.

Read the prerequisites and use Install using the apt repository for your operating system. First set up the Docker package source, then install Docker Engine and the Compose plugin as shown there.

Long commands without copy and paste

Copy and paste often does not work in the Proxmox console, and several lines in the installation guide are long. Type one line at a time, and compare character by character before pressing Enter. If apt update fails afterwards, it is often a typo in the package source or a network problem; see “If something goes wrong”.

Debian without sudo?

Follow the [[Server installation Level 1 - Bare metal|recipe for root and sudo]] before you begin. You can install sudo for the regular user, or run administrative commands as root in the VM console. As root, omit sudo before the commands.

Installation on Debian

The commands below are taken from Docker’s guide dated October 14, 2026. If they don’t work, Docker may have changed them; compare with the official page. If you use Ubuntu, follow the Ubuntu guide instead, because the addresses are different.

Some words in the output from apt are in Swedish or Danish, for example “Sammanfattning” and “Fortsätta?”. This comes from Debian’s Norwegian translation and has no impact on the installation.

1. Fetch Docker’s key. The key allows apt to verify that the packages actually come from Docker.

sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

Terminal on the Debian server: sudo apt update and sudo apt install ca-certificates curl, then create /etc/apt/keyrings and download Docker's GPG key to docker.asc without any output

2. Add the Docker package repository. Type the first line and press Enter. The terminal displays a > before each new line until you type EOF. Then tee prints the contents of the file. There, Suites should show your Debian version name, for example trixie.

sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update

Terminal on the Debian server: sudo tee writes the Docker package source line by line to /etc/apt/sources.list.d/docker.sources and shows Suites: trixie and Architectures: amd64, then sudo apt update fetches the package list from download.docker.com

After running sudo apt update, you should see lines from download.docker.com. If they are missing, there is a typo in the file. See “If something goes wrong”.

3. Install Docker. Answer Y when apt asks if you want to continue.

sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Terminal on a Debian server: sudo apt install installs docker-ce, docker-ce-cli, containerd.io, docker-buildx-plugin, and docker-compose-plugin after the student answers Y, and sudo docker run hello-world prints Hello from Docker!

The animation also shows sudo docker run hello-world running below in the terminal.

Verify the installation:

docker --version
docker compose version
sudo systemctl status docker
sudo docker run hello-world

hello-world downloads a small image, starts a test container, and writes a message. Press q if systemctl status docker displays its result in a pager and you want to return to the terminal.

Use sudo before the Docker commands below if the regular user lacks access. If you choose to grant the regular user access through the docker group, run the following from the regular user’s session. The group grants privileges at the root level; do this only for a user who is supposed to administer the exercise server:

sudo usermod -aG docker $USER

If you are running this from a root session without sudo, use usermod -aG docker yourusername and replace yourusername with your regular user. $USER in a root session refers to root, not your regular user.

Log out and log back in (or run newgrp docker) for the change to take effect. Until then, you can use sudo before the commands in the next exercises.

Checkpoint: Docker is installed

hello-world should have displayed Hello from Docker!, and docker compose version should show a version. If either result is missing, fix the installation before starting the web server. Please feel free to share the command and its output when asking for help.

If the installation fails

Symptom Check
docker or docker compose is missing That both Engine and the Compose plugin are installed according to your operating system’s guide.
permission denied on the Docker command Try with sudo. Group changes require a new login session.
The Docker service is not running Read sudo systemctl status docker and the error message before trying again.
apt update shows Malformed or Unsupported file Compare the package source file character by character with Docker’s guide.
NO_PUBKEY or is not signed Verify that the key was downloaded to the correct path and can be read by apt.
Could not resolve, Failed to fetch, timeout, or dial tcp The VM cannot reach the package repository or registry. Use [[Troubleshooting Method Level 1 - Systematic Troubleshooting|Troubleshooting method]] to test the network layer by layer.

Next steps

Once hello-world has displayed Hello from Docker! and Compose shows a version number, proceed to [[Container usage Level 1 - Run and inspect a container|Run and inspect a container]]. There you will fetch Nginx and verify which container is responding.



The container exercise currently stands at [[Container usage Level 1 - Run and inspect a container|Run and inspect a container]].



The storage exercises currently stand at [[Container usage Level 2 - Preserve data outside the container|Preserve data outside the container]].