spring-guides / gs-spring-boot-docker

Spring Boot with Docker :: Learn how to create a Docker container from a Spring Boot application with Maven or Gradle

Home Page:https://spring.io/guides/gs/spring-boot-docker/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

az acr login && mvn compile jib:build fails with I/O error for image

ipraveenjain opened this issue · comments

i am trying to deploy spring boot application on AKS ,
using the link
https://docs.microsoft.com/en-us/azure/developer/java/spring-framework/deploy-spring-boot-java-app-on-kubernetes

but getting below error
[WARNING] Base image 'mcr.microsoft.com/java/jdk:8-zulu-alpine' does not use a specific image digest - build may not be reproducible
[INFO] Using credentials from Docker config (C:\Users\pravjain.I-FLEX.docker\config.json) for praragistry.azurecr.io/gs-spring-boot-docker
[INFO] Using base image with digest: sha256:37fb904abc23b06f73364294b6483f184f046e8a38d7ce1103609e622fb39abf
[INFO]
[INFO] Container entrypoint set to [java, -cp, /app/resources:/app/classes:/app/libs/*, hello.Application]
[ERROR] I/O error for image [praragistry.azurecr.io/gs-spring-boot-docker]:
[ERROR] javax.net.ssl.SSLHandshakeException
[ERROR] Remote host closed connection during handshake
[ERROR] I/O error for image [praragistry.azurecr.io/gs-spring-boot-docker]:
[ERROR] javax.net.ssl.SSLHandshakeException
[ERROR] Remote host closed connection during handshake
[ERROR] I/O error for image [praragistry.azurecr.io/gs-spring-boot-docker]:
[ERROR] org.apache.http.NoHttpResponseException
[ERROR] The target server failed to respond
[ERROR] I/O error for image [praragistry.azurecr.io/gs-spring-boot-docker]:
[ERROR] java.net.SocketException
[ERROR] Connection reset by peer: socket write error
[ERROR] I/O error for image [praragistry.azurecr.io/gs-spring-boot-docker]:
[ERROR] java.net.SocketException
[ERROR] Connection closed by remote host

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:2.2.0:build (default-cli) on project gs-spring-boot-docker: Connection reset by peer: socket write error -> [Help 1]

what should i do to fix it ?

Looks like an authentication issue with the Azure container registry. Not really a problem with this guide per se, so please ask for help on Stack overflow, or Jib or Azure support channels.

This error happens because the docker password was wrong.

  1. Check your .docker/config.json configuration or replace like below.
    { "auths": { "XXXRegistry.azurecr.io": {} }, "credsStore": "desktop" }

  2. before running the mvn compile:jib:build execute the following command.
    Go to your registry and copy the username password by enabling the admin button
    image

docker login XXXXtregistry.azurecr.io --username XXXX --password =XXXXX

Then run the below command it should give you the same username password you used above.
echo XXXXtregistry.azurecr.io | docker-credential-desktop get

  1. now just run mvn compile jib:build alone. if you include the az acr login it will replace your docker password causes the error.