I am trying to build an image using jib plugin with below configuration from my mac m1. I have Rancher Desktop installed and configured my personal Docker hub registry access token like below.
Note: I can able to push the image using direct auth credentials in my gradle file.
Using Mac M1
~./docker/config.json
{
"auths": {
{
"registry.hub.docker.com": {
"auth": "dckr_pat_<EncryptValue>"
}
}
},
"credsStore": "osxkeychain"
}
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.0'
id 'io.spring.dependency-management' version '1.1.4'
id 'com.google.cloud.tools.jib' version '3.4.0'
}
group = 'com.package'
version = '0.0.1-SNAPSHOT'
java {
sourceCompatibility = '17'
}
jib {
from {
image = 'openjdk:17-slim'
}
container {
//jvmFlags = ['-Dmy.property=example.value', '-Xms512m', '-Xdebug']
mainClass = 'com.package.K8sLearningApplication'
ports = ['8080']
//labels = [key1:'value1', key2:'value2']
//format = 'OCI'
}
to {
image = '<dockerhubuserid>/k8s-learning:latest'
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.named('test') {
useJUnitPlatform()
}
Error log
com.google.cloud.tools.jib.plugins.common.BuildStepsExecutionException: Build image failed, perhaps you should make sure your credentials for 'registry-1.docker.io/<userid>/k8s-learning' are set up correctly. See https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#what-should-i-do-when-the-registry-responds-with-unauthorized for help