Command Line Interface (CLI) Interaction
This outline covers the interaction mechanisms for the credential helpers, specifically focused on the commands available through the CLI. The CLI commands provide a way for users to interact with the credential helpers.
Command Overview
The credential helpers respond to the following commands, all of which are sent via standard input:
- store: Store a new credential.
- get: Retrieve a credential.
- erase: Remove a credential.
- list: List available credentials.
Command Definitions
store: Stores a new credential. This command accepts a JSON payload containing the credential details, which the credential helper is then expected to store.
Example:
{
"Username": "myuser",
"Secret": "mysecret",
"ServerURL": "https://my.registry.com",
"Email": "[email protected]"
}
The helper should write a success or error message to standard output.
get: Retrieves a credential based on the specified server URL. The helper should write a JSON payload containing the credential to standard output.
Example:
{
"ServerURL": "https://my.registry.com"
}
erase: Removes a credential based on the specified server URL. The helper should write a success or error message to standard output.
Example:
{
"ServerURL": "https://my.registry.com"
}
list: Lists all available credentials. The helper should write a JSON payload containing a list of server URLs to standard output.
Example:
{
"ServerURLs": [
"https://my.registry.com",
"https://another.registry.com"
]
}
Error Handling
If a credential helper encounters an error while processing a command, it should write an error message to standard error. The error message should be informative and provide enough context for the user to understand the problem.
Source Code
- docker-credential-helpers: https://github.com/docker/docker-credential-helpers
- docker-credential-helpers/credential-helpers: tree/master/credential-helpers
- docker-credential-helpers/credential-helpers/native: tree/master/credential-helpers/native
- docker-credential-helpers/credential-helpers/osxkeychain: tree/master/credential-helpers/osxkeychain
Contributing
Contributions are welcome! Please see the CONTRIBUTING.md file for more information.