Docker packages applications, along with everything they need, into containers. Software then runs the same everywhere, without cluttering your system with dependencies. Docker Compose goes one step further and starts entire multi-container setups from a single file. Together they are the foundation for almost anything you want to self-host. This guide installs both and gets your first container running.
10 minBeginnerTested on Ubuntu 24.04Updated 2026-06-18
In short
Install Docker with the official script, add the computebox user to the docker group, then start containers with docker run or docker compose up.
Containers are isolated from each other and from the host, start in seconds, and are just as quick to remove. Instead of installing an application by hand, you pull a ready-made image and run it. Updates, backups, and moves all become much easier.
It gets more interesting with Compose. Create a project folder with a docker-compose.yml file:
my-project
docker-compose.yml
A simple example that serves a web server on port 8080:
Inside the project folder, start the setup in the background:
You can then reach the web server at http://YOUR-SERVER-IP:8080. For the port to be open from outside, allow it in the firewall, see Set up a firewall with ufw:
With image: nginx:latest you only started an example here. In the same way you pull any other application as an image, from a database to a complete self-hosting tool.
docker compose ps # see running containersdocker compose logs -f # follow logs livedocker compose down # stop and remove the setupdocker system prune # clean up unused images and containers