FROM --platform in Dockerfile causes error
See original GitHub issueDescription
When trying to build from a Dockerfile (multistage) which is containing the FROM --platform=linux/amd64
instruction the build fails with the following error.
the intension to do so is that i work on a new MacBookPro with M1Pro Processor. i need to create at least an amd64 image - but would also be happy to create a native arm64 image (performances!!).
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.38.1:build (docker-build) on project pitdata: Unable to check image [--platform=linux/arm64] : {"message":"no such image: --platform=linux/arm64: invalid reference format"} (Bad Request: 400) -> [Help 1]
Is this related to the fact that JIB is used for building?
Info
- docker-maven-plugin version : 0.38.1
- Maven version (
mvn -v
) : 3.6.3
Dockerfile
FROM --platform=linux/amd64 azul/zulu-openjdk-alpine:11 as packager
RUN { \
java --version ; \
echo "jlink version:" && \
$JAVA_HOME/bin/jlink --version ; \
}
ENV JAVA_MINIMAL=/opt/jre
# build modules distribution
RUN $JAVA_HOME/bin/jlink \
--verbose \
--add-modules \
jdk.management.agent,java.base,java.net.http,java.sql,java.naming,java.desktop,java.xml,jdk.crypto.cryptoki,jdk.unsupported,java.management,java.security.jgss \
--compress 2 \
--strip-debug \
--no-header-files \
--no-man-pages \
--output "$JAVA_MINIMAL"
#####################################
# Second stage
#
# adding the minimal "JRE" distr from the first stage
#####################################
FROM --platform=linux/amd64 alpine
# Runtime environment for JRE
ENV JAVA_MINIMAL=/opt/jre
ENV PATH="$PATH:$JAVA_MINIMAL/bin"
# install some utils
RUN apk --no-cache add curl iputils
# Copy the minimal-java to image
COPY --from=packager "$JAVA_MINIMAL" "$JAVA_MINIMAL"
# Execute Java Main
ENTRYPOINT ["/bin/sh","-c","java -version"]
Maven Plugin
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<skip>${docker.skip}</skip>
<images>
<image>
<!--
<name>${docker.image.name}:${project.version}${version.suffix}</name>
<name>${docker.image.name}:%l</name>
-->
<name>${docker.image.name}:%l</name>
<alias>${docker.image.alias}</alias>
<build>
<tags>
<tag>${project.version}${version.suffix}</tag>
<tag>${docker.tag.native}</tag>
<!--tag>${buildNumber}</tag-->
</tags>
<contextDir>${project.basedir}</contextDir>
<dockerFile>${docker.dockerFile}</dockerFile>
<args>
<buildArtifact>${docker.buildArtifact}</buildArtifact>
<!-- used as Labels in dockerfile -->
<buildAppName>${project.artifactId}</buildAppName>
<buildAppDesc>${project.description}</buildAppDesc>
<buildOrg>${project.organization.name}</buildOrg>
<buildBranch>${scmBranch}</buildBranch>
<buildBranchVersion>${project.version}${version.suffix}</buildBranchVersion>
<buildBranchRevision>${buildNumber}</buildBranchRevision>
<buildDate>${maven.build.timestamp}</buildDate>
<buildHost>${hostname}</buildHost>
<buildOS>${os.name} ${os.version} (${os.arch})</buildOS>
</args>
</build>
</image>
</images>
<retries>3</retries>
<useColor>false</useColor>
<verbose>${docker.verbose}</verbose>
<skipPush>${docker.skipPush}</skipPush>
</configuration>
<executions>
<execution>
<id>docker-build</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>docker-push</id>
<phase>install</phase>
<goals>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
- Docker version : 4.3.2 (72729)
- If it’s a bug, how to reproduce :
- use my Dockerfile
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
Error: multiple platforms feature is currently not supported for ...
I'm getting the following error when I try to start this application up using docker-compose on a M1 Mac: [+] Building 0.0s (0/0)...
Read more >windows 10 - Error: "Failed to solve with frontend dockerfile.v0 ...
The cause was simple. I had my Docker desktop running on Linux containers and the image was build from a Windows image.
Read more >Docker: “build” Requires 1 Argument Error - Baeldung
Docker is an open-source container platform. It allows us to package applications into containers and standardize the executable components ...
Read more >Why new Macs break your Docker build, and how to fix it
% docker build . ... ERROR: Could not find a version that satisfies the requirement filprofiler==2022.05.0 (from versions: none) ERROR: No ...
Read more >Docker Error when pushing image with CIRCLE CI. platform ...
standard_init_linux.go:228: exec user process caused: exec format error. This is my code (DOCKERFILE):. FROM --platform=arm64 node:14.5.0- ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s supported when doing build but I think while pulling images we’re not passing this. We can fix this issue alongside this issue.
FYI: i solved the problem with the arm64 cli build …
azul/zulu-openjdk-alpine:11 is NOT available for arm64 😢 . i wonder that it is still downloading the amd64 version without telling, but so what.