Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildx support builds unwanted image with OS and architecture unkown/unknown #1732

Open
obfischer opened this issue Dec 11, 2023 · 4 comments

Comments

@obfischer
Copy link

obfischer commented Dec 11, 2023

Description

Unfortunately we hat do remove the Docker Maven Plugin from our project, as the support of buildx lead to unwanted additional images in the OCI index.

Each image we build had a tiny additional image in its OCI index listet without architecture and OS inforamation. Furthermore Trivy was unable to scan it because of errors.

As a successfull Trivy scan is required for an image to promoted to the next stage, I had to decide to kick out the plugin and to replace it by calls to docker ... via the Maven Exec Plugin.

Here is a screenshot from Harbor
grafik

Info

  • docker-maven-plugin version : 0.43.0
  • Maven version (mvn -v) :
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /Users/plx/tooling/apache-maven-3.8.6
Java version: 1.8.0_301, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"

  • Docker version :
  • If it's a bug, how to reproduce : 24.0.2
  • If it's a feature request, what is your use case :
  • Sample project : [GitHub Clone URL]

As this is a company internal project, I can't provide the hole project, but here is the plugin configuration:

<plugin>
    <groupId>io.fabric8</groupId>
    <artifactId>docker-maven-plugin</artifactId>
    <configuration>
        <images>
            <image>
                <name>harbor.acme.com/service/%a:%l</name>
                <build>
                    <buildx>
                        <platforms>
                            <platform>${pbid.docker.plattform}</platform>
                        </platforms>
                    </buildx>
                    <tags>
                        <tag>${project.version}</tag>
                    </tags>
                    <filter>@</filter>
                    <dockerFile>Dockerfile</dockerFile>
                    <contextDir>${project.basedir}</contextDir>
                </build>
            </image>
        </images>
    </configuration>
    <executions>
        <execution>
            <id>build-oci-images-for-service</id>
            <phase>package</phase>
            <goals>
                <goal>build</goal>
                <goal>tag</goal>
            </goals>
        </execution>
        <execution>
            <id>push-oci-image-to-registry</id>
            <phase>deploy</phase>
            <goals>
                <goal>push</goal>
            </goals>
        </execution>
    </executions>
</plugin>

@rhuss
Copy link
Collaborator

rhuss commented Dec 14, 2023

Interesting. I'm not so deep in the buildx integration, which is a recent addition. Do you require to use buildx or would the traditional way of building the image also good enough ? (which relies on the architecture of the build system though).

What buildx command are using concrete with maven exec (including command line options). thanks!

@obfischer
Copy link
Author

Hi @rhuss, the traditional way would be enough for our use case. We switched to buildx as we had problems with the traditional way, as you called it.

One of my team mates replaced the Docker Maven Plugin by the jib plugin, as we where under high pressure.

Can I help you with other information?

@rohanKanojia
Copy link
Member

rohanKanojia commented Dec 21, 2023

@obfischer : It's quite strange because other people are also using buildx and no one has reported a problem like this. Could you please provide these?

What buildx command are using concrete with maven exec (including command line options)

  1. What command was DMP trying to execute?

  2. What is value of pbid.docker.plattform?

  3. What docker version are you using?

@obfischer
Copy link
Author

Hi @rohanKanojia, this was a freelancing project and the project finished this week. So I don't have access to the code. But the problem was reproducable on Mac, Windows and Linux.

As I can't provide any additional information as the project ended, it is fine for me to close this issue 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants