RedundantTarget平台
目录
输出
Setting platform to predefined $TARGETPLATFORM in FROM is redundant as this is the default behavior
描述
自定义平台可用于基础镜像。默认平台是
与目标输出相同的平台,因此将 Platform 设置为 是冗余且不必要的。$TARGETPLATFORM
例子
❌ Bad:此用法是多余的,因为是默认值。--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