liveBook · Manning

Image reference

As explained in Learn Docker in a Month of Lunches, Second Edition

An image reference is a name that identifies a container image, optionally including a registry domain, repository, tag, or digest.

An image reference is the name Docker uses to find an image. A full reference has four parts: registry domain, account or organization, repository, and tag. For example, docker.io/diamol/golang:2e names the golang repository in the diamol organization on Docker Hub, with the tag 2e. When sharing an image, include enough detail to identify its repository on the intended registry. section 5.1

Figure 5.1 Anatomy of a Docker image reference
figure

Use the diagram to locate each part of a full image reference. section 5.1

Docker supplies some parts when you omit them:

  • Without a registry domain, Docker uses Docker Hub. diamol/golang:2e is short for docker.io/diamol/golang:2e. section 5.1
  • Without a tag, Docker uses latest. diamol/golang is short for docker.io/diamol/golang:latest. section 5.1
  • To target another registry, put its domain first, as in registry.local:5010/gallery/ui:v1. section 5.3

Give an existing image a shareable name

If you built image-gallery locally, set dockerId to your Docker Hub username, then run docker image tag image-gallery $dockerId/image-gallery:v1. This adds a reference; it does not rebuild the image. Check the references with docker image ls, log in with docker login --username $dockerId, and upload with docker image push $dockerId/image-gallery:v1. You can push to your own account or an organization you can access. section 5.2

The same tagging approach works for a registry you run yourself: docker image tag image-gallery registry.local:5010/gallery/ui:v1. A local registry using plain HTTP needs explicit Docker Engine configuration before Docker will push to it. The example registry has no authentication or authorization, so do not treat that setup as production-ready. section 5.3

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Defines the four reference parts and defaults, then works through tagging and pushing; does not elaborate on digest-based references.
Examples
Uses diamol/golang:2e to show defaults and image-gallery references to demonstrate Docker Hub and local-registry pushes.
What it assumes
Assumes basic experience running or building Docker images, while introducing registry naming and sharing through commands.
What you can do after
Operate/configure it by tagging an existing image with a registry-qualified reference and pushing it to an accessible registry.
How it connects
Connects image references to Docker registries, repositories, image tags, Docker Hub, and image IDs.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.