Version-Stamped Builds
Parameterize a build with ARG so CI stamps every image.
A intermediate Docker challenge worth 10 points. Solve it hands-on in a real Docker environment in your browser - no local setup, no fake shells.
The Challenge
Scenario: No hardcoded version numbers — the release pipeline injects them at build time. Requirements in /root/relay/README.md.
Tasks: write /root/relay/Dockerfile (base alpine:3.20) that:
- declares
ARG BUILD_VERSION - sets label
org.app.versionto it and writes it to/version.txt - copies
relay.shto/usr/local/bin/relay.sh
Then build: docker build --build-arg BUILD_VERSION=2.5.1 -t relay:2.5.1 /root/relay
Commands to learn: ARG, LABEL, docker build --build-arg
Run check when done.