Skip to content

Commit

Permalink
Add support for Podman auth file in Jib
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Aug 29, 2023
1 parent 1347a17 commit b3b27d8
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,17 @@ private RegistryImage toRegistryImage(ImageReference imageReference, Optional<St
} else {
registryImage.addCredentialRetriever(credentialRetrieverFactory.wellKnownCredentialHelpers());
registryImage.addCredentialRetriever(credentialRetrieverFactory.dockerConfig());

// podman credentials: https://docs.podman.io/en/latest/markdown/podman-login.1.html
// podman for Windows and macOS
registryImage.addCredentialRetriever(credentialRetrieverFactory
.dockerConfig(Paths.get(System.getProperty("user.home"), ".config", "containers", "auth.json")));
String xdgRuntimeDir = System.getenv("XDG_RUNTIME_DIR");
if ((xdgRuntimeDir != null) && !xdgRuntimeDir.isEmpty()) {
registryImage.addCredentialRetriever(
credentialRetrieverFactory.dockerConfig(Paths.get(xdgRuntimeDir, "containers", "auth.json")));
}

String dockerConfigEnv = System.getenv().get("DOCKER_CONFIG");
if (dockerConfigEnv != null) {
Path dockerConfigPath = Path.of(dockerConfigEnv);
Expand Down

0 comments on commit b3b27d8

Please sign in to comment.