Saturday, 25 June 2016

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] your-application..................................... FAILUER [  3.619 s]
[INFO] ------------------------------------------------------------------------
[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 
unauthorized: incorrect username or password -> [Help 1]
[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] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]
[ERROR] After correcting the problems, you can resume the build with the command


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


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.