Installing Docker and Docker Compose on Ubuntu 24.04 or Ubuntu 26.04 LTS is straightforward using Docker's official APT repository. This installs the latest available stable Docker Engine, Docker CLI, and Docker Compose plugin.
This guide covers the complete installation on an Ubuntu Server, KVM VPS, cloud virtual machine, or dedicated server.
Need a Linux VPS for Docker? Owned Networks offers KVM VPS hosting with full root access, SSD storage, and US/EU locations.
Before You Start
- Ubuntu 24.04 LTS or 26.04 LTS, 64-bit.
- Root or sudo access and an internet connection.
- Enough free disk space for Docker images and containers.
- A fresh Ubuntu installation or a reviewed existing Docker installation.
Check your Ubuntu version:
cat /etc/os-release uname -m |
Using an older version? See our Ubuntu 20.04 to 24.04 upgrade guide or Ubuntu 24.04 to 26.04 upgrade guide.
Step 1: Update Ubuntu and Check for Existing Docker Packages
Update your system:
sudo apt update && sudo apt upgrade -y dpkg -l | grep -E 'docker|containerd|runc' || true |
If you already use Docker, back up your containers, volumes, and configuration before changing packages. For a fresh installation, remove any conflicting Ubuntu-provided Docker packages if they are installed:
sudo apt remove -y docker.io docker-compose docker-compose-v2 docker-doc docker-buildx podman-docker containerd runc |
If APT reports that some packages are not installed or cannot be located, review the package names and remove only those present. Do not run this removal command blindly on a production server with existing containers.
Step 2: Add Docker's Official APT Repository
Install the prerequisites, add Docker's signing key, and configure the official Ubuntu repository:
|
The repository configuration automatically selects the appropriate Ubuntu release, including noble for Ubuntu 24.04 or resolute for Ubuntu 26.04.
Step 3: Install Docker Engine and Docker Compose
Install Docker Engine, containerd, Buildx, and the Docker Compose plugin:
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin sudo systemctl enable --now docker |
This installs Docker Compose v2 or later as a CLI plugin. Use docker compose (with a space), rather than the legacy docker-compose command.
Step 4: Verify Docker and Docker Compose
Check installed versions, service status, and run Docker's official test container:
sudo docker --version sudo docker compose version sudo systemctl status docker --no-pager sudo docker run --rm hello-world |
If you see Hello from Docker!, the Docker Engine installation is working.
Step 5: Test Docker Compose
Create a simple Docker Compose project using Nginx:
|
A successful response should include HTTP/1.1 200 OK. The example binds Nginx to localhost so it is not exposed publicly.
When finished, stop and remove the test container:
sudo docker compose down |
Optional: Run Docker Without sudo
To allow your current user to run Docker commands without sudo:
sudo usermod -aG docker "$USER" newgrp docker docker ps |
Security warning: Docker group membership effectively grants root-level access to the host. Only add trusted administrators. For stricter isolation, consider Docker rootless mode.
How to Update Docker and Docker Compose
Docker can be updated through APT once its official repository is configured:
sudo apt update sudo apt install --only-upgrade docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin sudo docker --version sudo docker compose version |
Back up production workloads and review release notes before upgrading. Updating Docker Engine may restart services or affect running containers.
Common Docker Installation Problems
Docker: Command Not Found
Check that docker-ce-cli is installed and verify the installation with sudo docker --version.
Cannot Connect to the Docker Daemon
Verify that Docker is running:
sudo systemctl status docker --no-pager sudo systemctl restart docker sudo journalctl -u docker -n 50 --no-pager |
Docker Permission Denied
Use sudo docker or configure trusted-user Docker group membership as explained above.
Unable to Locate Package docker-ce
Check the repository configuration and update APT:
cat /etc/apt/sources.list.d/docker.sources sudo apt update apt-cache policy docker-ce |
Verify that your Ubuntu version and architecture are supported by Docker.
Docker Compose: Command Not Found
Install the Compose plugin using sudo apt install docker-compose-plugin and run sudo docker compose version. The legacy standalone docker-compose command is not required.
Important: Docker Firewall Security on a VPS
Docker-published container ports can bypass some UFW firewall rules. Avoid exposing databases, administration panels, or internal container services publicly without appropriate network restrictions.
For services that should only be available locally, bind ports to 127.0.0.1 as shown in the Docker Compose example above. For public services, configure the provider firewall and Docker-specific firewall policies carefully.
Related Guide: Self-Host n8n with Docker
Now that Docker and Docker Compose are installed, you can use them to host automation platforms and web applications.
Follow our How to Host n8n on an Ubuntu VPS Using Docker guide to deploy n8n with persistent storage, a custom domain, and HTTPS.
Related Solution: Run Docker on an Owned Networks VPS
Need a VPS for Docker Hosting?Deploy Docker containers, applications, automation platforms, and websites on a Linux VPS with full root access.
|
Frequently Asked Questions
How do I install Docker on Ubuntu 24.04?
Add Docker's official APT repository, then install docker-ce, docker-ce-cli, containerd.io, docker-buildx-plugin, and docker-compose-plugin.
Does Docker support Ubuntu 26.04 LTS?
Yes. Docker officially supports Ubuntu 26.04 LTS (Resolute) and Ubuntu 24.04 LTS (Noble).
Is Docker Compose included with Docker?
On Ubuntu Server, Docker Compose is installed through the docker-compose-plugin package when using Docker's official repository.
What is the difference between docker compose and docker-compose?
docker compose is the modern Docker CLI plugin command. docker-compose refers to the older standalone command, which is no longer recommended for new installations.
Can I run Docker on a KVM VPS?
Yes. A Linux KVM VPS with a compatible kernel and appropriate resources can run Docker Engine and Docker Compose. You need administrator access to install and manage Docker.
How much RAM do I need for Docker on a VPS?
Docker Engine has relatively modest overhead, but memory requirements depend mainly on the containers you run. A 2 GB VPS may be suitable for lightweight applications, while larger databases, automation tools, and multiple services often require 4 GB or more.
Conclusion
Installing Docker and Docker Compose on Ubuntu 24.04 or 26.04 takes only a few steps: configure Docker's official repository, install the packages, enable Docker, and verify the installation using a test container.
Need a server for running Docker workloads? Explore Owned Networks Linux VPS Hosting or compare KVM VPS plans.
Last reviewed: November 2026. Official reference: Docker Engine Installation on Ubuntu and Docker Compose Plugin Installation.