Fix and improve

This commit is contained in:
Baohua Yang
2026-02-12 16:51:50 -08:00
parent bae82e993a
commit 0835f8467a
100 changed files with 280 additions and 622 deletions

View File

@@ -2,8 +2,6 @@
### 基本语法
具体内容如下
```docker
LABEL <key>=<value> <key>=<value> ...
```
@@ -25,8 +23,6 @@ LABEL <key>=<value> <key>=<value> ...
#### 定义单个标签
具体内容如下
```docker
LABEL version="1.0"
LABEL description="这是一个 Web 应用服务器"
@@ -34,8 +30,6 @@ LABEL description="这是一个 Web 应用服务器"
#### 定义多个标签推荐
具体内容如下
```docker
LABEL maintainer="user@example.com" \
version="1.2.0" \
@@ -65,8 +59,6 @@ LABEL maintainer="user@example.com" \
#### 示例
具体内容如下
```docker
LABEL org.opencontainers.image.authors="yeasy" \
org.opencontainers.image.documentation="https://yeasy.gitbooks.io" \
@@ -101,7 +93,7 @@ LABEL org.opencontainers.image.authors="user@example.com"
### 动态标签
配合 `ARG` 使用可以在构建时动态注入标签
配合 `ARG` 使用可以在构建时动态注入标签
```docker
ARG BUILD_DATE
@@ -164,4 +156,4 @@ $ docker rmi $(docker images -q --filter "label=stage=builder")
### 延伸阅读
- [OCI 标签规范](https://github.com/opencontainers/image-spec/blob/main/annotations.md)
- [Dockerfile 最佳实践](../../16_appendix/16.1_best_practices.md)
- [Dockerfile 最佳实践](../16_appendix/16.1_best_practices.md)