Closed
Description
Description
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
Metadata
Assignees
Labels
No labels