31

Dockerfile documentation states that there is possibility to pass --platform option in FROM instruction like this:

FROM [--platform=<platform>] <image> [AS <name>]

In my dockerfile I have following statements:

ARG arch
FROM --platform linux/${arch} bounz/hgbe.base

where bounz/hgbe.base image has two os/arch variants: linux/amd64 and linux/arm/v7.

But trying to build an image using this dockerfile I get an error:

$ docker build -f hgbe.dockerfile --build-arg arch=amd64 -t bounz/hgbetest:amd64-0.1 .
Sending build context to Docker daemon  12.29kB
Error response from daemon: Dockerfile parse error line 2: FROM requires either one or three arguments

What am I doing wrong? And is there a way to reference specific platform of the base image if it has been built using docker buildx?

1 Answer 1

49

update your docker file, you are missing =

ARG arch
FROM --platform=linux/${arch} bounz/hgbe.base

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.