'How to push a docker image to remote registry with gradle in a spring boot project

I want to use that ./gradlew bootBuildImage comman to build a docker Image.

That command works perfectaly on my localmachine.

I have a remote docker registry on my server, and I want to push my Images from my local machine directly into my registry using bootBuildImage

To achieve that I added this into my build gradle.

tasks.named("bootBuildImage") {
    docker {
        builderRegistry {
            username = "admin"
            password = "secret-password"
            url = "https://registry.myserver.com"
        }
    }
}

On ./gradlew bootBuildImage

I got this Error:

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':bootBuildImage'.

Docker API call to 'localhost/v1.24/images/create?fromImage=docker.io%2Fpaketobuildpacks%2Fbuilder%3Abase' failed with status code 500 "Internal Server Error" and message "Head "https://registry-1.docker.io/v2/paketobuildpacks/builder/manifests/base": una uthorized: incorrect username or password"

Username & Password are 100% correct.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source