Skip to content

Cannot build multiarch in CI using buildx and DMP 0.43.3 #1701

Closed

Description

@poikilotherm

Description

While the new release 0.43.3 fixed the build problem on a Mac M1, it creates a new problem: multiarch builds using Buildx in a Github Action pipeline are no longer working after upgrading. Using an older version of the plugin, things are well in the CI (using 0.43.0 for quite some time now).

I see the following log entries from the runner. Here's the complete log output.

[INFO] --- docker-maven-plugin:0.43.3:push (default-push) @ dataverse ---
[INFO] Expanding: /home/runner/work/dataverse/dataverse/target/docker/gdcc/dataverse/9771-fix-docker-build/tmp/docker-build.tar into /home/runner/work/dataverse/dataverse/target/docker/gdcc/dataverse/9771-fix-docker-build/tmp/docker-build
[INFO] DOCKER> docker buildx build --progress=plain --builder maven --platform linux/amd64,linux/arm64 --tag ghcr.io/gdcc/dataverse:9771-fix-docker-build --build-arg BASE_IMAGE=gdcc/base:unstable --file=/home/runner/work/dataverse/dataverse/target/docker/gdcc/dataverse/9771-fix-docker-build/tmp/docker-build/Dockerfile /home/runner/work/dataverse/dataverse/target/docker/gdcc/dataverse/9771-fix-docker-build/tmp/docker-build --push
[INFO] DOCKER> ERROR: no builder "maven" found
Error:  DOCKER> Error status (1) when building

Info

  • docker-maven-plugin version: 0.43.3
  • Maven version (mvn -v) : Unknown, but recent (Github Runner provided)
  • Docker version : Unknown, but probably recent (GitHub Runner)
  • If it's a bug, how to reproduce : Not sure how to create a reproducer for this.
  • Sample project : https://github.com/IQSS/dataverse/tree/9771-fix-docker-build

Activity

  1. rohanKanojia commented on Aug 15, 2023

    @rohanKanojia
    Member

    @poikilotherm : Thanks for reporting. Could you please share the difference in executed buildx commands in 0.43.0 and 0.43.3? 0.43.3 adds --config if auth credentials are not provided via docker config.

  2. poikilotherm commented on Aug 16, 2023

    @poikilotherm
    ContributorAuthor

    @rohanKanojia thx for the reply. Here are some outputs as requested.

    0.43.0, taken from https://github.com/IQSS/dataverse/actions/runs/5866182102/job/15904575945:

    $ mvn  -Dapp.image.tag=unstable -Dbase.image.tag=unstable  -Ddocker.platforms=linux/amd64,linux/arm64 -P ct deploy
    ...
    [INFO] --- docker-maven-plugin:0.43.0:build (default-build) @ dataverse ---
    [INFO] DOCKER> docker --config /home/runner/work/dataverse/dataverse/target/docker/gdcc/dataverse/unstable/docker buildx create --driver docker-container --name maven
    [INFO] DOCKER> docker --config /home/runner/work/dataverse/dataverse/target/docker/gdcc/dataverse/unstable/docker buildx build --progress=plain --builder maven --platform linux/amd64 --tag gdcc/dataverse:unstable --build-arg BASE_IMAGE=gdcc/base:unstable --file=/home/runner/work/dataverse/dataverse/target/docker/gdcc/dataverse/unstable/tmp/docker-build/Dockerfile /home/runner/work/dataverse/dataverse/target/docker/gdcc/dataverse/unstable/tmp/docker-build --load
    ...
    [INFO] --- docker-maven-plugin:0.43.0:push (default-push) @ dataverse ---
    [INFO] DOCKER> docker --config /home/runner/work/dataverse/dataverse/target/docker/gdcc/configbaker/unstable/docker buildx build --progress=plain --builder maven --platform linux/amd64,linux/arm64 --tag gdcc/configbaker:unstable --build-arg SOLR_VERSION=8.11.1 --file=/home/runner/work/dataverse/dataverse/target/docker/gdcc/configbaker/unstable/tmp/docker-build/Dockerfile /home/runner/work/dataverse/dataverse/target/docker/gdcc/configbaker/unstable/tmp/docker-build --push
    

    0.43.3, taken from https://github.com/IQSS/dataverse/actions/runs/5860235371/job/15888066573:

    mvn  -Dapp.image.tag=9771-fix-docker-build -Dbase.image.tag=unstable '-Ddocker.registry=ghcr.io' 
    -Ddocker.platforms=linux/amd64,linux/arm64 -P ct deploy
    ...
    [INFO] --- docker-maven-plugin:0.43.3:build (default-build) @ dataverse ---
    [INFO] DOCKER> docker --config /home/runner/work/dataverse/dataverse/target/docker/gdcc/dataverse/9771-fix-docker-build/docker buildx create --driver docker-container --name maven --node maven0
    [INFO] DOCKER> docker --config /home/runner/work/dataverse/dataverse/target/docker/gdcc/dataverse/9771-fix-docker-build/docker buildx build --progress=plain --builder maven --platform linux/amd64 --tag gdcc/dataverse:9771-fix-docker-build --build-arg BASE_IMAGE=gdcc/base:unstable --file=/home/runner/work/dataverse/dataverse/target/docker/gdcc/dataverse/9771-fix-docker-build/tmp/docker-build/Dockerfile /home/runner/work/dataverse/dataverse/target/docker/gdcc/dataverse/9771-fix-docker-build/tmp/docker-build --load
    ...
    [INFO] --- docker-maven-plugin:0.43.3:push (default-push) @ dataverse ---
    [INFO] DOCKER> docker buildx build --progress=plain --builder maven --platform linux/amd64,linux/arm64 --tag ghcr.io/gdcc/dataverse:9771-fix-docker-build --build-arg BASE_IMAGE=gdcc/base:unstable --file=/home/runner/work/dataverse/dataverse/target/docker/gdcc/dataverse/9771-fix-docker-build/tmp/docker-build/Dockerfile /home/runner/work/dataverse/dataverse/target/docker/gdcc/dataverse/9771-fix-docker-build/tmp/docker-build --push
    [INFO] DOCKER> ERROR: no builder "maven" found
    

    I'm spotting the difference that with 0.43.3, a parameter --node maven0 is added which wasn't present before and --config is not added in the second run with multiple platforms. (Though it is added in the build phase...? 🤔 )

  3. rohanKanojia commented on Aug 16, 2023

    @rohanKanojia
    Member

    @poikilotherm : What authentication method are you using? I had changed plugin behavior to not add --config when user is using docker login (since default value of config is ~/.docker/config.json) .

    Change of --node maven0 was added since 0.43.2 . Do you face this issue just on 0.43.3 or 0.43.2? I think we can change the default value of --node parameter to null.

  4. self-assigned this
    on Aug 16, 2023
  5. tomking1982 commented on Aug 17, 2023

    @tomking1982

    @rohanKanojia You're right that --node maven0 was added since 0.43.2 which is working fine for our CIs. But we met the similar issue that it's failed after upgrading from 0.43.2 to 0.43.3. This issue can be found only when building in platform linux/arm64

    [INFO] DOCKER> error: open /root/.docker/buildx/instances/maven: no such file or directory
    Error:  DOCKER> Error status (1) when building
    

    The only difference is that --config /tmp/**/docker was added before buildx
    AWS authentication - https://dmp.fabric8.io/#extended-authentication which is our authentication method.

  6. rohanKanojia commented on Aug 17, 2023

    @rohanKanojia
    Member

    Looks like this is due to difference in docker CLI versions. Newer docker CLIs require --config option to be added always. Older docker CLIs (20.x) seem to be having problems with passing --config all the time

  7. 12 remaining items

  8. saravanaa14 commented on Sep 5, 2023

    @saravanaa14

    no. All I'm saying is, this problem seems to be related to the plugin only.

    docker --config /Users/ABCD/github/sample-project/target/docker/dockerhub.com/sample-project/sample-artifact-id/1.0.2-SNAPSHOT-20230905134913/docker buildx create --driver docker-container --name maven --config /Users/ABCD/github/sample-project/target/docker/buildkit.toml [INFO] DOCKER> unknown flag: --driver [INFO] DOCKER> See 'docker --help'. [INFO] DOCKER> [INFO] DOCKER> Usage: docker [OPTIONS] COMMAND

    In this above command generated, if I remove --config at the start of the line, the buildx instance is successfully getting created.

  9. rohanKanojia commented on Sep 6, 2023

    @rohanKanojia
    Member

    @saravanaa14 : Could you please share your docker CLI version?

  10. saravanaa14 commented on Sep 6, 2023

    @saravanaa14

    Docker version 24.0.5, build ced0996
    Docker desktop 4.22.1 (118664)

  11. jramosf commented on Sep 6, 2023

    @jramosf

    @jramosf : polite ping, Could you please share a reproducer project and the type of environment you're on? What difference do you see in executed docker commands when you run it with v0.43.0 and v0.43.4?

    Apologies, did not see this. It's exactly the error you pasted above with Macs using Apple Silicon.

  12. tfactor2 commented on Sep 15, 2023

    @tfactor2

    Looks like we need to pass --config after docker buildx.

    This works:

    docker buildx create --config /Users/user/project/target/docker/repo/project/version/docker/config.json --driver docker-container --name service-name
    

    I had to create a config.json inside the docker folder, passing the docker folder as it's done by the plugin causes:

    ERROR: failed to parse config: read /Users/user/project/target/docker/repo/project/version/docker: is a directory
    
  13. drcca commented on Sep 20, 2023

    @drcca

    In case this helps anyone. I ran into this issue with these versions:

    Docker version 24.0.5, build ced0996
    Docker desktop 4.22.1 (118664)

    I then upgraded to the latest and greatest 4.23.0 and 24.0.6 and that still didn't help.

    A colleague had a setup that worked but was on an older version. One major difference was that he had this symlink.
    /usr/local/lib/docker/cli-plugins -> /Applications/Docker.app/Contents/Resources/cli-plugins
    Once I created that symlink stuff started to work again. Not sure if this is correct or could end up masking other problems but I decided to put it out there... (I'm sure most people have cli-plugins living under ~/.docker/cli-plugins which symlink to the same directory under /Applications)

  14. dadoonet commented on Oct 18, 2023

    @dadoonet

    Hey

    I'm getting the same issue when building a multiarch on macOS.
    The same exact code with 0.43.2 is passing. Upgrading to 0.43.4 is failing.

    I'm feeling that the error is coming from this change: a339536

    To describe a bit more, I'm building 2 images.

    With 0.43.2:

    First image:

    [INFO] DOCKER> docker buildx create --driver docker-container --name maven --node maven0
    [INFO] DOCKER> maven
    

    Second image:

    [INFO] DOCKER> docker buildx create --driver docker-container --name maven --node maven0
    [INFO] DOCKER> maven
    

    With 0.43.4:

    First image:

    [INFO] DOCKER> docker buildx create --driver docker-container --name maven
    [INFO] DOCKER> maven
    

    Second image:

    [INFO] DOCKER> docker buildx create --driver docker-container --name maven
    [INFO] DOCKER> ERROR: existing instance for "maven" but no append mode, specify --node to make changes for existing instances
    

    Sounds like it was caused by this change: #1703

    Some details about the versions I'm using:

    Apache Maven 3.8.7 (b89d5959fcde851dcb1c8946a785a163f14e1e29)
    Maven home: /Users/dpilato/.sdkman/candidates/maven/current
    Java version: 19.0.2, vendor: Oracle Corporation, runtime: /Users/dpilato/.sdkman/candidates/java/19.0.2-oracle
    Default locale: fr_FR, platform encoding: UTF-8
    OS name: "mac os x", version: "13.6", arch: "x86_64", family: "mac"
    
    Docker version 20.10.23, build 7155243
    

    I tried to add manually the node name but no luck. It's not taken into account:

                <plugin>
                    <groupId>io.fabric8</groupId>
                    <artifactId>docker-maven-plugin</artifactId>
                    <configuration>
                        <authConfig>
                            <push>
                                <username>${docker.push.username}</username>
                                <password>${docker.push.password}</password>
                            </push>
                        </authConfig>
                        <!-- Create multiple images -->
                        <images combine.self="override">
                            <image>
                                <external>
                                    <type>properties</type>
                                    <prefix>docker.noocr</prefix>
                                </external>
                                <build>
                                    <buildx>
                                        <nodeName>maven</nodeName>
                                    </buildx>
                                </build>
                            </image>
                            <image>
                                <external>
                                    <type>properties</type>
                                    <prefix>docker.ocr</prefix>
                                </external>
                                <build>
                                    <buildx>
                                        <nodeName>maven</nodeName>
                                    </buildx>
                                </build>
                            </image>
                        </images>
                    </configuration>
                    <executions>
                        <!-- Generate the docker images during the package phase -->
                        <execution>
                            <id>docker-build</id>
                            <phase>package</phase>
                            <goals>
                                <goal>build</goal>
                            </goals>
                        </execution>
                        <!-- Push the docker images during the "deploy" phase -->
                        <execution>
                            <id>docker-push</id>
                            <phase>deploy</phase>
                            <goals>
                                <goal>push</goal>
                            </goals>
                        </execution>
                        <execution>
                            <!-- There is no integration test, so we can skip that execution -->
                            <id>start-elasticsearch</id>
                            <phase>none</phase>
                        </execution>
                        <execution>
                            <!-- There is no integration test, so we can skip that execution -->
                            <id>stop-elasticsearch</id>
                            <phase>none</phase>
                        </execution>
                    </executions>
                </plugin>

    This is still calling docker buildx create --driver docker-container --name maven with no node.

    [INFO] DOCKER> docker buildx create --driver docker-container --name maven
    [INFO] DOCKER> ERROR: existing instance for "maven" but no append mode, specify --node to make changes for existing instances
    

    As a workaround, I'm switching back to 0.43.2.

    Hope this helps.

  15. rohanKanojia commented on Feb 12, 2024

    @rohanKanojia
    Member

    @poikilotherm @dadoonet @drcca @tfactor2 @saravanaa14 : Hello, I've reverted some of my docker --config related changes that I did in previous releases.

    Could you please give a try to Docker Maven Plugin 0.44-SNAPSHOT and provide feedback on whether docker-maven-plugin is working as expected for your pipelines?

  16. rohanKanojia commented on Feb 17, 2024

    @rohanKanojia
    Member

    I've released 0.44.0 . I've tested it by building and pushing image to ghcr.io using buildx on Windows, MacOS (via GitHub action) and Linux.

    I think your issue might be fixed by this new release. I would appreciate it if you could try it out and provide feedback.

  17. dadoonet commented on Mar 1, 2024

    @dadoonet

    I've released 0.44.0 . I've tested it by building and pushing image to ghcr.io using buildx on Windows, MacOS (via GitHub action) and Linux.

    I think your issue might be fixed by this new release. I would appreciate it if you could try it out and provide feedback.

    This is indeed fixing my issue. Thanks a lot!

  18. tholu commented on Nov 12, 2024

    @tholu

    @poikilotherm Do you have a working multiarch build in Github actions?

  19. JamBalaya56562 commented on Jun 28, 2026

    @JamBalaya56562
    Contributor

    This was fixed in 0.44.0 (2024-02-17): the docker --config version-check workaround was reverted and a follow-up change copies the docker-buildx binary into the temporary config directory so docker still recognizes buildx after the config override (#1754).

    @dadoonet already confirmed above that 0.44.0 resolves it, and the current release is 0.48.1, so this looks resolved.

    @rohanKanojia this one can probably be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions