Step 1
Add Docker's repository
Install prerequisites, store the signing key, and add the repository for the server architecture.
apt update
apt install -y ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" > /etc/apt/sources.list.d/docker.listStep 2
Install Engine and Compose
Install the engine, build and Compose plugins, then verify versions.
apt update
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
docker version
docker compose versionStep 3
Run a health check
Run the official hello-world image, inspect it, and remove the stopped container when finished.
docker run --name hello hello-world
docker logs hello
docker rm helloStep 4
Choose an access model
Prefer sudo docker for small hosts. If you add an operator to the docker group, document that it grants root-equivalent control.
usermod -aG docker <admin-user>