fabric8io / docker-maven-plugin

Maven plugin for running and creating Docker images
https://dmp.fabric8.io
Apache License 2.0
1.88k stars 642 forks source link

podman build fails with given buildx platforms #1832

Open jdelker opened 1 month ago

jdelker commented 1 month ago

Description

I'm using docker-maven-plugin with podman, which was working fine so far. After I added the configuration for a specific build platform (linux/amd64), the builds fails with

[INFO] DOCKER> [my/project:latest]: Created docker-build.tar in 1 second 
[WARNING] DOCKER> Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
[WARNING] DOCKER> time="2024-10-16T18:53:27+02:00" level=warning msg="The --config flag is ignored by Podman. Exists for Docker compatibility"
[WARNING] DOCKER> Error: unrecognized command `podman buildx ls`
[WARNING] DOCKER> Try 'podman buildx --help' for more information
[INFO] DOCKER> docker --config /var/lib/jenkins/workspace/dummy_develop/blafasel/target/drum-dev/.docker.build/my/project/latest/docker buildx create --driver docker-container --name maven
[INFO] DOCKER> Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
[INFO] DOCKER> Error: unknown flag: --driver
[INFO] DOCKER> See 'podman buildx --help'
[ERROR] DOCKER> Error status (125) while creating builder maven

The section added to the docker-maven-plugin config (in "configuration.images.image.build") was:

                <buildx>
                  <platforms>
                    <platform>${docker.platforms}</platform>
                  </platforms>
                </buildx>

With docker.platforms = linux/amd64.

NOTE: linux/amd64 is the native platform architecture. An alternate profile shall also perform builds for linux/arm64.

Info

rohanKanojia commented 1 month ago

This looks a bit strange. We use docker CLI for doing buildx based builds. Do you know if podman has complete support for buildx? Or maybe command name is different in case of podman?

[WARNING] DOCKER> Error: unrecognized command `podman buildx ls`
jdelker commented 1 month ago

From my understanding it should have, but it may use other cli-params:

$> podman buildx --help
Build images

Description:
  Build images

Usage:
  podman buildx [command]

Aliases:
  buildx, builder

Available Commands:
  build       Build an image using instructions from Containerfiles
  prune       Remove unused images
  version     Print build version
jdelker commented 1 month ago

Maybe this Redhat Developer Blog Post helps a bit, describing the multi-architecture-build for Docker and Podman.

Do we even require buildx for multi-architecture build?