Class DockerCredentialHelper
- java.lang.Object
-
- com.google.cloud.tools.jib.registry.credentials.DockerCredentialHelper
-
public class DockerCredentialHelper extends java.lang.Object
Retrieves Docker credentials with a Docker credential helper.
-
-
Constructor Summary
Constructors Constructor Description DockerCredentialHelper(java.lang.String serverUrl, java.nio.file.Path credentialHelper)
Constructs a newDockerCredentialHelper
.DockerCredentialHelper(java.lang.String serverUrl, java.nio.file.Path credentialHelper, java.util.Map<java.lang.String,java.lang.String> environment)
Constructs a newDockerCredentialHelper
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Credential
retrieve()
Calls the credential helper CLI.
-
-
-
Constructor Detail
-
DockerCredentialHelper
public DockerCredentialHelper(java.lang.String serverUrl, java.nio.file.Path credentialHelper)
Constructs a newDockerCredentialHelper
.- Parameters:
serverUrl
- the server URL to pass into the credential helpercredentialHelper
- the path to the credential helper executable
-
DockerCredentialHelper
public DockerCredentialHelper(java.lang.String serverUrl, java.nio.file.Path credentialHelper, java.util.Map<java.lang.String,java.lang.String> environment)
Constructs a newDockerCredentialHelper
.- Parameters:
serverUrl
- the server URL to pass into the credential helpercredentialHelper
- the path to the credential helper executableenvironment
- environment variables used in configuring the credential helper
-
-
Method Detail
-
retrieve
public Credential retrieve() throws java.io.IOException, CredentialHelperUnhandledServerUrlException, CredentialHelperNotFoundException
Calls the credential helper CLI.Calls occur in the form:
echo -n <server URL> | docker-credential-<credential helper suffix> get
- Returns:
- the Docker credentials by calling the corresponding CLI
- Throws:
java.io.IOException
- if writing/reading process input/output failsCredentialHelperUnhandledServerUrlException
- if no credentials could be found for the corresponding serverCredentialHelperNotFoundException
- if the credential helper CLI doesn't exist
-
-