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