From 997488359b156e6a06c0a6f1de8db054e04715b9 Mon Sep 17 00:00:00 2001
From: Georgios Andrianakis <geoand@gmail.com>
Date: Wed, 24 Aug 2022 09:09:58 +0300
Subject: [PATCH] Add support for DOCKER_CONFIG env var when using Jib

Resolves: #27460

Co-authored-by: George Gastaldi <gegastaldi@gmail.com>
(cherry picked from commit 8b042dbca97abfce3d360f6e455dfabdda0cdcf3)
---
 .../quarkus/container/image/jib/deployment/JibProcessor.java  | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java
index 98bc4aa5c7708..41a20eff3c8f6 100644
--- a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java
+++ b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java
@@ -333,6 +333,10 @@ private RegistryImage toRegistryImage(ImageReference imageReference, Optional<St
         } else {
             registryImage.addCredentialRetriever(credentialRetrieverFactory.wellKnownCredentialHelpers());
             registryImage.addCredentialRetriever(credentialRetrieverFactory.dockerConfig());
+            String dockerConfigEnv = System.getenv().get("DOCKER_CONFIG");
+            if (dockerConfigEnv != null) {
+                registryImage.addCredentialRetriever(credentialRetrieverFactory.dockerConfig(Path.of(dockerConfigEnv)));
+            }
         }
         return registryImage;
     }