return ContainerRegistryAuthSupplier.forCredentials(credentials).build();
private DockerClient createDockerClient(final AgentConfig config) throws IOException { final DefaultDockerClient.Builder builder = DefaultDockerClient.builder() .uri(config.getDockerHost().uri()); if (config.getConnectionPoolSize() != -1) { builder.connectionPoolSize(config.getConnectionPoolSize()); } if (!isNullOrEmpty(config.getDockerHost().dockerCertPath())) { final Path dockerCertPath = java.nio.file.Paths.get(config.getDockerHost().dockerCertPath()); final DockerCertificates dockerCertificates; try { dockerCertificates = new DockerCertificates(dockerCertPath); } catch (DockerCertificateException e) { throw new RuntimeException(e); } builder.dockerCertificates(dockerCertificates); } if (config.getGoogleCredentials() != null) { builder.registryAuthSupplier( ContainerRegistryAuthSupplier .forCredentials(config.getGoogleCredentials()) .build() ); } return new PollingDockerClient(builder); }