mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-03-10 20:04:36 +00:00
Fix and improve
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user