Safeguard
Developer Tools•

What is in a container image reference? Host, repository, tag and digest

A container image reference has a host, namespace, repository and tag, with defaults for each. Why bare names are risky and how to pin a digest.

Safeguard Security Team
3 min read

A container image reference names where an image lives and which version you mean. Docker's format is host and optional port, then namespace and repository, then an optional tag. Omit parts and Docker fills in defaults: Docker Hub as the host, library as the namespace and latest as the tag. A digest pins exact content.

The parts

Docker's documentation gives the form as HOST[:PORT]/NAMESPACE/REPOSITORY[:TAG] and explains each part.

PartMeaningDefault if omitted
HostThe registry locationdocker.io, Docker Hub
PortOptional registry port, such as 5000None
NamespaceUsually a user or organizationlibrary, reserved for Docker Official Images
RepositoryIdentifies the specific image, requiredNone
TagA version or variant labellatest

Examples from the docs: example.com:5000/team/my-app:2.0 has host example.com, port 5000, namespace team, repository my-app and tag 2.0. The bare name alpine means host docker.io, namespace library, repository alpine and tag latest.

Why defaults are a risk

A short name like alpine silently resolves to a public registry and the latest tag. If your build or manifest uses bare names:

  1. You depend on a public host even where you meant an internal one.
  2. The tag moves, so the image changes between builds.
  3. A misspelling or a name clash can pull something you did not intend.
  4. Your scan results describe a tag, not a fixed image.

Write references that are safe

  1. Always include the host, so the source is explicit and matches your allowlist.
  2. Use full version tags rather than latest. See what Kubernetes does with latest.
  3. Add the digest for anything that runs in production. A reference can combine a tag for readability and a digest for exactness, for example registry.example.com/team/my-app:2.0@sha256:.... Check how your tooling treats a reference that carries both.
  4. Enforce this with policy at admission, so a bare reference is rejected. See require image digests.
  5. Keep a list of approved registries and fail builds that pull from elsewhere.

The tag grammar itself comes from the OCI distribution specification: see how to tag release images.

Where Safeguard fits

Safeguard's container image scanning reports vulnerabilities and packages per image, and its policy gates can act on what the reference actually resolves to. You can try a free scan.

Try it yourself

Click through it at your own pace, or open it full screen. Check which image name and layers the findings are attached to.

Quick check

What does a bare name like alpine resolve to?

Docker Hub as the host, library as the namespace, alpine as the repository and latest as the tag.

Why add a digest?

A tag can be moved, while a digest identifies exact content, so the deployed image is the one you tested.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.