0:00–0:10
Recap
0:10–0:40
Lecture
0:40–1:50
Lab 6C
1:50–2:00
Debrief
0:00 – 0:10Recap · 10 min
0:10 – 0:40Lecture · 30 min

docker-compose YAML structure, lifecycle commands, restart policies, and service networking

Part 1 — docker-compose.yml structure (12 min)

Part 2 — Lifecycle commands (8 min)

Part 3 — Restart policies (5 min)

Part 4 — Networks in compose (5 min)

0:40 – 1:50Lab 6C · 70 min

Lab 6C — BIND9 in docker-compose, Nginx service, multi-container stack verification

Part 1 — Install docker-compose (5 min)

Part 2 — BIND9 in a container with docker-compose (30 min)

Part 3 — Add Nginx to the stack (25 min)

Lab 6C complete when: docker-compose installed. BIND9 container running via compose and answering DNS queries on port 5353. Nginx container added to same compose file and serving content on port 8088. Both services survive a host reboot.
1:50 – 2:00Debrief · 10 min

Learning outcomes — by end of Day 3, students can…

Write a docker-compose.ymlDefine services with image, ports, volumes, environment, restart, and depends_on
Use docker-compose lifecycle commandsRun up -d, down, ps, logs, exec, and restart for a compose stack
Choose appropriate restart policiesExplain the difference between no, always, unless-stopped, and on-failure, and select the correct one for a persistent service
Run a DNS server in a containerConfigure ubuntu/bind9 with bind mounts for config files and verify DNS resolution from the containerised server

Common issues and fixes

IssueLikely causeFix
BIND9 container exits immediatelyConfig file error in /opt/bind9/config, or permissions on mount directoriesCheck: docker-compose logs bind9 — the error message will indicate what's wrong. Common: named.conf syntax error, or directory not found
docker-compose up fails with "yaml" errorYAML indentation error — tabs instead of spaces, or wrong indentation levelYAML requires exactly 2-space indentation. Use cat -A to reveal tabs (^I). Online YAML validators can help
dig @127.0.0.1 -p 5353 returns no responseContainer not running, port not bound, or named.conf in container doesn't listen on 0.0.0.0Check docker-compose ps. Check ss -ulnp | grep 5353 on the host. The bind9 container's named must listen on 0.0.0.0, not 127.0.0.1
← Day 2 Lab 6C Handout Day 4 →