Docker 28.3.x 之後的版本(Dockerfile 參數寫法改變),在 docker build 的階段就不給過,會遇到下述幾個問題:
- ConsistentInstructionCasing: Command 'Label' should match the case of the command majority (uppercase)
- LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format
要怎麼解決呢?
Docker build 28.3 後的 Maintain 與 Key-Value 的改變
Docker 28.3 之後的版本,Dockerfile 的幾個寫法要做些修改:
ConsistentInstructionCasing: Command 'Label' should match the case of the command majority (uppercase) 解法
- 文件:MaintainerDeprecated | Docker Docs
- 原始寫法:MAINTAINER moby@example.com
- 新版寫法:LABEL maintainer="moby@example.com"
- 建議寫法:LABEL org.opencontainers.image.authors="moby@example.com"
LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format 解法
- 文件:LegacyKeyValueFormat | Docker Docs
- 原始寫法:ARG foo bar
- 新版寫法:ARG foo=bar
- 新版多行寫法:ENV DEPS="\
curl \
git \
make"