Bounz
Bounz

Reputation: 882

Dockerfile FROM --platform option

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?

Upvotes: 49

Views: 61051

Answers (1)

Munish
Munish

Reputation: 1627

update your docker file, you are missing =

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

Upvotes: 75

Related Questions