A container and Kubernetes lab
Install Docker (or Podman) and a small local Kubernetes cluster so you can build images, run containers, write manifests and practise deployments and pipelines on your own computer.
What you need
A container engine builds and runs containers. On Linux, install Docker Engine (docs.docker.com) or Podman (podman.io), which is free and works with the same commands. On Windows and macOS the usual choice is Docker Desktop (read its licence terms: it is free for personal learning and small businesses, but larger companies need a paid plan) or the fully free Rancher Desktop or Podman Desktop.
For Kubernetes you do not need a cloud account. A local cluster in containers is enough: kind (kind.sigs.k8s.io), minikube (minikube.sigs.k8s.io) or k3d, driven by the kubectl command line (kubernetes.io/docs/tasks/tools).
Set it up
- Install the container engine and confirm it runs:
docker run --rm hello-worldprints a greeting. - Install
kubectl, then a local cluster. With kind:kind create cluster --name lab. With minikube:minikube start. - Confirm the cluster:
kubectl get nodesshows a node in the Ready state. - Build your first image. Create a
Dockerfilefor a tiny app, then:
docker build -t demo:1.0 .
docker run --rm -p 8080:3000 demo:1.0
- Load the image into kind (
kind load docker-image demo:1.0 --name lab) and apply a Deployment manifest withkubectl apply -f deployment.yaml. Expose it withkubectl port-forward deploy/demo 8080:3000. - For pipelines, push your project to GitHub and add a workflow file under
.github/workflows/; public repositories get free automation minutes (check current limits).
Check that it works
docker pslists a running container andcurl localhost:8080answers.kubectl get podsshows your pods Running, andkubectl rollout status deploy/demoends with “successfully rolled out”.kubectl describe pod <name>shows events; break the image name on purpose and watchErrImagePullappear, then fix it.
Practise safely
- Containers share your computer’s resources. Set limits (
docker run --memory 256m) so a runaway container does not freeze your machine. - Do not run containers with
--privilegedor mount your home directory unless the exercise needs it. - Never put secrets in a Dockerfile or an image; images are easy to inspect. Use environment variables or Kubernetes Secrets, and keep real credentials out of a lab.
- Clean up regularly:
docker system pruneremoves unused data, andkind delete cluster --name labremoves the cluster. - Pull base images from official sources and pin their versions.
Go further
- Make the image smaller with a multi-stage build and a slim base, and compare sizes with
docker images. - Add health probes, resource requests and limits, and a rolling update strategy to your Deployment, then update the image and watch Kubernetes replace pods one at a time.
- Cause each common failure on purpose (a wrong image tag, a missing secret, a probe on the wrong port, too little memory) and read
kubectl describeto find it. - Build a pipeline that tests, builds an image on every push and deploys to your local cluster when you tag a release.
Courses that use this lab
Other lab guides
- A virtual machine lab on your own computer
- A Linux practice machine
- A network lab with free simulators and virtual routers
- A packet-capture lab with Wireshark and tcpdump
- A network-services lab: DHCP, DNS, proxy, load balancer, time and failover
- A Windows Server and Active Directory lab
- A developer workstation: editor, Git, Python and Node
- A monitoring lab with Prometheus and Grafana
- A security operations (SOC) practice lab
- An isolated security lab for authorised practice
- A cloud lab that cannot surprise you with a bill
- An embedded and microcontroller lab: simulators first, hardware second
- An electronics lab: simulate first, then build on a breadboard
- A Raspberry Pi lab, with or without a Pi
- A home automation lab with Home Assistant and MQTT
- An audio, video, streaming and show-control lab
- A data lab: Python, pandas and Jupyter on your own computer
- A machine learning lab: scikit-learn, notebooks and honest experiments
- An LLM lab: a free local model, embeddings and a test harness
- A TypeScript lab: Node.js, the compiler and a test runner
- A web deployment lab: Git, a free host and environment settings
Software changes quickly. Menu names and version numbers may differ a little from what you see; the ideas and the check at the end of each section stay the same. Always download from the project's own website, and read the licence terms for your situation.