🌱Docker HomeLab Notes
Published by Scott Kingery on
About
I have a Windows 11 mini PC that I am repurposing as a HomeLab to run Docker Containers on. I'll use this page to keep track of how things go.
Pre Ubuntu Server Install
- Make sure your PC is connected to a Wired port on the router
- Boot Windows and make sure the BIOS is up to date
- Make notes about the current Windows set up
- Go to Start and type About, copy all the details into a note you'll be able to find later
- Get the Windows Key by opening PowerShell as Administrator and type:
get key: powershell "(Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey"
- Get anything you may need later OFF of this PC because it's going away
- Make notes about the current Windows set up
- Download Ubuntu Server
- Get Ubuntu Server | Download | Ubuntu
- Burn it onto a USB flash drive with balenaEtcher - Flash OS images to SD cards & USB drives
- Boot to Windows, put the flash drive in an open USB slot and open a command prompt at Administrator
- type
shutdown /r /fw- This lets you boot back up into the BIOS so you can set it to boot from the flash drive
- Make your adjustments in the BIOS and save them
- type
Install Ubuntu Server
- When the computer boots, select the install option
- Choose full Ubuntu Server
- Use the full disk
- Note your username and password somewhere
- Install OpenSSH Server.
- Do not install extra server packages yet.
- Do not install Docker from Ubuntu’s optional package selection.
- Reboot when done
After the first boot:
sudo apt update
sudo apt full-upgrade
sudo reboot
- Connect to your new server via SSH (I use Putty on Windows) at its IP address
Basic Server Setup
- Set correct time zone
sudo timedatectl set-timezone America/Los_Angeles
timedatectl
- Here's how to find your time zone timedatectl Cheatsheet | Linuxize
- Ensure a few things are installed
sudo apt install curl ca-certificates git nano htop unattended-upgrades
- Enable automatic security updates:
sudo dpkg-reconfigure unattended-upgrades
Install Docker
Use Docker’s official APT repository
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
Add the Docker repository:
sudo tee /etc/apt/sources.list.d/docker.sources > /dev/null <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
Install Docker and Compose:
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io \
docker-buildx-plugin docker-compose-plugin
Test it:
sudo docker run hello-world
sudo docker compose version
sudo systemctl status docker
Create an Organized Application Structure
A consistent directory layout will make backup, troubleshooting, and migration much easier:
/srv/docker/
├── compose/
│ ├── dockge/
│ ├── uptime-kuma/
│ └── app-name/
├── appdata/
│ ├── dockge/
│ ├── uptime-kuma/
│ └── app-name/
└── backups/
Create the top-level directories:
sudo mkdir -p /srv/docker/{compose,appdata,backups}
sudo chown -R "$USER":"$USER" /srv/docker
