fabric8io / docker-maven-plugin

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

Since version 0.45 build fails `Unable to build image`, `failed to resolve source metadata for` and `no active sessions` #1811

Open nudgegoonies opened 3 months ago

nudgegoonies commented 3 months ago

Description

Since version 0.45 the build of an internal project using an internal docker repository (Artifactory) fails pulling the base image used in our Dockerfile processed by docker-maven-plugin. Managing the plugin back to 0.44 is our current workaround.

The maven build log part:

1986 [ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.45.0:build (docker-build) on project mampkg-npm-cache: Unable to build image [cr.mam.dev/internal/mamido/mampkg-npm-cache] : "cr.mam.dev/internal/mamido/nginx: failed to resolve source metadata for cr.mam.dev/internal/mamido/nginx:latest: no active sessions"  -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:docker-maven-plugin:0.45.0:build (docker-build) on project mampkg-npm-cache: Unable to build image [cr.mam.dev/internal/mamido/mampkg-npm-cache] : "cr.mam.dev/internal/mamido/nginx: failed to resolve source metadata for cr.mam.dev/internal/mamido/nginx:latest: no active sessions" 
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to build image [cr.mam.dev/internal/mamido/mampkg-npm-cache] : "cr.mam.dev/internal/mamido/nginx: failed to resolve source metadata for cr.mam.dev/internal/mamido/nginx:latest: no active sessions" 
    at io.fabric8.maven.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:305)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: io.fabric8.maven.docker.access.DockerAccessException: Unable to build image [cr.mam.dev/internal/mamido/mampkg-npm-cache] : "cr.mam.dev/internal/mamido/nginx: failed to resolve source metadata for cr.mam.dev/internal/mamido/nginx:latest: no active sessions" 
    at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.buildImage (DockerAccessWithHcClient.java:297)
    at io.fabric8.maven.docker.service.BuildService.doBuildImage (BuildService.java:292)
    at io.fabric8.maven.docker.service.BuildService.buildImage (BuildService.java:182)
    at io.fabric8.maven.docker.service.BuildService.buildImage (BuildService.java:70)
    at io.fabric8.maven.docker.BuildMojo.proceedWithDockerBuild (BuildMojo.java:110)
    at io.fabric8.maven.docker.BuildMojo.proceedWithBuildProcess (BuildMojo.java:91)
    at io.fabric8.maven.docker.BuildMojo.buildAndTag (BuildMojo.java:84)
    at io.fabric8.maven.docker.BuildMojo.processImageConfig (BuildMojo.java:163)
    at io.fabric8.maven.docker.BuildMojo.executeInternal (BuildMojo.java:73)
    at io.fabric8.maven.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:302)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: io.fabric8.maven.docker.access.DockerAccessException: "cr.mam.dev/internal/mamido/nginx: failed to resolve source metadata for cr.mam.dev/internal/mamido/nginx:latest: no active sessions" 
    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:292)
    at io.fabric8.maven.docker.service.BuildService.buildImage (BuildService.java:182)
    at io.fabric8.maven.docker.service.BuildService.buildImage (BuildService.java:70)
    at io.fabric8.maven.docker.BuildMojo.proceedWithDockerBuild (BuildMojo.java:110)
    at io.fabric8.maven.docker.BuildMojo.proceedWithBuildProcess (BuildMojo.java:91)
    at io.fabric8.maven.docker.BuildMojo.buildAndTag (BuildMojo.java:84)
    at io.fabric8.maven.docker.BuildMojo.processImageConfig (BuildMojo.java:163)
    at io.fabric8.maven.docker.BuildMojo.executeInternal (BuildMojo.java:73)
    at io.fabric8.maven.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:302)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
1988 [ERROR] 
1988 [ERROR] 
1988 [ERROR] For more information about the errors and possible solutions, please read the following articles:
1988 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
1988 [ERROR] 
1988 [ERROR] After correcting the problems, you can resume the build with the command
1988 [ERROR]   mvn <args> -rf :mampkg-npm-cache

Info


* Docker version : 27.1.1
* If it's a bug, how to reproduce : I cannot provide a minimal example. Precondition is that the docker image is not available locally which always the case in our gitlab-ci setup.
rohanKanojia commented 3 months ago

@nudgegoonies : Could you please provide more information on how to reproduce it? Could it be related to your Docker version? We have E2E tests that pull images on every run.

rroesch1 commented 3 months ago

fyi: no active sessions is the error message you get from dockerd if you're trying to use buildkit without active grpc session. For buildkit support the client (i.e. d-m-p) has to initialize a grpc sessions (see: Initialize interactive session API). As so far as i know d-m-p did not implement this Session API for now.

see: this comment

rohanKanojia commented 3 months ago

@nudgegoonies : Are you using BuildX functionality?

nudgegoonies commented 3 months ago

Yes, we use buildx functionality since it became the default last year. Especially the copy --chmod and --chown on one line.

rohanKanojia commented 3 months ago

@nudgegoonies : Does your project work with v0.44.0 ?

Is it possible to share a sample Dockerfile that can reproduce the issue? I ran integration tests with Docker 27.1.1 and they seem to be passing

rroesch1 commented 3 months ago

@rohanKanojia i have taken a closer look on what @nudgegoonies is doing (fyi: we are working in the same organization) and i think we identified the root cause of the "regressions":

nudgegoonies commented 3 months ago

@rroesch1 already figured out the details. To answer the explicit question. Yes, it works with 0.44.