This repository has been archived by the owner on Mar 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ Dockerfile指令 | |
|
||
dockerfile/FROM | ||
dockerfile/CMD | ||
dockerfile/RUN | ||
dockerfile/RUN | ||
dockerfile/LABEL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
# LABEL | ||
|
||
参考:[LABEL](https://docs.docker.com/engine/reference/builder/#label) | ||
|
||
`LABEL`指令为镜像添加元数据 | ||
|
||
## 语法 | ||
|
||
``` | ||
LABEL <key>=<value> <key>=<value> <key>=<value> ... | ||
``` | ||
|
||
使用键值对形式,单个`LABEL`指令可以添加一个或多个键值对,一个`Dockerfile`文件中可以包含多个`LABEL`指令 | ||
|
||
**如果键值对存在空格或者过长,可以使用双引号和反斜杠** | ||
|
||
``` | ||
LABEL "com.example.vendor"="ACME Incorporated" | ||
LABEL com.example.label-with-value="foo" | ||
LABEL multi.label1="value1" multi.label2="value2" other="value3" | ||
LABEL multi.label1="value1" \ | ||
multi.label2="value2" \ | ||
other="value3" | ||
``` | ||
|
||
## 继承 | ||
|
||
新的镜像可以继承来自基镜像或者父镜像的`LABEL`信息,如果设置了同名键值对,则会覆盖之前的信息 | ||
|
||
## 查询 | ||
|
||
使用命令`docker inspect`进行查询 | ||
|
||
``` | ||
$ docker inspect IMAGE | grep -i LABEL | ||
``` |