Struggling to publish to hub.docker.com with spring boot maven plugin

  docker, maven, spring-boot

I’m using the spring boot maven plugin to create my docker image. This works as expected however I am struggling to publish the generated image to docker. I’ve looked at the examples on the spring boot maven plugin reference but having no joy with it. I have run: docker login -u me on the terminal and able to push manually

When I use the following configuration in the spring boot plugin:

   <docker>
     <publishRegistry>
       <url>https://index.docker.io/v1</url>
       <username>me</username>
       <password>password</password>
       <email>[email protected]</email>
     </publishRegistry>
   </docker>

I receive: Execution pkg of goal org.springframework.boot:spring-boot-maven-plugin:2.5.3:build-image failed: Error response received when pushing image: denied: requested access to the resource is denied

When using this:

   <docker>
     <publishRegistry>
       <url>https://index.docker.io/v1</url>
       <username>me</username>
       <token>hub.docker.com-generated-token</token>
       <email>[email protected]</email>
     </publishRegistry>
   </docker>

I receive: Execution pkg of goal org.springframework.boot:spring-boot-maven-plugin:2.5.3:build-image failed: Error response received when pushing image: unauthorized: refresh_token grants not allowed

I’ve tried looking around for a working example but having no luck. Would anyone be able to point out the folly of my ways?

Many thanks

spring-boot: 2.5.3
java: 16.0.1
linux: mint 20.2

Source: Docker Questions

LEAVE A COMMENT