冗余目标平台
目录
输出
Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior
描述
可以使用自定义平台作为基础镜像。默认平台与目标输出平台相同,因此将平台设置为$TARGETPLATFORM
是冗余且不必要的。
示例
❌ 错误:由于$TARGETPLATFORM
是默认值,因此这种--platform
用法是冗余的。
FROM --platform=$TARGETPLATFORM alpine AS builder
RUN apk add --no-cache git
✅ 正确:省略--platform
参数。
FROM alpine AS builder
RUN apk add --no-cache git