Skip to content

Commit 4119d26

Browse files
Update tag docs to clarify name
Signed-off-by: Craig Osterhout <craig.osterhout@docker.com>
1 parent 26a7357 commit 4119d26

1 file changed

Lines changed: 41 additions & 24 deletions

File tree

  • docs/reference/commandline

docs/reference/commandline/tag.md

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,45 @@ Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
1212

1313
## Description
1414

15-
An image name is made up of slash-separated name components, optionally prefixed
16-
by a registry hostname. The hostname must comply with standard DNS rules, but
17-
may not contain underscores. If a hostname is present, it may optionally be
18-
followed by a port number in the format `:8080`. If not present, the command
19-
uses Docker's public registry located at `registry-1.docker.io` by default. Name
20-
components may contain lowercase letters, digits and separators. A separator
21-
is defined as a period, one or two underscores, or one or more hyphens. A name
22-
component may not start or end with a separator.
23-
24-
A tag name must be valid ASCII and may contain lowercase and uppercase letters,
25-
digits, underscores, periods and hyphens. A tag name may not start with a
26-
period or a hyphen and may contain a maximum of 128 characters.
27-
28-
You can group your images together using names and tags, and then upload them
29-
to [*Share images on Docker Hub*](https://docs.docker.com/get-started/part3/).
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 the hostname is not specified, 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 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 is 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 cannot start with a period or hyphen and
43+
must be no longer than 128 characters. If the tag is not specified, the command uses `latest` by default.
44+
45+
You can group your images together using names and tags, and then
46+
[push](https://docs.docker.com/engine/reference/commandline/push) them to a
47+
registry.
3048

3149
## Examples
3250

3351
### Tag an image referenced by ID
3452

35-
To tag a local image with ID "0e5574283393" into the "fedora" repository with
53+
To tag a local image with ID "0e5574283393" as "fedora/httpd" with the tag
3654
"version1.0":
3755

3856
```console
@@ -41,8 +59,7 @@ $ docker tag 0e5574283393 fedora/httpd:version1.0
4159

4260
### Tag an image referenced by Name
4361

44-
To tag a local image with name "httpd" into the "fedora" repository with
45-
"version1.0":
62+
To tag a local image "httpd" as "fedora/httpd" with the tag "version1.0":
4663

4764
```console
4865
$ docker tag httpd fedora/httpd:version1.0
@@ -53,18 +70,18 @@ existing local version `httpd:latest`.
5370

5471
### Tag an image referenced by Name and Tag
5572

56-
To tag a local image with name "httpd" and tag "test" into the "fedora"
57-
repository with "version1.0.test":
73+
To tag a local image with the name "httpd" and the tag "test" as "fedora/httpd"
74+
with the tag "version1.0.test":
5875

5976
```console
6077
$ docker tag httpd:test fedora/httpd:version1.0.test
6178
```
6279

63-
### Tag an image for a private repository
80+
### Tag an image for a private registry
6481

65-
To push an image to a private registry and not the central Docker
66-
registry you must tag it with the registry hostname and port (if needed).
82+
To push an image to a private registry and not the public Docker registry you
83+
must include the registry hostname and port (if needed).
6784

6885
```console
6986
$ docker tag 0e5574283393 myregistryhost:5000/fedora/httpd:version1.0
70-
```
87+
```

0 commit comments

Comments
 (0)