Docker Basics for Self-Hosting
Learn images, containers, volumes and Docker Compose so you can deploy self-hosted applications with confidence.
Docker is the fastest, cleanest way to run self-hosted apps. Once these concepts click, you'll be able to deploy almost anything.
The four concepts you need
- Image — a read-only template for an app (e.g.
jellyfin/jellyfin). - Container — a running instance of an image.
- Volume — persistent storage that survives container updates.
- Network — how containers talk to each other and the outside world.
Your first container
docker run -d \
--name pihole \
-p 53:53/udp -p 80:80 \
-v /opt/pihole/etc:/etc/pihole \
--restart unless-stopped \
pihole/piholeThat single command downloads the image, creates persistent storage, and starts the service.
Docker Compose: the real magic
Typing long docker run commands doesn't scale. Docker Compose lets you describe your whole stack in one file:
services:
jellyfin:
image: jellyfin/jellyfin
container_name: jellyfin
ports:
- "8096:8096"
volumes:
- ./config:/config
- /mnt/media:/media
restart: unless-stoppedBring it up with one command:
docker compose up -dGolden rules
- Persist data in volumes, never inside the container.
- Pin image versions for predictable updates.
- Back up your compose files and volumes — they are your entire setup.
- Update regularly:
docker compose pull && docker compose up -d.
Where to go next
- Follow our tutorial to install Docker on Ubuntu.
- Compare Docker vs Podman.
- Browse self-hosted apps to deploy.
Master Compose and a whole world of self-hosting opens up.
Related articles
How to Install Docker on Ubuntu
A step-by-step tutorial to install Docker Engine and Docker Compose on Ubuntu Server, then run your first container.
The Complete Home Server Beginner's Guide
Go from zero to a running home server: choose hardware, pick an operating system, deploy your first apps, and keep everything secure and backed up.
How to Set Up Pi-hole for Network-Wide Ad Blocking
Install Pi-hole with Docker to block ads and trackers for every device on your home network.