> 技术文档 > Docker tag 命令:镜像标签管理的艺术_docker标签中的:1的用处

Docker tag 命令:镜像标签管理的艺术_docker标签中的:1的用处


Docker tag 命令:镜像标签管理的艺术

    • 1. Docker tag 命令概述
    • 2. 命令语法与参数详解
      • 2.1 基础语法
      • 2.2 参数解析表
    • 3. 核心功能与使用场景
      • 3.1 基础标签操作
      • 3.2 多标签管理
      • 3.3 发布准备流程
    • 4. 高级应用技巧
      • 4.1 基于镜像ID打标签
      • 4.2 批量标签操作
      • 4.3 标签命名规范建议
    • 5. 实战案例演示
      • 5.1 典型工作流示例
      • 5.2 多环境管理
    • 6. 常见问题与解决方案
      • Q1: 标签与镜像的关系是什么?
      • Q2: 如何删除不需要的标签?
      • Q3: 为什么修改标签后镜像大小不变?
      • Q4: 标签命名有哪些限制?
    • 7. 最佳实践总结

🌺The Begin🌺点点关注,收藏不迷路🌺

1. Docker tag 命令概述

docker tag 是 Docker 中用于创建镜像别名的核心命令,它允许我们为同一个镜像创建多个引用名称,是镜像版本管理和发布流程中的关键工具。

#mermaid-svg-v526CHu4bCBmmqh5 {font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-v526CHu4bCBmmqh5 .error-icon{fill:#552222;}#mermaid-svg-v526CHu4bCBmmqh5 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-v526CHu4bCBmmqh5 .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-v526CHu4bCBmmqh5 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-v526CHu4bCBmmqh5 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-v526CHu4bCBmmqh5 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-v526CHu4bCBmmqh5 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-v526CHu4bCBmmqh5 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-v526CHu4bCBmmqh5 .marker.cross{stroke:#333333;}#mermaid-svg-v526CHu4bCBmmqh5 svg{font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-v526CHu4bCBmmqh5 .label{font-family:\"trebuchet ms\",verdana,arial,sans-serif;color:#333;}#mermaid-svg-v526CHu4bCBmmqh5 .cluster-label text{fill:#333;}#mermaid-svg-v526CHu4bCBmmqh5 .cluster-label span{color:#333;}#mermaid-svg-v526CHu4bCBmmqh5 .label text,#mermaid-svg-v526CHu4bCBmmqh5 span{fill:#333;color:#333;}#mermaid-svg-v526CHu4bCBmmqh5 .node rect,#mermaid-svg-v526CHu4bCBmmqh5 .node circle,#mermaid-svg-v526CHu4bCBmmqh5 .node ellipse,#mermaid-svg-v526CHu4bCBmmqh5 .node polygon,#mermaid-svg-v526CHu4bCBmmqh5 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-v526CHu4bCBmmqh5 .node .label{text-align:center;}#mermaid-svg-v526CHu4bCBmmqh5 .node.clickable{cursor:pointer;}#mermaid-svg-v526CHu4bCBmmqh5 .arrowheadPath{fill:#333333;}#mermaid-svg-v526CHu4bCBmmqh5 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-v526CHu4bCBmmqh5 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-v526CHu4bCBmmqh5 .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-v526CHu4bCBmmqh5 .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-v526CHu4bCBmmqh5 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-v526CHu4bCBmmqh5 .cluster text{fill:#333;}#mermaid-svg-v526CHu4bCBmmqh5 .cluster span{color:#333;}#mermaid-svg-v526CHu4bCBmmqh5 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-v526CHu4bCBmmqh5 :root{--mermaid-font-family:\"trebuchet ms\",verdana,arial,sans-serif;} Docker tag 创建版本别名 准备发布镜像 组织镜像分类 多环境镜像管理

2. 命令语法与参数详解

2.1 基础语法

docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]

2.2 参数解析表

参数部分 是否必选 默认值 说明 SOURCE_IMAGE 必选 无 源镜像名称或ID :TAG 可选 latest 源镜像标签 TARGET_IMAGE 必选 无 目标镜像名称 :TAG 可选 latest 目标镜像标签

3. 核心功能与使用场景

3.1 基础标签操作

docker tag nginx:1.21 my-nginx:prod

#mermaid-svg-aPqEOZ6fw6jF6zyv {font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-aPqEOZ6fw6jF6zyv .error-icon{fill:#552222;}#mermaid-svg-aPqEOZ6fw6jF6zyv .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-aPqEOZ6fw6jF6zyv .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-aPqEOZ6fw6jF6zyv .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-aPqEOZ6fw6jF6zyv .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-aPqEOZ6fw6jF6zyv .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-aPqEOZ6fw6jF6zyv .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-aPqEOZ6fw6jF6zyv .marker{fill:#333333;stroke:#333333;}#mermaid-svg-aPqEOZ6fw6jF6zyv .marker.cross{stroke:#333333;}#mermaid-svg-aPqEOZ6fw6jF6zyv svg{font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-aPqEOZ6fw6jF6zyv .actor{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-aPqEOZ6fw6jF6zyv text.actor>tspan{fill:black;stroke:none;}#mermaid-svg-aPqEOZ6fw6jF6zyv .actor-line{stroke:grey;}#mermaid-svg-aPqEOZ6fw6jF6zyv .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333;}#mermaid-svg-aPqEOZ6fw6jF6zyv .messageLine1{stroke-width:1.5;stroke-dasharray:2,2;stroke:#333;}#mermaid-svg-aPqEOZ6fw6jF6zyv #arrowhead path{fill:#333;stroke:#333;}#mermaid-svg-aPqEOZ6fw6jF6zyv .sequenceNumber{fill:white;}#mermaid-svg-aPqEOZ6fw6jF6zyv #sequencenumber{fill:#333;}#mermaid-svg-aPqEOZ6fw6jF6zyv #crosshead path{fill:#333;stroke:#333;}#mermaid-svg-aPqEOZ6fw6jF6zyv .messageText{fill:#333;stroke:#333;}#mermaid-svg-aPqEOZ6fw6jF6zyv .labelBox{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-aPqEOZ6fw6jF6zyv .labelText,#mermaid-svg-aPqEOZ6fw6jF6zyv .labelText>tspan{fill:black;stroke:none;}#mermaid-svg-aPqEOZ6fw6jF6zyv .loopText,#mermaid-svg-aPqEOZ6fw6jF6zyv .loopText>tspan{fill:black;stroke:none;}#mermaid-svg-aPqEOZ6fw6jF6zyv .loopLine{stroke-width:2px;stroke-dasharray:2,2;stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-aPqEOZ6fw6jF6zyv .note{stroke:#aaaa33;fill:#fff5ad;}#mermaid-svg-aPqEOZ6fw6jF6zyv .noteText,#mermaid-svg-aPqEOZ6fw6jF6zyv .noteText>tspan{fill:black;stroke:none;}#mermaid-svg-aPqEOZ6fw6jF6zyv .activation0{fill:#f4f4f4;stroke:#666;}#mermaid-svg-aPqEOZ6fw6jF6zyv .activation1{fill:#f4f4f4;stroke:#666;}#mermaid-svg-aPqEOZ6fw6jF6zyv .activation2{fill:#f4f4f4;stroke:#666;}#mermaid-svg-aPqEOZ6fw6jF6zyv .actorPopupMenu{position:absolute;}#mermaid-svg-aPqEOZ6fw6jF6zyv .actorPopupMenuPanel{position:absolute;fill:#ECECFF;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);filter:drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));}#mermaid-svg-aPqEOZ6fw6jF6zyv .actor-man line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-aPqEOZ6fw6jF6zyv .actor-man circle,#mermaid-svg-aPqEOZ6fw6jF6zyv line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;stroke-width:2px;}#mermaid-svg-aPqEOZ6fw6jF6zyv :root{--mermaid-font-family:\"trebuchet ms\",verdana,arial,sans-serif;} User Docker docker tag nginx:1.21 my-nginx:prod 查找源镜像 创建新标签引用 返回执行结果 User Docker

执行结果验证

docker images

输出示例:

REPOSITORY TAG IMAGE ID CREATED SIZEnginx 1.21 7e4d58f0e5d3 2 weeks ago 133MBmy-nginx prod 7e4d58f0e5d3 2 weeks ago 133MB

3.2 多标签管理

docker tag myapp:2.1 myrepo/myapp:latestdocker tag myapp:2.1 myrepo/myapp:stabledocker tag myapp:2.1 myrepo/myapp:v2.1.0

架构关系

#mermaid-svg-gbI8cMPYG19hQRjU {font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-gbI8cMPYG19hQRjU .error-icon{fill:#552222;}#mermaid-svg-gbI8cMPYG19hQRjU .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-gbI8cMPYG19hQRjU .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-gbI8cMPYG19hQRjU .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-gbI8cMPYG19hQRjU .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-gbI8cMPYG19hQRjU .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-gbI8cMPYG19hQRjU .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-gbI8cMPYG19hQRjU .marker{fill:#333333;stroke:#333333;}#mermaid-svg-gbI8cMPYG19hQRjU .marker.cross{stroke:#333333;}#mermaid-svg-gbI8cMPYG19hQRjU svg{font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-gbI8cMPYG19hQRjU .label{font-family:\"trebuchet ms\",verdana,arial,sans-serif;color:#333;}#mermaid-svg-gbI8cMPYG19hQRjU .cluster-label text{fill:#333;}#mermaid-svg-gbI8cMPYG19hQRjU .cluster-label span{color:#333;}#mermaid-svg-gbI8cMPYG19hQRjU .label text,#mermaid-svg-gbI8cMPYG19hQRjU span{fill:#333;color:#333;}#mermaid-svg-gbI8cMPYG19hQRjU .node rect,#mermaid-svg-gbI8cMPYG19hQRjU .node circle,#mermaid-svg-gbI8cMPYG19hQRjU .node ellipse,#mermaid-svg-gbI8cMPYG19hQRjU .node polygon,#mermaid-svg-gbI8cMPYG19hQRjU .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-gbI8cMPYG19hQRjU .node .label{text-align:center;}#mermaid-svg-gbI8cMPYG19hQRjU .node.clickable{cursor:pointer;}#mermaid-svg-gbI8cMPYG19hQRjU .arrowheadPath{fill:#333333;}#mermaid-svg-gbI8cMPYG19hQRjU .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-gbI8cMPYG19hQRjU .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-gbI8cMPYG19hQRjU .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-gbI8cMPYG19hQRjU .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-gbI8cMPYG19hQRjU .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-gbI8cMPYG19hQRjU .cluster text{fill:#333;}#mermaid-svg-gbI8cMPYG19hQRjU .cluster span{color:#333;}#mermaid-svg-gbI8cMPYG19hQRjU div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-gbI8cMPYG19hQRjU :root{--mermaid-font-family:\"trebuchet ms\",verdana,arial,sans-serif;} myapp:2.1 myrepo/myapp:latest myrepo/myapp:stable myrepo/myapp:v2.1.0

3.3 发布准备流程

docker tag local-app:dev username/repo:1.0docker push username/repo:1.0

#mermaid-svg-wAjn5sMdyWlvfNxh {font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-wAjn5sMdyWlvfNxh .error-icon{fill:#552222;}#mermaid-svg-wAjn5sMdyWlvfNxh .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-wAjn5sMdyWlvfNxh .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-wAjn5sMdyWlvfNxh .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-wAjn5sMdyWlvfNxh .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-wAjn5sMdyWlvfNxh .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-wAjn5sMdyWlvfNxh .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-wAjn5sMdyWlvfNxh .marker{fill:#333333;stroke:#333333;}#mermaid-svg-wAjn5sMdyWlvfNxh .marker.cross{stroke:#333333;}#mermaid-svg-wAjn5sMdyWlvfNxh svg{font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-wAjn5sMdyWlvfNxh .label{font-family:\"trebuchet ms\",verdana,arial,sans-serif;color:#333;}#mermaid-svg-wAjn5sMdyWlvfNxh .cluster-label text{fill:#333;}#mermaid-svg-wAjn5sMdyWlvfNxh .cluster-label span{color:#333;}#mermaid-svg-wAjn5sMdyWlvfNxh .label text,#mermaid-svg-wAjn5sMdyWlvfNxh span{fill:#333;color:#333;}#mermaid-svg-wAjn5sMdyWlvfNxh .node rect,#mermaid-svg-wAjn5sMdyWlvfNxh .node circle,#mermaid-svg-wAjn5sMdyWlvfNxh .node ellipse,#mermaid-svg-wAjn5sMdyWlvfNxh .node polygon,#mermaid-svg-wAjn5sMdyWlvfNxh .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-wAjn5sMdyWlvfNxh .node .label{text-align:center;}#mermaid-svg-wAjn5sMdyWlvfNxh .node.clickable{cursor:pointer;}#mermaid-svg-wAjn5sMdyWlvfNxh .arrowheadPath{fill:#333333;}#mermaid-svg-wAjn5sMdyWlvfNxh .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-wAjn5sMdyWlvfNxh .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-wAjn5sMdyWlvfNxh .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-wAjn5sMdyWlvfNxh .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-wAjn5sMdyWlvfNxh .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-wAjn5sMdyWlvfNxh .cluster text{fill:#333;}#mermaid-svg-wAjn5sMdyWlvfNxh .cluster span{color:#333;}#mermaid-svg-wAjn5sMdyWlvfNxh div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-wAjn5sMdyWlvfNxh :root{--mermaid-font-family:\"trebuchet ms\",verdana,arial,sans-serif;} 远程仓库 本地环境 推送镜像 打标签 构建镜像

4. 高级应用技巧

4.1 基于镜像ID打标签

docker tag a1b2c3d4 myregistry:5000/myimage:test

优势:当不知道镜像名称但知道ID时特别有用

4.2 批量标签操作

# 为所有1.8版本的镜像打上stable标签docker images | grep \'1.8\' | awk \'{print $1\":\"$2}\' | xargs -I {} docker tag {} {}-stable

4.3 标签命名规范建议

  1. 版本标签:v..
  2. 环境标签:dev/test/staging/prod
  3. 特性标签:with-jdk/with-python

5. 实战案例演示

5.1 典型工作流示例

# 1. 构建初始镜像docker build -t my-service:0.1 .# 2. 测试通过后打稳定版标签docker tag my-service:0.1 my-service:stable# 3. 准备发布到私有仓库docker tag my-service:0.1 registry.example.com/my-service:1.0# 4. 推送镜像docker push registry.example.com/my-service:1.0

5.2 多环境管理

# 开发环境docker tag app-core:build app-core:dev# 测试环境docker tag app-core:build app-core:test# 生产环境docker tag app-core:build app-core:prod

Docker tag 命令:镜像标签管理的艺术_docker标签中的:1的用处

6. 常见问题与解决方案

Q1: 标签与镜像的关系是什么?

A: 标签只是镜像的别名,多个标签可以指向同一个镜像ID,不会占用额外存储空间。

Q2: 如何删除不需要的标签?

A: 使用docker rmi命令指定完整标签名:

docker rmi myrepo/myimage:unwanted-tag

Q3: 为什么修改标签后镜像大小不变?

A: 因为标签只是引用,不是真正的镜像副本。所有标签共享相同的镜像层。

Q4: 标签命名有哪些限制?

A: 必须符合以下规则:

  • 只允许小写字母、数字、连字符(-)、下划线(_)和点(.)
  • 必须以字母或数字开头和结尾
  • 最大长度255字符

7. 最佳实践总结

  1. 语义化版本控制:采用..的标签策略
  2. 环境区分:使用-dev-test-prod等后缀区分环境
  3. 发布前验证:推送前检查标签是否正确
  4. 定期清理:删除不再使用的临时标签
  5. 命名一致性:团队统一标签命名规范

标签生命周期管理建议

#mermaid-svg-dyvCU6ghhq5f7NSJ {font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-dyvCU6ghhq5f7NSJ .error-icon{fill:#552222;}#mermaid-svg-dyvCU6ghhq5f7NSJ .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-dyvCU6ghhq5f7NSJ .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-dyvCU6ghhq5f7NSJ .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-dyvCU6ghhq5f7NSJ .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-dyvCU6ghhq5f7NSJ .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-dyvCU6ghhq5f7NSJ .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-dyvCU6ghhq5f7NSJ .marker{fill:#333333;stroke:#333333;}#mermaid-svg-dyvCU6ghhq5f7NSJ .marker.cross{stroke:#333333;}#mermaid-svg-dyvCU6ghhq5f7NSJ svg{font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-dyvCU6ghhq5f7NSJ .mermaid-main-font{font-family:\"trebuchet ms\",verdana,arial,sans-serif;font-family:var(--mermaid-font-family);}#mermaid-svg-dyvCU6ghhq5f7NSJ .exclude-range{fill:#eeeeee;}#mermaid-svg-dyvCU6ghhq5f7NSJ .section{stroke:none;opacity:0.2;}#mermaid-svg-dyvCU6ghhq5f7NSJ .section0{fill:rgba(102, 102, 255, 0.49);}#mermaid-svg-dyvCU6ghhq5f7NSJ .section2{fill:#fff400;}#mermaid-svg-dyvCU6ghhq5f7NSJ .section1,#mermaid-svg-dyvCU6ghhq5f7NSJ .section3{fill:white;opacity:0.2;}#mermaid-svg-dyvCU6ghhq5f7NSJ .sectionTitle0{fill:#333;}#mermaid-svg-dyvCU6ghhq5f7NSJ .sectionTitle1{fill:#333;}#mermaid-svg-dyvCU6ghhq5f7NSJ .sectionTitle2{fill:#333;}#mermaid-svg-dyvCU6ghhq5f7NSJ .sectionTitle3{fill:#333;}#mermaid-svg-dyvCU6ghhq5f7NSJ .sectionTitle{text-anchor:start;font-family:\'trebuchet ms\',verdana,arial,sans-serif;font-family:var(--mermaid-font-family);}#mermaid-svg-dyvCU6ghhq5f7NSJ .grid .tick{stroke:lightgrey;opacity:0.8;shape-rendering:crispEdges;}#mermaid-svg-dyvCU6ghhq5f7NSJ .grid .tick text{font-family:\"trebuchet ms\",verdana,arial,sans-serif;fill:#333;}#mermaid-svg-dyvCU6ghhq5f7NSJ .grid path{stroke-width:0;}#mermaid-svg-dyvCU6ghhq5f7NSJ .today{fill:none;stroke:red;stroke-width:2px;}#mermaid-svg-dyvCU6ghhq5f7NSJ .task{stroke-width:2;}#mermaid-svg-dyvCU6ghhq5f7NSJ .taskText{text-anchor:middle;font-family:\'trebuchet ms\',verdana,arial,sans-serif;font-family:var(--mermaid-font-family);}#mermaid-svg-dyvCU6ghhq5f7NSJ .taskTextOutsideRight{fill:black;text-anchor:start;font-family:\'trebuchet ms\',verdana,arial,sans-serif;font-family:var(--mermaid-font-family);}#mermaid-svg-dyvCU6ghhq5f7NSJ .taskTextOutsideLeft{fill:black;text-anchor:end;}#mermaid-svg-dyvCU6ghhq5f7NSJ .task.clickable{cursor:pointer;}#mermaid-svg-dyvCU6ghhq5f7NSJ .taskText.clickable{cursor:pointer;fill:#003163!important;font-weight:bold;}#mermaid-svg-dyvCU6ghhq5f7NSJ .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163!important;font-weight:bold;}#mermaid-svg-dyvCU6ghhq5f7NSJ .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163!important;font-weight:bold;}#mermaid-svg-dyvCU6ghhq5f7NSJ .taskText0,#mermaid-svg-dyvCU6ghhq5f7NSJ .taskText1,#mermaid-svg-dyvCU6ghhq5f7NSJ .taskText2,#mermaid-svg-dyvCU6ghhq5f7NSJ .taskText3{fill:white;}#mermaid-svg-dyvCU6ghhq5f7NSJ .task0,#mermaid-svg-dyvCU6ghhq5f7NSJ .task1,#mermaid-svg-dyvCU6ghhq5f7NSJ .task2,#mermaid-svg-dyvCU6ghhq5f7NSJ .task3{fill:#8a90dd;stroke:#534fbc;}#mermaid-svg-dyvCU6ghhq5f7NSJ .taskTextOutside0,#mermaid-svg-dyvCU6ghhq5f7NSJ .taskTextOutside2{fill:black;}#mermaid-svg-dyvCU6ghhq5f7NSJ .taskTextOutside1,#mermaid-svg-dyvCU6ghhq5f7NSJ .taskTextOutside3{fill:black;}#mermaid-svg-dyvCU6ghhq5f7NSJ .active0,#mermaid-svg-dyvCU6ghhq5f7NSJ .active1,#mermaid-svg-dyvCU6ghhq5f7NSJ .active2,#mermaid-svg-dyvCU6ghhq5f7NSJ .active3{fill:#bfc7ff;stroke:#534fbc;}#mermaid-svg-dyvCU6ghhq5f7NSJ .activeText0,#mermaid-svg-dyvCU6ghhq5f7NSJ .activeText1,#mermaid-svg-dyvCU6ghhq5f7NSJ .activeText2,#mermaid-svg-dyvCU6ghhq5f7NSJ .activeText3{fill:black!important;}#mermaid-svg-dyvCU6ghhq5f7NSJ .done0,#mermaid-svg-dyvCU6ghhq5f7NSJ .done1,#mermaid-svg-dyvCU6ghhq5f7NSJ .done2,#mermaid-svg-dyvCU6ghhq5f7NSJ .done3{stroke:grey;fill:lightgrey;stroke-width:2;}#mermaid-svg-dyvCU6ghhq5f7NSJ .doneText0,#mermaid-svg-dyvCU6ghhq5f7NSJ .doneText1,#mermaid-svg-dyvCU6ghhq5f7NSJ .doneText2,#mermaid-svg-dyvCU6ghhq5f7NSJ .doneText3{fill:black!important;}#mermaid-svg-dyvCU6ghhq5f7NSJ .crit0,#mermaid-svg-dyvCU6ghhq5f7NSJ .crit1,#mermaid-svg-dyvCU6ghhq5f7NSJ .crit2,#mermaid-svg-dyvCU6ghhq5f7NSJ .crit3{stroke:#ff8888;fill:red;stroke-width:2;}#mermaid-svg-dyvCU6ghhq5f7NSJ .activeCrit0,#mermaid-svg-dyvCU6ghhq5f7NSJ .activeCrit1,#mermaid-svg-dyvCU6ghhq5f7NSJ .activeCrit2,#mermaid-svg-dyvCU6ghhq5f7NSJ .activeCrit3{stroke:#ff8888;fill:#bfc7ff;stroke-width:2;}#mermaid-svg-dyvCU6ghhq5f7NSJ .doneCrit0,#mermaid-svg-dyvCU6ghhq5f7NSJ .doneCrit1,#mermaid-svg-dyvCU6ghhq5f7NSJ .doneCrit2,#mermaid-svg-dyvCU6ghhq5f7NSJ .doneCrit3{stroke:#ff8888;fill:lightgrey;stroke-width:2;cursor:pointer;shape-rendering:crispEdges;}#mermaid-svg-dyvCU6ghhq5f7NSJ .milestone{transform:rotate(45deg) scale(0.8,0.8);}#mermaid-svg-dyvCU6ghhq5f7NSJ .milestoneText{font-style:italic;}#mermaid-svg-dyvCU6ghhq5f7NSJ .doneCritText0,#mermaid-svg-dyvCU6ghhq5f7NSJ .doneCritText1,#mermaid-svg-dyvCU6ghhq5f7NSJ .doneCritText2,#mermaid-svg-dyvCU6ghhq5f7NSJ .doneCritText3{fill:black!important;}#mermaid-svg-dyvCU6ghhq5f7NSJ .activeCritText0,#mermaid-svg-dyvCU6ghhq5f7NSJ .activeCritText1,#mermaid-svg-dyvCU6ghhq5f7NSJ .activeCritText2,#mermaid-svg-dyvCU6ghhq5f7NSJ .activeCritText3{fill:black!important;}#mermaid-svg-dyvCU6ghhq5f7NSJ .titleText{text-anchor:middle;font-size:18px;fill:#333;font-family:\'trebuchet ms\',verdana,arial,sans-serif;font-family:var(--mermaid-font-family);}#mermaid-svg-dyvCU6ghhq5f7NSJ :root{--mermaid-font-family:\"trebuchet ms\",verdana,arial,sans-serif;} 2023-01-01 2023-01-03 2023-01-05 2023-01-07 2023-01-09 2023-01-11 2023-01-13 2023-01-15 构建镜像 打测试标签 打预发布标签 打正式版标签 归档旧版本 开发阶段 测试阶段 生产阶段 镜像标签生命周期

通过掌握docker tag命令,开发者可以:

  • 更高效地管理镜像版本
  • 实现多环境镜像部署
  • 规范团队协作流程
  • 优化持续集成/持续部署(CI/CD)流水线

记住:良好的标签策略是高效容器化运维的基础!

在这里插入图片描述

🌺The End🌺点点关注,收藏不迷路🌺