Package org.mandas.docker.client.auth
Class ConfigFileRegistryAuthSupplier
- java.lang.Object
-
- org.mandas.docker.client.auth.ConfigFileRegistryAuthSupplier
-
- All Implemented Interfaces:
RegistryAuthSupplier
public class ConfigFileRegistryAuthSupplier extends Object implements RegistryAuthSupplier
RegistryAuthSupplier that returns data from the docker-cli config file. The config file is re-read on each method call, to handle cases where a process is updating the file out-of-band during the lifecycle of a DockerClient instance.
-
-
Constructor Summary
Constructors Constructor Description ConfigFileRegistryAuthSupplier()ConfigFileRegistryAuthSupplier(DockerConfigReader reader)ConfigFileRegistryAuthSupplier(DockerConfigReader reader, Path path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RegistryAuthauthFor(String imageName)Returns a RegistryAuth object that works with a given registry's API [e.g.RegistryConfigsauthForBuild()Authentication info to pass in the X-Registry-Config header when building an image.RegistryAuthauthForSwarm()Returns a RegistryAuth object that is valid for a Docker Swarm context [i.e.
-
-
-
Constructor Detail
-
ConfigFileRegistryAuthSupplier
public ConfigFileRegistryAuthSupplier()
-
ConfigFileRegistryAuthSupplier
public ConfigFileRegistryAuthSupplier(DockerConfigReader reader)
-
ConfigFileRegistryAuthSupplier
public ConfigFileRegistryAuthSupplier(DockerConfigReader reader, Path path)
-
-
Method Detail
-
authFor
public RegistryAuth authFor(String imageName) throws DockerException
Description copied from interface:RegistryAuthSupplierReturns a RegistryAuth object that works with a given registry's API [e.g. GCR].- Specified by:
authForin interfaceRegistryAuthSupplier- Returns:
- the RegistryAuth to use when working with the image, or else
nullif no authentication info applies for this image - Throws:
DockerException
-
authForSwarm
public RegistryAuth authForSwarm() throws DockerException
Description copied from interface:RegistryAuthSupplierReturns a RegistryAuth object that is valid for a Docker Swarm context [i.e. not tied to specific image]. It's unnecessary if it's not planned to use this AuthSupplier to pull images for Swarm.- Specified by:
authForSwarmin interfaceRegistryAuthSupplier- Returns:
- the RegistryAuth to use in Swarn, or else
nullfor no authentication info - Throws:
DockerException
-
authForBuild
public RegistryConfigs authForBuild() throws DockerException
Description copied from interface:RegistryAuthSupplierAuthentication info to pass in the X-Registry-Config header when building an image.- Specified by:
authForBuildin interfaceRegistryAuthSupplier- Returns:
- the registry configs
- Throws:
DockerException
-
-