Need a particular Python version in a container? Choose a tag from the image’s Docker Hub Tags tab. An image reference puts the tag after a colon: `python:3.11.4` selects the Python image with that version tag. The same pattern works for Node.js, such as `node:18.17.0`. section 5.3.1 section 5.4
Use a tagged image
Run `docker pull python:3.11.4` to download the image, or `docker run -it python:3.11.4` to open its Python shell. Put the same image reference in a Dockerfile’s `FROM` line when building an application image. section 5.3.1
Tags also label images you build. A single `docker build` can assign both a numbered tag, such as `:0.0.1`, and `:latest`; you can then push either the specific tag or all tags to Docker Hub. Docker uses `latest` when you omit a tag. A specific tag helps you identify the version you intend to deploy, but changing a tag does not itself change a container. section 5.5.1 section 7.2
Carry that label through the deployment process:
- For different environments, build with tags such as `my-container:dev`, `my-container:stage`, and `my-container:prod`. Use the appropriate Dockerfile or other configuration to make the actual environment changes. section 7.2.1 section 7.2
- In GitHub Actions, tag a build with both `latest` and `${{ github.sha }}` so it has a default label and a commit-specific label. section 6.1.2
- In a Kubernetes Deployment, prefer an explicit version or commit ID for production auditing, debugging, and rollback. Reapplying an unchanged manifest that still says `:latest` does not tell Kubernetes to roll out an updated image; a rollout restart can force one. section 8.5.2
Listing 7.5 Tagging Docker Compose images
...
web:
image: codingforentrepreneurs/rk8s-py:${TAG:-latest}
build:
context: .
dockerfile: Dockerfile
tags:
- "codingforentrepreneurs/rk8s-py:${TAG:-latest}"
...
The Compose example uses `${TAG:-latest}` in both the service image and build tag. Set `TAG=v1.0.0` to build with that tag; leave it unset to use `latest`. section 7.2.2





