Remove blank lines after code block markers

This commit is contained in:
yeasy
2026-03-21 22:36:09 -07:00
parent 312f8fea42
commit 9ac19d79ee
132 changed files with 0 additions and 1517 deletions

View File

@@ -5,7 +5,6 @@
```docker
LABEL <key>=<value> <key>=<value> ...
```
`LABEL` 指令以键值对的形式给镜像添加元数据这些数据不会影响镜像的功能但可以帮助用户理解镜像或被自动化工具使用
---
@@ -27,7 +26,6 @@ LABEL <key>=<value> <key>=<value> ...
LABEL version="1.0"
LABEL description="这是一个 Web 应用服务器"
```
#### 定义多个标签推荐
```docker
@@ -36,7 +34,6 @@ LABEL maintainer="user@example.com" \
description="My App Description" \
org.opencontainers.image.authors="Yeasy"
```
> 💡 包含空格的值需要用引号括起来
---
@@ -65,7 +62,6 @@ LABEL org.opencontainers.image.authors="yeasy" \
org.opencontainers.image.source="https://github.com/yeasy/docker_practice" \
org.opencontainers.image.licenses="MIT"
```
---
### 7.14.5 MAINTAINER 指令已废弃
@@ -73,16 +69,13 @@ LABEL org.opencontainers.image.authors="yeasy" \
旧版本的 Dockerfile 中常看到 `MAINTAINER` 指令
```docker
## ❌ 已弃用
MAINTAINER user@example.com
```
现在推荐使用 `LABEL`
```docker
## ✅ 推荐
LABEL maintainer="user@example.com"
@@ -91,7 +84,6 @@ LABEL maintainer="user@example.com"
LABEL org.opencontainers.image.authors="user@example.com"
```
---
### 7.14.6 动态标签
@@ -105,7 +97,6 @@ ARG VCS_REF
LABEL org.opencontainers.image.created=$BUILD_DATE \
org.opencontainers.image.revision=$VCS_REF
```
构建命令
```bash
@@ -114,7 +105,6 @@ $ docker build \
--build-arg VCS_REF=$(git rev-parse --short HEAD) \
.
```
---
### 7.14.7 查看标签
@@ -129,13 +119,11 @@ $ docker inspect nginx --format '{{json .Config.Labels}}' | jq
"maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>"
}
```
#### 过滤器
可以使用标签过滤镜像
```bash
## 列出作者是 yeasy 的所有镜像
$ docker images --filter "label=org.opencontainers.image.authors=yeasy"
@@ -144,5 +132,4 @@ $ docker images --filter "label=org.opencontainers.image.authors=yeasy"
$ docker rmi $(docker images -q --filter "label=stage=builder")
```
---