diff --git a/doc/changelog.md b/doc/changelog.md index 1b42ffd04..69f179658 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -1,6 +1,7 @@ # ChangeLog * **0.44-SNAPSHOT**: + - Make `--config` from buildx command string generation optional ([1673](https://github.com/fabric8io/docker-maven-plugin/pull/1673)) @robfrank * **0.43.1** (2023-07-28): - Resolve registry auth URL by registry ID ([1688](https://github.com/fabric8io/docker-maven-plugin/issues/1688)) @wajda diff --git a/src/main/java/io/fabric8/maven/docker/service/BuildXService.java b/src/main/java/io/fabric8/maven/docker/service/BuildXService.java index d55b89568..f9a32dc34 100644 --- a/src/main/java/io/fabric8/maven/docker/service/BuildXService.java +++ b/src/main/java/io/fabric8/maven/docker/service/BuildXService.java @@ -63,7 +63,14 @@ protected void useBuilder(ProjectPaths projectPaths, ImageConfiguration imag BuildDirs buildDirs = new BuildDirs(projectPaths, imageConfig.getName()); Path configPath = getDockerStateDir(imageConfig.getBuildConfiguration(), buildDirs); - List buildX = Arrays.asList("docker", "buildx"); + File[] configDirFiles = configPath.toFile().listFiles(); + List buildX = new ArrayList<>(); + buildX.add("docker"); + if (configDirFiles != null && configDirFiles.length > 0) { + buildX.add("--config"); + buildX.add(configPath.toString()); + } + buildX.add("buildx"); String builderName = createBuilder(configPath, buildX, imageConfig, buildDirs); Path configJson = configPath.resolve("config.json");