hello-world container.
This guide follows the official Docker Engine installation flow for Ubuntu. Keep a browser open to the Docker documentation for reference: https://docs.docker.com/engine/install/ubuntu/
Prerequisites
1 — Verify OS release and architecture
Confirm the distribution and version:2 — Uninstall old Docker packages (optional / precaution)
If older Docker packages are installed, remove them first. On production systems take care — removing packages may impact running services.If this VM runs production services, do NOT remove packages unless you understand the consequences. Back up important data and confirm dependencies before uninstalling packages.
3 — Add Docker’s APT repository (recommended)
Follow these steps to configure the official Docker repository, which ensures you get the latest stable Docker packages.- Update apt and install prerequisites:
- Create the keyrings directory and install Docker’s GPG key:
- Add the Docker APT repository, using the system architecture and Ubuntu codename dynamically:
4 — Install Docker Engine and related packages
Update apt and install Docker Engine, the CLI, containerd, and the Buildx / Compose plugins:
Confirm installation prompts during apt and accept (
Y) if required.
5 — Enable and start Docker
Enable Docker to start automatically at boot and start the service immediately:6 — Verify the installation: run hello-world
Pull and run thehello-world image to confirm Docker can download images and run containers:
Post-installation tips
- To run Docker commands without
sudo, create thedockergroup and add your user:
If you add your user to the
docker group, understand the security implications: members of the docker group effectively have root-equivalent access to the host. See Docker’s post-installation docs for details.- For Compose and Buildx usage, refer to the Docker docs for examples and plugin configuration.
- If you have specialized firewall rules (iptables/nftables), verify Docker’s networking behavior and adjust rules to avoid conflicts.
Links and references
- Docker Engine on Ubuntu — official install guide: https://docs.docker.com/engine/install/ubuntu/
- Docker post-installation steps (manage Docker as a non-root user): https://docs.docker.com/engine/install/linux-postinstall/
- Docker documentation home: https://docs.docker.com/