Apply for Free VPS

Install Docker on Ubuntu

Updated 27 Nov 2026 docker containers

Install Docker Engine from Docker's official package repository.

These steps follow Docker's official instructions for Ubuntu. Check the current documentation at https://docs.docker.com/engine/install/ubuntu/ if anything differs.

Add the repository

sudo apt update
sudo apt install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo 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" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo docker run --rm hello-world

A security note

Adding a user to the docker group grants root-level control. Also, ports published by Docker bypass ufw rules. Bind private services to localhost:

docker run -d -p 127.0.0.1:5432:5432 -e POSTGRES_PASSWORD='use-a-long-random-value' postgres:16

Keep disk use in check

docker system df
docker system prune

Was this helpful?

Report outdated or incorrect information