Authentication Error while pulling images via docker-maven-plugin




docker-maven-plugin is the great plugin provided by spotify to build docker image during maven build.

There is very strange error or behaviour I have seen during the image creation.
Plugin expects that image which Dockerfile is pulling needs to be passed with username and password, which should not an essential parameter as most of the images does not need any auth to be downloaded. 

You may see this error

[INFO] Building image your-application:0.0.3
Step 1 : FROM ubunt:latest
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] your-application..................................... FAILUER [  3.619 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 39.938 s (Wall Clock)
[INFO] Finished at: 2016-06-25T16:26:06+00:00
[INFO] Final Memory: 65M/1216M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.3.7:build (default) on project 
your-application: Exception caught: Get https://registry-1.docker.io/v2/ubuntu/manifests/latest: 
unauthorized: incorrect username or password -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command

Solution:-

Either get the account in dockerhub.io and pass the credential in configuration.
This may not be the best solution as it can be seen in configuration.

OR


Download the image which you are going to use manually on the server where you are running the build.
If it finds the image then plugin will not try to download from dockerhub.

Comments

Popular posts from this blog

Colour formatting - Jenkins Console

Manage Docker images on local disk

How to migrate Parent pom from maven to gradle