Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

useConfigFile only reads the first auths credential #284

Closed
sdurrheimer opened this issue Oct 28, 2016 · 3 comments
Closed

useConfigFile only reads the first auths credential #284

sdurrheimer opened this issue Oct 28, 2016 · 3 comments

Comments

@sdurrheimer
Copy link

Description

The useConfigFile option only reads the first auth credential from the ~/.docker/config.json file.

How to reproduce

Use useConfigFile option when building a image from a Dockerfile having a FROM directive pointing on a image (not yet pulled on the machine) from the registry registry-A.domain.tld, and when the first auth credential of your ~/.docker/config.json file is for the registry registry-B.domain.tld.

What do you expect

That the useConfigFile uses all credentials from the ~/.docker/config.json file.

What happened instead

useConfigFile only take the first auth credential from the ~/.docker.config.json file.

Software:

  • docker version: 1.12.3
  • docker-maven-plugin version: 0.4.13
  • maven version: 3.3.9

Full backtrace

[...]
[DEBUG] /home/steve/.docker/ca.pem, /home/steve/.docker/key.pem or /home/steve/.docker/cert.pem does not exist, not using SSL
[DEBUG] Using configfile: /home/steve/.docker/config.json
[DEBUG] Not using any build profile
[...]
[INFO] Building image registry-A.domain.tld/gps-core-batch
[DEBUG] Auth Config AuthConfig{username=steve.durrheimer, password=xxxxxxx, email=null, serverAddress=registry-B.domain.tld}
[DEBUG] Registry Config Json {"registry-B.domain.tld":{"serveraddress":"registry-B.domain.tld","password":"xxxxxx","auth":"","email":null,"username":"steve.durrheimer"}}
[DEBUG] Registry Config Encoded eyJkb2NrZXItYXViZXJ0Lm5ldGFwc3lzLmZyIjp7InNlcnZlcmFkZHJlc3MiOiJkb2NrZXItYXViZXJ0Lm5ldGFwc3lzLmZyIiwicGFzc3dvcmQiOiJ4b29sZWkxRiIsImF1dGgiOiIiLCJlbWFpbCI6bnVsbCwidXNlcm5hbWUiOiJzdGV2ZS5kdXJyaGVpbWVyIn19
Step 1 : FROM registry-A.domain.tld/debian8-oraclejdk:v8-jdk
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.636 s
[INFO] Finished at: 2016-10-28T08:32:17+02:00
[INFO] Final Memory: 37M/502M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default-cli) on project gps-core-batch: Exception caught: Get https://registry-A.domain.tld/v2/debian8-oraclejdk/manifests/v8-jdk: unknown: Authentication is required -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default-cli) on project gps-core-batch: Exception caught
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    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: org.apache.maven.plugin.MojoExecutionException: Exception caught
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:141)
    at com.spotify.docker.BuildMojo.execute(BuildMojo.java:86)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more
Caused by: com.spotify.docker.client.exceptions.DockerException: Get https://docker.netapsys.fr/v2/debian8-oraclejdk/manifests/v8-jdk: unknown: Authentication is required
    at com.spotify.docker.client.AnsiProgressHandler.progress(AnsiProgressHandler.java:52)
    at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1158)
    at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1107)
    at com.spotify.docker.BuildMojo.buildImage(BuildMojo.java:571)
    at com.spotify.docker.BuildMojo.execute(BuildMojo.java:355)
    at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:139)
    ... 23 more
[...]
@j4b0l
Copy link

j4b0l commented Dec 18, 2016

If you're using multiple private docker registries, then you can work around this by using registryUrl e.g.:

<registryUrl>docker-registry.mycompany.com</registryUrl>
<useConfigFile>true</useConfigFile>
<baseImage>https://docker-registry.mycompany.com/my-base-image:1.0.0</baseImage>

Still, is there possibility to fix this issue?

@possan
Copy link

possan commented Mar 6, 2017

Also worth noting that that the blob in the original post log contains the credentials to your host, you might want to remove those.

@mattnworb
Copy link
Member

This is resolved in #339 and version 1.0.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants