Home > Article > Operation and Maintenance > What is the docker tag used for?
In docker, tag is a command used to mark a local image and classify it into a certain warehouse; this command can be used to tag the image, and the syntax is "docker tag [OPTIONS] IMAGE[: TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]".
The operating environment of this tutorial: linux7.3 system, docker version 19.03, Dell G3 computer.
docker tag: Mark the local image and classify it into a certain warehouse.
Syntax
docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]
Example
Mark the image ubuntu:15.10 as a runoob/ubuntu:v3 image.
root@runoob:~# docker tag ubuntu:15.10 runoob/ubuntu:v3 root@runoob:~# docker images runoob/ubuntu:v3 REPOSITORY TAG IMAGE ID CREATED SIZE runoob/ubuntu v3 4e3b13c8a266 3 months ago 136.3 MB
The detailed explanation is as follows
Mirroring through ID tag
The following is a local mirror with an ID of 0e5574283393 to the "fedora" repository, the tag name version1.0:
docker tag 0e5574283393 fedora/httpd:version1.0
Mirroring by name tag
Use the name "httpd" tag to locally mirror to the repository "fedora", and its tag name is version1.0
docker tag httpd fedora/httpd:version1.0
Note that since the tag name referencing httpd is not specified, httpd:latest is referenced by default.
Tag an image by name and tag name
Make a label for the local image named httpd and tag name test. Its repository is fedora and the label name is version1.0.test.
docker tag httpd:test fedora/httpd:version1.0.test
tag an image to a private repository
To push an image to a private registry, rather than a public docker registry, you must specify a registry host name and port to tag the image.
docker tag 0e5574283393 myregistryhost:5000/fedora/httpd:version1.0
Recommended learning: "docker video tutorial"
The above is the detailed content of What is the docker tag used for?. For more information, please follow other related articles on the PHP Chinese website!