Boss lesson · Unit 04
Ship it
Tag a release, build it in CI, push it, check its health, roll it back
What you practise
- Tagging for releases, building in CI, pushing to a registry, health checks, rolling back to the previous tag
Try a question from this lesson
Pick one
Production runs shop/api:latest. Today's push to latest is broken, and you want yesterday's image back. What is the problem?
Hint
A tag points at one image at a time. Where does latest point now?
Correct answer
Yesterday's image has no tag left to ask for
Why
latest was moved to the broken image, so no name leads to yesterday's. The bytes may still be in the registry, but you would need the digest to find them. A release needs a name of its own.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
One tag per release
Give every build a tag that is never reused: a version number, or the hash of the commit it was built from.
Then the registry holds every release side by side. Deploying means choosing a tag. Rolling back means choosing the previous one.
docker build -t shop/api:1.5.0 .
docker push shop/api:1.5.0Concept
Running is not healthy
A process can be alive and answer nothing. HEALTHCHECK gives Docker a command to run inside the container on a schedule. Exit code 0 counts as a pass.
The container starts as starting, becomes healthy on a pass, and unhealthy after --retries failures in a row. A deploy can wait for healthy before sending traffic.
HEALTHCHECK --interval=10s --retries=3 \
CMD curl -f http://localhost:8000/up \
|| exit 110 more exercises in the app
- 4× multiple choice
- 1× order the lines
- 1× fill the blanks
- 1× true or false
- 2× type the answer
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.