Docker Hub is a hosted container registry: a place to find, store, and distribute container images. Docker uses it by default when an image is missing locally. For example, `docker run nginx` downloads the official NGINX image before starting its container. section 5.1.1
A practical path from a prebuilt image to your own:
- Find the image you need and choose a version on its Tags tab. For Python 3.11.4, `docker pull python:3.11.4` downloads that tagged image; the same image name and tag can go in a Dockerfile’s `FROM` line. section 5.3.1
- Build your application image, then give it a Docker Hub name in the form `<username>/<image>:<tag>`. Log in with `docker login` and upload it with `docker push <username>/<image>:<tag>`. section 5.5
- Choose visibility deliberately. A repository created by pushing is public by default; create it before the first push if it needs to be private. section 5.5 section 5.5.1
Keep a version and a default tag
A Python application image can be built with both `codingforentrepreneurs/rk8s-py:0.0.1` and `codingforentrepreneurs/rk8s-py:latest`, then pushed to Docker Hub. An image name without a tag uses `latest` by default; the numbered tag identifies a particular iteration. section 5.5.1
Listing 5.14 Pushing our Python container image to Docker Hub
cd ~/dev/roadtok8s/py
# if you haven't already
# login to Docker Hub
docker login
# build and tag twice
docker build -f Dockerfile \
-t codingforentrepreneurs/rk8s-py:0.0.1 \
-t codingforentrepreneurs/rk8s-py:latest \
.
# push a specific tag
docker push codingforentrepreneurs/rk8s-py:0.0.1
# push all tagged versions
docker push codingforentrepreneurs/rk8s-py --all-tags
Follow the complete Python example from command-line login through building with two tags and pushing either one tag or all tags. section 5.5.1
Once an image is hosted, a production Docker Compose file can name it directly. The production machine can pull the image and start its container with `docker compose pull` and `docker compose up -d`. For a private image, log in to Docker Hub on that machine first. section 7.3.3

