Closed dtitov closed 6 years ago
I'm trying to push an image to a private registry using docker-maven-plugin, but it doesn't seem to work.
settings.xml:
<server> <id>my.repo</id> <username>user</username> <password>password</password> <configuration> <email>foo@bar.com</email> </configuration> </server>
pom.xml:
<plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>1.0.0</version> <configuration> <serverId>my.repo</serverId> <registryUrl>https://hostname:5000/v2/</registryUrl> <imageName>hostname:5000/config</imageName> <baseImage>openjdk:8-jre</baseImage> <entryPoint> ["java", "-jar", "/${project.build.finalName}.jar", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCGroupMemoryLimitForHeap"] </entryPoint> <resources> <resource> <targetPath>/</targetPath> <directory>${project.build.directory}</directory> <include>${project.build.finalName}.jar</include> </resource> </resources> </configuration> <executions> <execution> <id>build-image</id> <phase>install</phase> <goals> <goal>build</goal> </goals> </execution> <execution> <id>push-image</id> <phase>deploy</phase> <goals> <goal>push</goal> </goals> </execution> </executions> </plugin>
I expect an image to be pushed successfully upon mvn docker:push.
mvn docker:push
It fails with no basic auth credentials.
no basic auth credentials
[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building config 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- docker-maven-plugin:1.0.0:push (default-cli) @ config --- [INFO] Using Google application default credentials [INFO] loaded credentials for user account with clientId=764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com [INFO] Using authentication suppliers: [ConfigFileRegistryAuthSupplier, ContainerRegistryAuthSupplier, NoOpRegistryAuthSupplier] [INFO] Pushing hostname:5000/config The push refers to repository [hostname:5000/config] ca17aa526170: Preparing 148268bf14be: Preparing 6a47dae912f7: Preparing 00439e7d6354: Preparing a1a8b7f7efac: Preparing 341d865c1c22: Waiting 61c06e07759a: Waiting bcbe43405751: Waiting e1df5dc88d2c: Waiting [WARNING] Failed to push hostname:5000/config, retrying in 10 seconds (1/5). [INFO] Pushing hostname:5000/config The push refers to repository [hostname:5000/config] ca17aa526170: Preparing 148268bf14be: Preparing 6a47dae912f7: Preparing 00439e7d6354: Preparing a1a8b7f7efac: Preparing 341d865c1c22: Waiting 61c06e07759a: Waiting bcbe43405751: Waiting e1df5dc88d2c: Waiting [WARNING] Failed to push hostname:5000/config, retrying in 10 seconds (2/5). [INFO] Pushing hostname:5000/config The push refers to repository [hostname:5000/config] ca17aa526170: Preparing 148268bf14be: Preparing 6a47dae912f7: Preparing 00439e7d6354: Preparing a1a8b7f7efac: Preparing 341d865c1c22: Waiting 61c06e07759a: Waiting bcbe43405751: Waiting e1df5dc88d2c: Preparing [WARNING] Failed to push hostname:5000/config, retrying in 10 seconds (3/5). [INFO] Pushing hostname:5000/config The push refers to repository [hostname:5000/config] ca17aa526170: Preparing 148268bf14be: Preparing 6a47dae912f7: Preparing 00439e7d6354: Preparing a1a8b7f7efac: Preparing 341d865c1c22: Waiting 61c06e07759a: Waiting bcbe43405751: Waiting e1df5dc88d2c: Waiting [WARNING] Failed to push hostname:5000/config, retrying in 10 seconds (4/5). [INFO] Pushing hostname:5000/config The push refers to repository [hostname:5000/config] ca17aa526170: Preparing 148268bf14be: Preparing 6a47dae912f7: Preparing 00439e7d6354: Preparing a1a8b7f7efac: Preparing 341d865c1c22: Waiting 61c06e07759a: Waiting bcbe43405751: Waiting e1df5dc88d2c: Waiting [WARNING] Failed to push hostname:5000/config, retrying in 10 seconds (5/5). [INFO] Pushing hostname:5000/config The push refers to repository [hostname:5000/config] ca17aa526170: Preparing 148268bf14be: Preparing 6a47dae912f7: Preparing 00439e7d6354: Preparing a1a8b7f7efac: Preparing 341d865c1c22: Waiting 61c06e07759a: Waiting bcbe43405751: Waiting e1df5dc88d2c: Waiting [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 53.742 s [INFO] Finished at: 2018-04-07T17:30:18+02:00 [INFO] Final Memory: 22M/75M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:push (default-cli) on project config: Exception caught: no basic auth credentials -> [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
Should be fixed in recent versions. Please confirm.
I have the same question ,how do you solve it?
Description
I'm trying to push an image to a private registry using docker-maven-plugin, but it doesn't seem to work.
How to reproduce
settings.xml:
pom.xml:
What do you expect
I expect an image to be pushed successfully upon
mvn docker:push
.What happened instead
It fails with
no basic auth credentials
.Software:
Full backtrace