Sikau

DevOps and deployment · Day 11 · about 30 min

Registries and tags

Tag versions, log in with a token and push to a registry.

Ship the image, not the source

Servers shouldn't build your code — they should pull the exact image CI tested. A registry (Docker Hub, GitHub Container Registry, AWS ECR…) stores images by name and tag. Good tags are immutable versions like 1.4.2, plus a moving latest.

tag, login, push

docker images cafe-api
docker tag cafe-api ghcr.io/learner/cafe-api:1.4.2
docker tag cafe-api ghcr.io/learner/cafe-api:latest
docker push ghcr.io/learner/cafe-api:1.4.2
echo "$CR_PAT" | docker login ghcr.io -u learner --password-stdin
docker push ghcr.io/learner/cafe-api:1.4.2
docker push ghcr.io/learner/cafe-api:latest
docker rmi ghcr.io/learner/cafe-api:1.4.2
docker pull ghcr.io/learner/cafe-api:1.4.2

The rest of this lesson

  • Image names, in fullexplain
  • Pushing from CIexplain
  • Which tag for production?predict
  • Parts of an image namematch
  • Your turnwrite code
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 14 lessons of DevOps and deployment