Running containers on a fresh Ubuntu 26.04 server? The default repositories do not ship a production-ready version of Docker. This guide installs Docker Engine directly from the official Docker repository, with Compose and Buildx included. By the end, you'll have Docker running as a system service with a live Nginx container confirming the install.
Install Docker
The official Docker repository gives you the most current Docker Engine builds. Follow these steps to add the GPG key and repo, then install.
1. Install dependency packages:
$ sudo apt install apt-transport-https ca-certificates curl -y
2. Add Docker's GPG key:
$ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
3. Register the Docker repository:
$ 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
4. Refresh APT:
$ sudo apt update
5. Install Docker Engine and plugins:
$ sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
What you just installed:
-
docker-ce: Docker Engine (community edition) -
docker-ce-cli: CLI client -
containerd.io: container runtime -
docker-buildx-plugin: multi-platform image builds -
docker-compose-plugin: multi-container orchestration via YAML
6. Verify the install:
$ docker --version
Configure Docker as a System Service
Enable Docker to start automatically when the server boots.
1. Enable and start the service:
$ sudo systemctl enable docker
$ sudo systemctl start docker
2. Check the service status:
$ sudo systemctl status docker
3. Stop or restart the service when needed:
$ sudo systemctl stop docker
$ sudo systemctl restart docker
Add Your User to the Docker Group
Adding your user to the docker group allows you to run Docker commands without sudo.
$ sudo usermod -aG docker $USER
$ newgrp docker
Verify the group change took effect:
$ docker ps
If you see a permission denied error, log out and back in to apply the group change.
Run a Containerized Application
Pull the official Nginx image and run it as a container to verify the installation.
1. Pull the image:
$ docker pull nginx:latest
2. Run the container:
$ docker run --name example-nginx -d -p 80:80 nginx:latest
Flags:
-
--name example-nginx: human-readable container name -
-d: run detached (background) -
-p 80:80: map host port 80 to container port 80
3. Verify the container is running:
$ docker ps
4. Open the firewall:
$ sudo ufw allow 80/tcp
Open http://YOUR-SERVER-IP in a browser. The Nginx welcome page confirms the container is running.
Next Steps
Docker is now installed and running. From here you can:
- Build custom images with a
Dockerfile - Orchestrate multi-container apps with
docker compose - Push images to Docker Hub or a private registry
For the full guide with additional tips, visit the original article on Vultr Docs.
Top comments (0)