Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spotify docker-maven-plugin unauthorized: authentication required public repo

I am having trouble pushing my docker image to the hub using the following command:

mvn clean package docker:build -DpushImage

Each time I get the following response:

[WARNING] Failed to push jdruwe/k8s-product-owner, retrying in 10 seconds (5/5).

...

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default-cli) on project k8s-product-owner: Exception caught: unauthorized: authentication required -> [Help 1]

When I try to login using one of the following commands, I keep getting the errors even tough the login succeeded

docker login -u jdruwe https://index.docker.io/v1/

OR

docker login

I did create an empty repo on hub just to try fixing it:

enter image description here

Any ideas?

like image 541
Jdruwe Avatar asked Oct 07 '16 19:10

Jdruwe


1 Answers

Did you correctly configure the authentication settings?

User and password can be set in settings.xml:

<servers>
  <server>
    <id>docker-hub</id>
    <username>jdruwe</username>
    <password>secret-password</password>
    <configuration>
      <email>[email protected]</email>
    </configuration>
  </server>
</servers>

Then, the pom references these settings:

 <plugin>
  <groupId>com.spotify</groupId>
  <artifactId>docker-maven-plugin</artifactId>
  <version>VERSION GOES HERE</version>
  <configuration>
    [...]
    <serverId>docker-hub</serverId>
    <registryUrl>https://index.docker.io/v1/</registryUrl>
  </configuration>
</plugin>

More detailed information can be found here: https://github.com/spotify/docker-maven-plugin#authenticating-with-private-registries

like image 111
gtonic Avatar answered Sep 17 '22 13:09

gtonic