Home  >  Article  >  Operation and Maintenance  >  What is the docker tag used for?

What is the docker tag used for?

WBOY
WBOYOriginal
2022-07-14 11:27:148878browse

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]".

What is the docker tag used for?

The operating environment of this tutorial: linux7.3 system, docker version 19.03, Dell G3 computer.

What is the docker tag used for?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn