Is this a BUG REPORT or FEATURE REQUEST?: BUG REPORT
I am trying to push a generated docker image from Jenkins using dockerfile-maven-plugin. I am setting my service account for the GCR project in an environment variable named DOCKER_GOOGLE_CREDENTIALS as is indicated in the documentation (https://github.com/spotify/dockerfile-maven/blob/master/docs/authentication.md). This should be enough to being able to do a push, however I'm getting following error:
java.io.IOException: Cannot run program "docker-credential-gcloud": error=2, No such file or directory
With version 1.4.3 it was working without problems, but it is failing in vesion 1.4.8. Also, I cannot use vesion 1.4.3 because it fails in my local PC where I'm login in Google Cloud using credential helpers. In that case, version 1.4.8 works, but this version has the issue I'm reporting here.
Create an environment variable named DOCKER_GOOGLE_CREDENTIALS pointing to a Google service account key file.
Use dockerfile-maven-plugin version 1.4.8.
Build a docker image and push it to a GCR registry.
Plugin configuration:
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.8</version>
<executions>
<execution>
<id>build-image</id>
<configuration>
<repository>${docker.image.name}</repository>
<contextDirectory>${basedir}/target</contextDirectory>
</configuration>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>tag-image</id>
<phase>deploy</phase>
<goals>
<goal>tag</goal>
</goals>
<configuration>
<repository>${docker.registry.url}/${docker.image.name}</repository>
<tag>${project.parent.version}-${docker.image.env}</tag>
</configuration>
</execution>
<execution>
<id>push-image</id>
<phase>deploy</phase>
<goals>
<goal>push</goal>
</goals>
<configuration>
<repository>${docker.registry.url}/${docker.image.name}</repository>
</configuration>
</execution>
</executions>
</plugin>
The docker image built should be pushed to GCR without any failure.
The docker image failed during the push with error provided in the bug description
docker version:Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:23:03 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:25:29 2018
OS/Arch: linux/amd64
Experimental: false
mvn -version: Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)org.apache.maven.plugin.MojoExecutionException: Could not build image
at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:208)
at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:110)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:259)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:248)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: com.spotify.docker.client.exceptions.DockerException: java.io.IOException: Cannot run program "docker-credential-gcloud": error=2, No such file or directory
at com.spotify.docker.client.auth.ConfigFileRegistryAuthSupplier.authForBuild(ConfigFileRegistryAuthSupplier.java:108)
at com.spotify.docker.client.auth.MultiRegistryAuthSupplier.authForBuild(MultiRegistryAuthSupplier.java:77)
at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1468)
at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1445)
at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:201)
... 25 more
Caused by: java.io.IOException: Cannot run program "docker-credential-gcloud": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.Runtime.exec(Runtime.java:450)
at java.lang.Runtime.exec(Runtime.java:347)
at com.spotify.docker.client.SystemCredentialHelperDelegate.exec(SystemCredentialHelperDelegate.java:140)
at com.spotify.docker.client.SystemCredentialHelperDelegate.get(SystemCredentialHelperDelegate.java:88)
at com.spotify.docker.client.DockerCredentialHelper.get(DockerCredentialHelper.java:119)
at com.spotify.docker.client.DockerConfigReader.authWithCredentialHelper(DockerConfigReader.java:271)
at com.spotify.docker.client.DockerConfigReader.authForAllRegistries(DockerConfigReader.java:136)
at com.spotify.docker.client.auth.ConfigFileRegistryAuthSupplier.authForBuild(ConfigFileRegistryAuthSupplier.java:106)
... 29 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 38 more
I am facing the same problem as of today. I am on Win 10 with Docker Desktop. I have tried from Powershell and git bash with no luck.
EDIT: I can confirm that using 1.4.3 works. Then I ran into this issue which I already solved
I do know yet which tool / plugin is constantly changing my .docker/config.json file
but I have to remove
"credHelpers" subtree from .docker/config.json to be able to build docker image with spotify plugin..
(I am not using google cloud)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
I do know yet which tool / plugin is constantly changing my .docker/config.json file
but I have to remove
"credHelpers" subtree from .docker/config.json to be able to build docker image with spotify plugin..
(I am not using google cloud)