Docker has become the default way to run almost anything on a server — it packages an app and its dependencies into a container that runs the same everywhere. Once it is installed, deploying tools like n8n, Coolify, or your own apps becomes a one-command affair. Here is the correct, current way to install it on Ubuntu 24.04.
Why the official repository?
Ubuntu's built-in docker.io package is often out of date. Installing from Docker's official repository gets you the latest Docker Engine plus the modern Compose plugin. It is a few extra steps but worth it.
1. Set up the repository
First install the prerequisites and add Docker's GPG key and repository:
sudo apt updatesudo apt install ca-certificates curl gnupg -y
Then add Docker's official GPG key and the repository for your Ubuntu release as shown in Docker's docs (this keeps the key verifiable rather than piping a script blindly into your shell).
2. Install Docker Engine and Compose
sudo apt updatesudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y
That installs the engine, the CLI, the container runtime, and the Compose plugin in one go.
3. Run your first container
Confirm everything works:
sudo docker run hello-world
If you see the welcome message, Docker is running.
4. Use Docker without sudo
Typing sudo before every command gets old fast. Add your user to the docker group:
sudo usermod -aG docker $USER
Log out and back in for it to take effect. Note the security trade-off: members of the docker group effectively have root, so only add trusted users.
5. Docker Compose
Compose is now a built-in subcommand — use docker compose up -d (two words, no hyphen). Define your services in a compose.yaml file and bring an entire multi-container app up with one command. This is how most self-hosted tools are deployed today.
Where to go next
With Docker installed on your Linux VPS, you are ready to self-host a huge range of software. Try the use-case guides for ideas, and do not skip securing the server first.