- Add link to valid image name and tag formats in referenced files
- Per review comments, updated docs to remove reference to `USERNAME` and
`REGISTRYHOST`.
- Per review comment, removed links from man page.
- Per review comment, added and updated examples on `docker tag`
Signed-off-by: Subhajit Ghosh <isubuz.g@gmail.com>
| ... | ... |
@@ -225,7 +225,8 @@ uploaded context. The builder reference contains detailed information on |
| 225 | 225 |
$ docker build -t vieux/apache:2.0 . |
| 226 | 226 |
|
| 227 | 227 |
This will build like the previous example, but it will then tag the resulting |
| 228 |
-image. The repository name will be `vieux/apache` and the tag will be `2.0` |
|
| 228 |
+image. The repository name will be `vieux/apache` and the tag will be `2.0`. |
|
| 229 |
+[Read more about valid tags](tag.md). |
|
| 229 | 230 |
|
| 230 | 231 |
You can apply multiple tags to an image. For example, you can apply the `latest` |
| 231 | 232 |
tag to a newly built image and add another tag that references a specific |
| ... | ... |
@@ -24,6 +24,7 @@ It can be useful to commit a container's file changes or settings into a new |
| 24 | 24 |
image. This allows you debug a container by running an interactive shell, or to |
| 25 | 25 |
export a working dataset to another server. Generally, it is better to use |
| 26 | 26 |
Dockerfiles to manage your images in a documented and maintainable way. |
| 27 |
+[Read more about valid image names and tags](tag.md). |
|
| 27 | 28 |
|
| 28 | 29 |
The commit operation will not include any data contained in |
| 29 | 30 |
volumes mounted inside the container. |
| ... | ... |
@@ -19,6 +19,7 @@ parent = "smn_cli" |
| 19 | 19 |
|
| 20 | 20 |
Use `docker push` to share your images to the [Docker Hub](https://hub.docker.com) |
| 21 | 21 |
registry or to a self-hosted one. |
| 22 |
+[Read more about valid image names and tags](tag.md). |
|
| 22 | 23 |
|
| 23 | 24 |
Killing the `docker push` process, for example by pressing `CTRL-c` while it is |
| 24 | 25 |
running in a terminal, will terminate the push operation. |
| ... | ... |
@@ -10,11 +10,57 @@ parent = "smn_cli" |
| 10 | 10 |
|
| 11 | 11 |
# tag |
| 12 | 12 |
|
| 13 |
- Usage: docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG] |
|
| 13 |
+ Usage: docker tag [OPTIONS] NAME[:TAG] NAME[:TAG] |
|
| 14 | 14 |
|
| 15 | 15 |
Tag an image into a repository |
| 16 | 16 |
|
| 17 | 17 |
--help Print usage |
| 18 | 18 |
|
| 19 |
+An image name is made up of slash-separated name components, optionally prefixed |
|
| 20 |
+by a registry hostname. The hostname must comply with standard DNS rules, but |
|
| 21 |
+may not contain underscores. If a hostname is present, it may optionally be |
|
| 22 |
+followed by a port number in the format `:8080`. If not present, the command |
|
| 23 |
+uses Docker's public registry located at `registry-1.docker.io` by default. Name |
|
| 24 |
+components may contain lowercase characters, digits and separators. A separator |
|
| 25 |
+is defined as a period, one or two underscores, or one or more dashes. A name |
|
| 26 |
+component may not start or end with a separator. |
|
| 27 |
+ |
|
| 28 |
+A tag name may contain lowercase and uppercase characters, digits, underscores, |
|
| 29 |
+periods and dashes. A tag name may not start with a period or a dash and may |
|
| 30 |
+contain a maximum of 128 characters. |
|
| 31 |
+ |
|
| 19 | 32 |
You can group your images together using names and tags, and then upload them |
| 20 | 33 |
to [*Share Images via Repositories*](../../userguide/containers/dockerrepos.md#contributing-to-docker-hub). |
| 34 |
+ |
|
| 35 |
+# Examples |
|
| 36 |
+ |
|
| 37 |
+## Tagging an image referenced by ID |
|
| 38 |
+ |
|
| 39 |
+To tag a local image with ID "0e5574283393" into the "fedora" repository with |
|
| 40 |
+"version1.0": |
|
| 41 |
+ |
|
| 42 |
+ docker tag 0e5574283393 fedora/httpd:version1.0 |
|
| 43 |
+ |
|
| 44 |
+## Tagging an image referenced by Name |
|
| 45 |
+ |
|
| 46 |
+To tag a local image with name "httpd" into the "fedora" repository with |
|
| 47 |
+"version1.0": |
|
| 48 |
+ |
|
| 49 |
+ docker tag httpd fedora/httpd:version1.0 |
|
| 50 |
+ |
|
| 51 |
+Note that since the tag name is not specified, the alias is created for an |
|
| 52 |
+existing local version `httpd:latest`. |
|
| 53 |
+ |
|
| 54 |
+## Tagging an image referenced by Name and Tag |
|
| 55 |
+ |
|
| 56 |
+To tag a local image with name "httpd" and tag "test" into the "fedora" |
|
| 57 |
+repository with "version1.0.test": |
|
| 58 |
+ |
|
| 59 |
+ docker tag httpd:test fedora/httpd:version1.0.test |
|
| 60 |
+ |
|
| 61 |
+## Tagging an image for a private repository |
|
| 62 |
+ |
|
| 63 |
+To push an image to a private registry and not the central Docker |
|
| 64 |
+registry you must tag it with the registry hostname and port (if needed). |
|
| 65 |
+ |
|
| 66 |
+ docker tag 0e5574283393 myregistryhost:5000/fedora/httpd:version1.0 |
| ... | ... |
@@ -91,7 +91,9 @@ set as the **URL**, the repository is cloned locally and then sent as the contex |
| 91 | 91 |
Remove intermediate containers after a successful build. The default is *true*. |
| 92 | 92 |
|
| 93 | 93 |
**-t**, **--tag**="" |
| 94 |
- Repository names (and optionally with tags) to be applied to the resulting image in case of success. |
|
| 94 |
+ Repository names (and optionally with tags) to be applied to the resulting |
|
| 95 |
+ image in case of success. Refer to **docker-tag(1)** for more information |
|
| 96 |
+ about valid tag names. |
|
| 95 | 97 |
|
| 96 | 98 |
**-m**, **--memory**=*MEMORY* |
| 97 | 99 |
Memory limit |
| ... | ... |
@@ -16,7 +16,8 @@ CONTAINER [REPOSITORY[:TAG]] |
| 16 | 16 |
# DESCRIPTION |
| 17 | 17 |
Create a new image from an existing container specified by name or |
| 18 | 18 |
container ID. The new image will contain the contents of the |
| 19 |
-container filesystem, *excluding* any data volumes. |
|
| 19 |
+container filesystem, *excluding* any data volumes. Refer to **docker-tag(1)** |
|
| 20 |
+for more information about valid image and tag names. |
|
| 20 | 21 |
|
| 21 | 22 |
While the `docker commit` command is a convenient way of extending an |
| 22 | 23 |
existing image, you should prefer the use of a Dockerfile and `docker |
| ... | ... |
@@ -13,7 +13,8 @@ NAME[:TAG] | [REGISTRY_HOST[:REGISTRY_PORT]/]NAME[:TAG] |
| 13 | 13 |
|
| 14 | 14 |
This command pushes an image or a repository to a registry. If you do not |
| 15 | 15 |
specify a `REGISTRY_HOST`, the command uses Docker's public registry located at |
| 16 |
-`registry-1.docker.io` by default. |
|
| 16 |
+`registry-1.docker.io` by default. Refer to **docker-tag(1)** for more |
|
| 17 |
+information about valid image and tag names. |
|
| 17 | 18 |
|
| 18 | 19 |
# OPTIONS |
| 19 | 20 |
**--help** |
| ... | ... |
@@ -7,44 +7,59 @@ docker-tag - Tag an image into a repository |
| 7 | 7 |
# SYNOPSIS |
| 8 | 8 |
**docker tag** |
| 9 | 9 |
[**--help**] |
| 10 |
-IMAGE[:TAG] [REGISTRY_HOST/][USERNAME/]NAME[:TAG] |
|
| 10 |
+NAME[:TAG] NAME[:TAG] |
|
| 11 | 11 |
|
| 12 | 12 |
# DESCRIPTION |
| 13 | 13 |
Assigns a new alias to an image in a registry. An alias refers to the |
| 14 | 14 |
entire image name including the optional `TAG` after the ':'. |
| 15 | 15 |
|
| 16 |
-If you do not specify a `REGISTRY_HOST`, the command uses Docker's public |
|
| 17 |
-registry located at `registry-1.docker.io` by default. |
|
| 18 |
- |
|
| 19 | 16 |
# "OPTIONS" |
| 20 | 17 |
**--help** |
| 21 | 18 |
Print usage statement. |
| 22 | 19 |
|
| 23 |
-**REGISTRY_HOST** |
|
| 24 |
- The hostname of the registry if required. This may also include the port |
|
| 25 |
-separated by a ':' |
|
| 26 |
- |
|
| 27 |
-**USERNAME** |
|
| 28 |
- The username or other qualifying identifier for the image. |
|
| 29 |
- |
|
| 30 | 20 |
**NAME** |
| 31 |
- The image name. |
|
| 21 |
+ The image name which is made up of slash-separated name components, |
|
| 22 |
+ optionally prefixed by a registry hostname. The hostname must comply with |
|
| 23 |
+ standard DNS rules, but may not contain underscores. If a hostname is |
|
| 24 |
+ present, it may optionally be followed by a port number in the format |
|
| 25 |
+ `:8080`. If not present, the command uses Docker's public registry located at |
|
| 26 |
+ `registry-1.docker.io` by default. Name components may contain lowercase |
|
| 27 |
+ characters, digits and separators. A separator is defined as a period, one or |
|
| 28 |
+ two underscores, or one or more dashes. A name component may not start or end |
|
| 29 |
+ with a separator. |
|
| 32 | 30 |
|
| 33 | 31 |
**TAG** |
| 34 |
- The tag you are assigning to the image. Though this is arbitrary it is |
|
| 35 |
-recommended to be used for a version to distinguish images with the same name. |
|
| 36 |
-Also, for consistency tags should only include a-z0-9-_. . |
|
| 37 |
-Note that here TAG is a part of the overall name or "tag". |
|
| 32 |
+ The tag assigned to the image to version and distinguish images with the same |
|
| 33 |
+ name. The tag name may contain lowercase and uppercase characters, digits, |
|
| 34 |
+ underscores, periods and dashes. A tag name may not start with a period or a |
|
| 35 |
+ dash and may contain a maximum of 128 characters. |
|
| 38 | 36 |
|
| 39 | 37 |
# EXAMPLES |
| 40 | 38 |
|
| 41 |
-## Giving an image a new alias |
|
| 39 |
+## Tagging an image referenced by ID |
|
| 42 | 40 |
|
| 43 |
-Here is an example of aliasing an image (e.g., 0e5574283393) as "httpd" and |
|
| 44 |
-tagging it into the "fedora" repository with "version1.0": |
|
| 41 |
+To tag a local image with ID "0e5574283393" into the "fedora" repository with |
|
| 42 |
+"version1.0": |
|
| 45 | 43 |
|
| 46 | 44 |
docker tag 0e5574283393 fedora/httpd:version1.0 |
| 47 | 45 |
|
| 46 |
+## Tagging an image referenced by Name |
|
| 47 |
+ |
|
| 48 |
+To tag a local image with name "httpd" into the "fedora" repository with |
|
| 49 |
+"version1.0": |
|
| 50 |
+ |
|
| 51 |
+ docker tag httpd fedora/httpd:version1.0 |
|
| 52 |
+ |
|
| 53 |
+Note that since the tag name is not specified, the alias is created for an |
|
| 54 |
+existing local version `httpd:latest`. |
|
| 55 |
+ |
|
| 56 |
+## Tagging an image referenced by Name and Tag |
|
| 57 |
+ |
|
| 58 |
+To tag a local image with name "httpd" and tag "test" into the "fedora" |
|
| 59 |
+repository with "version1.0.test": |
|
| 60 |
+ |
|
| 61 |
+ docker tag httpd:test fedora/httpd:version1.0.test |
|
| 62 |
+ |
|
| 48 | 63 |
## Tagging an image for a private repository |
| 49 | 64 |
|
| 50 | 65 |
To push an image to a private registry and not the central Docker |