8000 docs: update prose about image tag/name format · docker/cli@2c6b804 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2c6b804

Browse files
committed
docs: update prose about image tag/name format
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
1 parent 6ed137f commit 2c6b804

File tree

1 file changed

+44
-32
lines changed

1 file changed

+44
-32
lines changed

docs/reference/commandline/image_tag.md

Lines changed: 44 additions & 32 deletions
10000
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,50 @@ Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
1212

1313
## Description
1414

15-
A full image name has the following format and components:
16-
17-
`[HOST[:PORT_NUMBER]/]PATH`
18-
19-
- `HOST`: The optional registry hostname specifies where the image is located.
20-
The hostname must comply with standard DNS rules, but may not contain
21-
underscores. If you don't specify a hostname, the command uses Docker's public
22-
registry at `registry-1.docker.io` by default. Note that `docker.io` is the
23-
canonical reference for Docker's public registry.
24-
- `PORT_NUMBER`: If a hostname is present, it may optionally be followed by a
25-
registry port number in the format `:8080`.
26-
- `PATH`: The path consists of slash-separated components. Each
27-
component may contain lowercase letters, digits and separators. A separator is
28-
defined as a period, one or two underscores, or one or more hyphens. A component
29-
may not start or end with a separator. While the
30-
[OCI Distribution Specification](https://github.com/opencontainers/distribution-spec)
31-
supports more than two slash-separated components, most registries only support
32-
two slash-separated components. For Docker's public registry, the path format is
33-
as follows:
34-
- `[NAMESPACE/]REPOSITORY`: The first, optional component is typically a
35-
user's or an organization's namespace. The second, mandatory component is the
36-
repository name. When the namespace is not present, Docker uses `library`
37-
as the default namespace.
38-
39-
After the image name, the optional `TAG` is a custom, human-readable manifest
40-
identifier that's typically a specific version or variant of an image. The tag
41-
must be valid ASCII and can contain lowercase and uppercase letters, digits,
42-
underscores, periods, and hyphens. It can't start with a period or hyphen and
43-
must be no longer than 128 characters. If you don't specify a tag, the command uses `latest` by default.
44-
45-
You can group your images together using names and tags, and then
46-
[push](image_push.md) them to a registry.
15+
A Docker image reference consists of several components that describe where the
16+
image is stored and its identity. These components are:
17+
18+
```text
19+
[HOST[:PORT]/]NAMESPACE/REPOSITORY[:TAG]
20+
```
21+
22+
`HOST`
23+
: Specifies the registry location where the image resides. If omitted, Docker
24+
defaults to Docker Hub (`docker.io`).
25+
26+
`PORT`
27+
: An optional port number for the registry, if necessary (for example, `:5000`).
28+
29+
`NAMESPACE/REPOSITORY`
30+
: The namespace (optional) usually represents a user or organization. The
31+
repository is required and identifies the specific image. If the namespace is
32+
omitted, Docker defaults to `library`, the namespace reserved for Docker
33+
Official Images.
34+
35+
`TAG`
36+
: An optional identifier used to specify a particular version or variant of the
37+
image. If no tag is provided, Docker defaults to `latest`.
38+
39+
### Example image references
40+
41+
`example.com:5000/team/my-app:2.0`
42+
43+
- Host: `example.com`
44+
- Port: `5000`
45+
- Namespace: `team`
46+
- Repository: `my-app`
47+
- Tag: `2.0`
48+
49+
`alpine`
50+
51+
- Host: `docker.io` (default)
52+
- Namespace: `library` (default)
53+
- Repository: `alpine`
54+
- Tag: `latest` (default)
55+
56+
For more information on the structure and rules of image naming, refer to the
57+
[Distribution reference](https://pkg.go.dev/github.com/distribution/reference#pkg-overview)
58+
as the canonical definition of the format.
4759

4860
## Examples
4961

0 commit comments

Comments
 (0)
0