15/53
Sign inSign up free

516. Why Is the Version Label Empty?

medium 20 XP ~8 minHands-on lab

CI builds /home/student/projects/exporter with docker build --build-arg VERSION=1.8.2 .. The final image's org.opencontainers.image.version label and its APP_VERSION environment variable come out empty, though the build stage sees the version fine.

Task

Fix the Dockerfile so that, in the final stage:

  • VERSION is available, and still defaults to dev when no build arg is given,
  • the label org.opencontainers.image.version and the environment variable APP_VERSION are set from it,
  • the build stage still uses it for -ldflags.

Keep both stages, their base images and the other instructions. (hadolint is installed if you want a second opinion.)

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.