45/53
Sign inSign up free

833. Build Images From Compose

easy 10 XP ~8 minHands-on lab

Labs have no container engine, so nothing is built: your files are checked with docker-compose config.

/home/student/projects/pricing/compose.yaml only pulls the api image from the registry. Developers want docker compose build to build it from api/Dockerfile, the same way CI does.

Task

Give the api service a build section so that it:

  • uses the directory ./api as the build context (the Dockerfile there keeps its default name),
  • builds the stage runtime of that Dockerfile,
  • passes the build argument VERSION, taken from the environment variable VERSION, defaulting to dev,

and name the built image registry.example.com/pricing-api:<VERSION> with the same default. Keep the ports.

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.

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.