Sign inSign up free

513. Keep Dev Settings Out of the Base Compose File

medium 20 XP ~10 minHands-on lab

There is no container engine in this lab: docker compose isn't available, but docker-compose config validates and prints the merged configuration, which is what the grader reads.

/home/student/projects/storefront/compose.yaml is used both by developers and by the CI pipeline (with -f compose.yaml only). It mixes in developer settings that must not reach CI.

Task

Split it so that:

  • compose.yaml (used alone with -f compose.yaml) has no published ports, no bind mount of source code, and no DEBUG variable for api. It keeps everything else: images, DATABASE_URL, the db service and its named volume.
  • a new compose.override.yaml adds, for api: the port 8000:8000, the bind mount ./src:/app/src, and DEBUG: "1".
  • plain docker-compose config (which picks up the override file automatically) shows the full developer setup.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Part of Docker Fundamentals. Next step: Harden a Service in Compose

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.