From d5cffbc48f4e7f1ed834547f04c274c6d13d11a4 Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Mon, 22 May 2017 16:50:56 -0400 Subject: [PATCH] ensure build() works as expected when dockerAuth is true --- .../com/spotify/docker/client/DefaultDockerClient.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/spotify/docker/client/DefaultDockerClient.java b/src/main/java/com/spotify/docker/client/DefaultDockerClient.java index 5e9d15744..e3f2191c2 100644 --- a/src/main/java/com/spotify/docker/client/DefaultDockerClient.java +++ b/src/main/java/com/spotify/docker/client/DefaultDockerClient.java @@ -2630,7 +2630,9 @@ public boolean dockerAuth() { * * @param dockerAuth tells if Docker auth info should be used * @return Builder + * @deprecated in favor of {@link #registryAuthSupplier(RegistryAuthSupplier)} */ + @Deprecated public Builder dockerAuth(final boolean dockerAuth) { this.dockerAuth = dockerAuth; return this; @@ -2646,7 +2648,7 @@ public RegistryAuth registryAuth() { * @param registryAuth RegistryAuth object * @return Builder * - * @deprecated in favor of registryAuthSupplier + * @deprecated in favor of {@link #registryAuthSupplier(RegistryAuthSupplier)} */ @Deprecated public Builder registryAuth(final RegistryAuth registryAuth) { @@ -2676,9 +2678,9 @@ public Builder registryAuthSupplier(final RegistryAuthSupplier registryAuthSuppl } public DefaultDockerClient build() { - if (dockerAuth) { + if (dockerAuth && registryAuthSupplier == null && registryAuth == null) { try { - this.registryAuth = RegistryAuth.fromDockerConfig().build(); + registryAuth(RegistryAuth.fromDockerConfig().build()); } catch (IOException e) { log.warn("Unable to use Docker auth info", e); }