Open lakshmi-dj opened 1 year ago
I think setting <buildOptions><version>2</version></buildOptions>
should unlock BuildKit for you; see https://dmp.fabric8.io/#config-image-build and https://docs.docker.com/engine/api/v1.38/#tag/Image/operation/ImageBuild. Having built-in support in docker-maven-plugin would be nice though!
@qerub : Could you please open a new issue about this? Shall we enable this behavior by default or via some configuration option?
Docker build is failed when COPY and ADD are used with the "--chmod=765" option
Info
docker-maven-plugin version : 0.43.4
Maven version (
mvn -v
) : 3.6.2Docker version : Client:
Cloud integration: v1.0.33
Version: 24.0.2
API version: 1.43
Go version: go1.20.4
Git commit: cb74dfc
Built: Thu May 25 21:53:15 2023 OS/Arch: windows/amd64
Context: default Server: Docker Desktop 4.20.1 (110738) Engine: Version: 24.0.2 API version: 1.43 (minimum version 1.12) Go version: go1.20.4 Git commit: 659604f Built: Thu May 25 21:52:17 2023 OS/Arch: linux/amd64 Experimental: true containerd: Version: 1.6.21 GitCommit: 3dce8eb055cbb6872793272b4f20ed16117344f8 runc: Version: 1.1.7 GitCommit: v1.1.7-0-g860f061 docker-init: Version: 0.19.0 GitCommit: de40ad0
If it's a bug, how to reproduce : Use COPY instruction in dockerfile with "--chmod" option
If it's a feature request, what is your use case : bug
Error thrown: "the --chmod option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled" -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:docker-maven-plugin:0.43.4:build (docker-build) on project config-service: Unable to build ima ge [artifactory.otxlab.net/bpdockerhub/biz/config-service/develop] : "the --chmod option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images w ith BuildKit enabled" at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347) Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to build image [artifactory.otxlab.net/bpdockerhub/biz/config-service/develop] : "the --chmod option requires BuildKit . Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled" at io.fabric8.maven.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:280) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347) Caused by: io.fabric8.maven.docker.access.DockerAccessException: Unable to build image [artifactory.otxlab.net/bpdockerhub/biz/config-service/develop] : "the --chmod option requires Bu ildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled" at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.buildImage (DockerAccessWithHcClient.java:297) at io.fabric8.maven.docker.service.BuildService.doBuildImage (BuildService.java:293) at io.fabric8.maven.docker.service.BuildService.buildImage (BuildService.java:183) at io.fabric8.maven.docker.service.BuildService.buildImage (BuildService.java:71) at io.fabric8.maven.docker.BuildMojo.proceedWithDockerBuild (BuildMojo.java:115) at io.fabric8.maven.docker.BuildMojo.proceedWithBuildProcess (BuildMojo.java:98) at io.fabric8.maven.docker.BuildMojo.buildAndTag (BuildMojo.java:91) at io.fabric8.maven.docker.BuildMojo.processImageConfig (BuildMojo.java:237) at io.fabric8.maven.docker.BuildMojo.executeInternal (BuildMojo.java:80) at io.fabric8.maven.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:277) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347) Caused by: io.fabric8.maven.docker.access.DockerAccessException: "the --chmod option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled" at io.fabric8.maven.docker.access.chunked.BuildJsonResponseHandler.process (BuildJsonResponseHandler.java:26) at io.fabric8.maven.docker.access.chunked.EntityStreamReaderUtil.processJsonStream (EntityStreamReaderUtil.java:27) at io.fabric8.maven.docker.access.hc.HcChunkedResponseHandlerWrapper.handleResponse (HcChunkedResponseHandlerWrapper.java:44) at io.fabric8.maven.docker.access.hc.ApacheHttpClientDelegate$StatusCodeCheckerResponseHandler.handleResponse (ApacheHttpClientDelegate.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:223) at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:165) at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:140) at io.fabric8.maven.docker.access.hc.ApacheHttpClientDelegate.post (ApacheHttpClientDelegate.java:109) at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.buildImage (DockerAccessWithHcClient.java:295) at io.fabric8.maven.docker.service.BuildService.doBuildImage (BuildService.java:293) at io.fabric8.maven.docker.service.BuildService.buildImage (BuildService.java:183) at io.fabric8.maven.docker.service.BuildService.buildImage (BuildService.java:71) at io.fabric8.maven.docker.BuildMojo.proceedWithDockerBuild (BuildMojo.java:115) at io.fabric8.maven.docker.BuildMojo.proceedWithBuildProcess (BuildMojo.java:98) at io.fabric8.maven.docker.BuildMojo.buildAndTag (BuildMojo.java:91) at io.fabric8.maven.docker.BuildMojo.processImageConfig (BuildMojo.java:237) at io.fabric8.maven.docker.BuildMojo.executeInternal (BuildMojo.java:80) at io.fabric8.maven.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:277) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
I have enabled the "buildkit" in docker daemon. Still sseeing same issue.
Futher I tried to build the docker image without using the docker-maven-plugin. I can successfully build the image. Hance concluding it could be docker-maven plugin issue