[英]docker buildx - how to use different Dockerfile or switch in one
I have to use two different Dockerfiles, or one if it is possible to switch on platform, one where it:我必须使用两种不同的 Dockerfile,或者一种(如果可以在平台上切换),另一种是:
Update: I have accepted @SamBos answer, but will add;更新:我已接受@SamBos 的回答,但会补充; you need to create you own manifest if you want both Dockerfiles in the same ref.
如果您希望两个 Dockerfile 在同一个 ref 中,您需要创建自己的清单。 tag(manifest)
标签(清单)
RUN curl -LO https://...amd64
and one where it和一个
RUN curl -LO https://...arm64
How can I do that using docker buildx to become one manifest?我怎样才能使用 docker buildx 成为一个清单?
You coudl add platform as an ARG
to your Dockerfile
:您可以将平台作为
ARG
添加到您的Dockerfile
:
ARG PLATFORM=defaultplatform
RUN curl -LO https://...${PLATFORM}
and then set that from docker build
:然后从
docker build
设置:
docker build --build-arg PLATFORM=arm64
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.