I'm trying to add the --platform=linux/amd64 flag to my dockerfile's FROM statement. I need to do this because I'm working on an m1 laptop and the default architecture (linux/arm64/v8) is not compatible with our prod machine. The whole line should be:
FROM --platform=linux/amd64 openjdk:11-jre-slim
This worked fine for my frontend repo (with node as the base image). However, in the backend repo, I'm getting this error:
<name chain> expected, got '-'
So it's like, not letting me add the flag at all for some reason.
IntelliJ IDEA, Java
Full backend dockerfile:
FROM --platform=linux/amd64 openjdk:11-jre-slim
COPY config/dev.yml /opt/dropwizard/
COPY build/libs/smerge-1.0-SNAPSHOT-all.jar /opt/dropwizard/
EXPOSE 8080
WORKDIR /opt/dropwizard
CMD ["java", "-jar", "smerge-1.0-SNAPSHOT-all.jar", "server", "dev.yml"]
The docker documentation on the --platform flag for dockerfiles says that:
The optional --platform flag can be used to specify the platform of the image in case FROM references a multi-platform image. For example, linux/amd64, linux/arm64, or windows/amd64. By default, the target platform of the build request is used.
docker buildx build --platform linux/amd64 --tag REPO:TAG .
If your docker version doesn't come with buildx you have to install it - docs.docker.com/build/buildx/install – Pyatt