RedundantTarget平台
目录
输出
Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior描述
自定义平台可用于基础镜像。默认平台是
与目标输出相同的平台,因此将 Platform 设置为$TARGETPLATFORM是冗余且不必要的。
例子
❌ 坏:这种--platform是多余的,因为$TARGETPLATFORM是默认值。
FROM --platform=$TARGETPLATFORM alpine AS builder
RUN apk add --no-cache git✅ Good:省略--platform论点。
FROM alpine AS builder
RUN apk add --no-cache git