Homelab from Zero #3: Your first container with DockerHomelab from Zero #3: Your first container with Docker

Homelab from Zero #3: Your first container with Docker

This is part 3 of Homelab from Zero. In part 2 the box became a headless server you control over SSH. Today it starts doing something: we’ll install Docker and run the first real service, one you can open in a browser.

Images and containers in one minute

Almost everything that runs on a homelab ships as a Docker image: a ready-made bundle of an app and everything it needs, built by the people who make the app. You download an image and run it, and the running copy is called a container.

That’s the whole trick. No “install these 12 dependencies” pages, no two apps fighting over the same library. Don’t like an app? Delete its container and it’s gone, completely. This is why almost every self-hosted project’s install instructions are just one docker run line.

Step 1: Install Docker

SSH into the server and run Docker’s official install script:

curl -fsSL https://get.docker.com | sudo sh

Then let your user run Docker without typing sudo every time:

sudo usermod -aG docker $USER

Log out (exit) and SSH back in so that takes effect, then check it works:

docker run hello-world

If you see “Hello from Docker!”, everything is wired up: it downloaded a tiny image, ran it as a container, and printed that message.

Step 2: Run something you can actually see

hello-world proves the plumbing, but it’s not exactly fridge-art. Let’s run Heimdall, a clean dashboard page where you bookmark all the services you’ll be adding in the coming parts. One command:

docker run -d \
--name heimdall \
-p 8080:80 \
-v ~/heimdall:/config \
--restart unless-stopped \
lscr.io/linuxserver/heimdall

What each line means, top to bottom:

Piece Plain English
-d Run in the background
--name heimdall Give the container a name you can refer to
-p 8080:80 “Port 8080 on the server goes to this app”
-v ~/heimdall:/config Keep its settings in a folder that survives deletes
--restart unless-stopped Start it again automatically after reboots
lscr.io/linuxserver/heimdall The image to run

Step 3: Open it in a browser

On your normal computer, browse to the server’s address from part 2, with the port on the end:

http://192.168.1.73:8080

There it is, a real web app, served by your server. Click the pencil icon and add a bookmark or two. From now on, every service the series adds gets a tile here, so this page slowly becomes the front door of your lab.

The five Docker commands you’ll actually use

Command What it does
docker ps What’s running right now?
docker logs heimdall What is it saying? (great when something’s broken)
docker restart heimdall Turn it off and on again
docker stop heimdall Stop it
docker rm heimdall Delete the container (your ~/heimdall settings survive)

What you have now

A server that runs services: Docker installed, one real app up, reachable from any browser in the house, and it comes back on its own after a reboot. The pattern you just used (docker run, a port, a config folder) is the same one every part from here on builds on. In part 4 we put the whole household on the payroll: Pi-hole, network-wide ad blocking.


← Back to blog

Following along?