forked from docker/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker_image_tag.yaml
More file actions
107 lines (83 loc) · 3.07 KB
/
Copy pathdocker_image_tag.yaml
File metadata and controls
107 lines (83 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
command: docker image tag
aliases: docker image tag, docker tag
short: Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
long: |-
A Docker image reference consists of several components that describe where the
image is stored and its identity. These components are:
```text
[HOST[:PORT]/]NAMESPACE/REPOSITORY[:TAG]
```
`HOST`
: Specifies the registry location where the image resides. If omitted, Docker
defaults to Docker Hub (`docker.io`).
`PORT`
: An optional port number for the registry, if necessary (for example, `:5000`).
`NAMESPACE/REPOSITORY`
: The namespace (optional) usually represents a user or organization. The
repository is required and identifies the specific image. If the namespace is
omitted, Docker defaults to `library`, the namespace reserved for Docker
Official Images.
`TAG`
: An optional identifier used to specify a particular version or variant of the
image. If no tag is provided, Docker defaults to `latest`.
### Example image references
`example.com:5000/team/my-app:2.0`
- Host: `example.com`
- Port: `5000`
- Namespace: `team`
- Repository: `my-app`
- Tag: `2.0`
`alpine`
- Host: `docker.io` (default)
- Namespace: `library` (default)
- Repository: `alpine`
- Tag: `latest` (default)
For more information on the structure and rules of image naming, refer to the
[Distribution reference](https://pkg.go.dev/github.com/distribution/reference#pkg-overview)
as the canonical definition of the format.
usage: docker image tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
pname: docker image
plink: docker_image.yaml
inherited_options:
- option: help
value_type: bool
default_value: "false"
description: Print usage
deprecated: false
hidden: true
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
examples: |-
### Tag an image referenced by ID
To tag a local image with ID `0e5574283393` as `fedora/httpd` with the tag
`version1.0`:
```console
$ docker tag 0e5574283393 fedora/httpd:version1.0
```
### Tag an image referenced by Name
To tag a local image `httpd` as `fedora/httpd` with the tag `version1.0`:
```console
$ docker tag httpd fedora/httpd:version1.0
```
Note that since the tag name isn't specified, the alias is created for an
existing local version `httpd:latest`.
### Tag an image referenced by Name and Tag
To tag a local image with the name `httpd` and the tag `test` as `fedora/httpd`
with the tag `version1.0.test`:
```console
$ docker tag httpd:test fedora/httpd:version1.0.test
```
### Tag an image for a private registry
To push an image to a private registry and not the public Docker registry you
must include the registry hostname and port (if needed).
```console
$ docker tag 0e5574283393 myregistryhost:5000/fedora/httpd:version1.0
```
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false