Docker for beginners: containers without the jargon overload
Docker advice for home labs tends to arrive as a finished cathedral: a forty-line compose file, six services, a reverse proxy, and a beginner staring at it wondering which part is load-bearing. This guide takes the opposite route. Four concepts explain nearly everything a home lab does with Docker, and one of them (volumes) is the difference between a tidy setup and a lost database. Learn the four, run one service properly, and the cathedral can wait.
Concept 1: An image is a blueprint, not a program
An image is a read-only package: a minimal operating system layer, the application code, and everything the application needs to run, frozen into a file. Self-hosting guides use a programming analogy, if the image is a class definition, a container is an object created from it. You download (“pull”) images from a registry; the same image can be started many times. Nothing about your data lives in an image, which is precisely why images can be updated and replaced safely.
Concept 2: A container is a running instance
A container is that blueprint, running: it has its own filesystem (starting as a copy of the image), its own network interface, and its own processes, isolated from the host and from other containers. Start it, stop it, delete it, the image remains, ready to start again. Beginner explainers reach for the shipping-container analogy for a reason: the host machine, like a cargo ship, moves standardized boxes without caring what is inside. That standardization is why a container that runs on a mini PC also runs on a Raspberry Pi (given an image built for its processor) or a rented server.
One design rule follows: containers are normally single-purpose. Homelab coverage of container tooling puts it plainly, an image is typically built to do one or two things, and cramming a bundle of unrelated apps into one container fights the model. One service per container is not pedantry; it is what makes each service independently updatable, restartable, and replaceable.
Concept 3: Volumes are where your data actually lives
Here is the trap, stated early and plainly because beginner guides bury it: anything written inside a container disappears when the container is deleted or recreated, unless it was written to a volume. A volume is a directory on the host machine, mounted into the container at a chosen path. The container reads and writes it as if it were internal; when the container is removed and a new one is started with the same mount, the data is simply still there.
| Storage | Survives container removal? | Use it for |
|---|---|---|
| Container's internal filesystem | No | Temporary files, caches, nothing you value |
| Volume / host folder mount | Yes | Databases, uploaded files, configuration, everything you value |
Container tooling writers make the same distinction from the user's side: a container has persistent storage (a volume or host folder) and storage destroyed on update, and keeping preferences in the persistent location is what makes an accidental reinstall a shrug instead of a disaster. Before running any service, answer one question: where does it keep its data, and is that path a volume? If you cannot answer, do not run it yet.
Concept 4: Ports and networks are the doors
A container's services listen on ports inside the container. Publishing
a port (for example, mapping host port 8080 to container port 80) is what
makes a service reachable from your browser: the host's address is the
building, the port is the apartment number. Separately, containers placed
on the same Docker network can talk to each other using
their container names as hostnames, a web app reaches its database at an
address like db:5432, while staying unreachable from outside
unless you publish their ports. That gives you a clean default: publish
only the door you actually use.
Your first weekend, in order
- Install Docker on your lab machine using the official documentation for your operating system, and confirm it runs with the standard test command the docs provide.
- Run one useful service, a network-wide ad blocker or a monitoring dashboard are the usual first picks, using the service's official image and its documented volume mount for configuration/data.
- Verify persistence deliberately: stop the container, remove it, and start it again with the same volume. Log in. Your settings and data should be exactly as you left them. This five-minute test teaches the volume concept better than any diagram.
- Write down what you ran, the exact command or compose snippet, the volume path, and the published port, in your lab notes.
- Stop. Run the single service for a week before adding a second. Stability first is the rollout rule this whole site follows.
When you reach three or more containers, graduate to Docker Compose: one YAML file describing each service's image, ports, volumes, and restart policy, brought up with a single command. Compose is not a different system, it is these same four concepts, written down.
Containers vs virtual machines, in one paragraph
A virtual machine emulates a whole computer, guest operating system included; a container shares the host's kernel and packages only the application and its dependencies. Containers therefore start in seconds and use a fraction of the memory, which is why a modest mini PC can host a dozen containers but only a few VMs. The trade-off is isolation strength: VMs separate more completely. Many labs run both, a hypervisor hosting VMs, with containers inside one of them, and this site's hypervisor guide covers that choice.
Reading a Docker command without fear
Sooner or later a guide will hand you a command like the ones in
official quick-starts, and it helps to know that every flag in it maps to
one of the four concepts. The image name at the end is the blueprint being
started (concept 1). The -d flag runs the container detached,
in the background, rather than attached to your terminal (concept 2, it is
a running instance, not a session you babysit). A -p 8080:80
flag publishes a port, connecting the host's 8080 to the container's 80
(concept 4). A -v flag mounts a volume, the host path before
the colon is where your data will live, the path after it is where the
container sees it (concept 3). And --restart unless-stopped
simply tells Docker to bring the instance back after a reboot, which is
what makes a service a service rather than an experiment.
That decomposition is the real beginner skill. Compose files, which you will meet next, are the same five lines wearing YAML: an image, some ports, some volumes, a restart policy. Nothing new is introduced, the concepts repeat at slightly larger scale, which is exactly why learning them on one container, with the persistence test performed by hand, pays off so reliably. The homelab operators who struggle least with Docker are not the ones who memorized the most commands; they are the ones who can look at any command or compose block and point at where the data lives. Everything else is lookup. That question, where does the data live, and is it a volume?, is worth taping above the desk.
FAQ
Is Docker the only option? No. Docker helped create the Open Container Initiative standard, and alternatives such as Podman run the same containers. For a beginner, Docker's documentation and community size make it the practical default; the concepts transfer.
What breaks most often for beginners? Data loss from missing volumes, and port conflicts, two services published on the same host port. Both are prevented at setup, not fixed at 1 a.m.
Do containers back themselves up? No. A volume is a folder; it belongs in your normal backup routine like any other data (see this site's 3-2-1 backup guide).