Dockerfile(2) - LABEL 指令詳解
阿新 • • 發佈:2021-10-31
LABEL
可以為生成的映象新增元資料標籤資訊,這些資訊可以用來輔助過濾出特定映象
LABEL <key>=<value> <key>=<value> <key>=<value> ...
栗子一
# key 加了 " LABEL "com.example.vendor"="ACME Incorporated" # key 沒有 " LABEL com.example.label-with-value="foo" LABEL version="1.0" # 換行 LABEL description="This text illustrates \ that label-values can span multiple lines."
栗子二
一行新增多個 key=value
LABEL multi.label1="value1" multi.label2="value2" other="value3"
等價寫法
LABEL multi.label1="value1" \
multi.label2="value2" \
other="value3"
通過 docker inspect 檢視新增的元資料
> docker image inspect --format='' myimage { "com.example.vendor": "ACME Incorporated", "com.example.label-with-value": "foo", "version": "1.0", "description": "This text illustrates that label-values can span multiple lines.", "multi.label1": "value1", "multi.label2": "value2", "other": "value3" }