liveBook · Manning

Image tag

As explained in Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform

A Docker image tag is a human-readable label that identifies a particular image reference or version, optionally including a registry location.

A Docker image tag gives an image a readable reference for build, push, and run commands. Build with `docker build -t video-streaming --file Dockerfile .`; the final period selects the current directory. Without a specified version, the tag is `latest`. Use `docker image list` to check the repository, tag, and image ID. section 3.8.2

To publish the image, give it a tag containing your registry URL: `docker tag <existing-image> <registry-url>/<image-name>:<version>`. This adds a reference to the existing image; it does not build another image. Check `docker image list`: both tags should show the same image ID. Then push the registry-qualified tag with `docker push <registry-url>/<image-name>:<version>`. section 3.9.2

Tag and publish a version

`docker tag video-streaming bmdk1.azurecr.io/video-streaming:1` followed by `docker push bmdk1.azurecr.io/video-streaming:1` publishes version `1` to the example registry. Substitute your own registry URL, and use the intended version when referencing the image later. section 3.9.2 section 3.9.3

Multiple tags can point to one image ID. When cleaning up locally, `docker rmi <your-image-id> --force` removes an image even when multiple tags reference it. A registry-qualified tag can also be passed to `docker run` to boot the published image. section 3.9.3

How Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform covers it

How deep it goes
Works through build-time naming, retagging, verification, pushing, and cleanup; defers automatic version setting to a continuous deployment pipeline.
Examples
Uses `video-streaming:latest` locally and `bmdk1.azurecr.io/video-streaming:1` for a registry push.
What it assumes
Assumes a Dockerfile and, for publishing, registry login details; teaches the tag and push command forms directly.
What you can do after
Operate/configure it with Docker CLI commands to name, verify, publish, and run an image by tag.
How it connects
Connects image IDs, Dockerfiles, container registries, and continuous deployment.

Also explained in

Compare how 6 books explain image tag →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform. The section links point to the parts of the book it draws on.