docker-credential-helpers is a suite of programs to use native stores to keep Docker credentials safe.
Go to the Releases page and download the binary that works better for you. Put that binary in your $PATH
, so Docker can find it.
You can build the credential helpers using Docker:
# install emulators $ docker run --privileged --rm tonistiigi/binfmt --install all # create builder $ docker buildx create --use # build credential helpers from remote repository and output to ./bin/build $ docker buildx bake "https://github.com/docker/docker-credential-helpers.git" # or from local source $ git clone https://github.com/docker/docker-credential-helpers.git $ cd docker-credential-helpers $ docker buildx bake
Or if the toolchain is already installed on your machine:
1 - Download the source.
$ git clone https://github.com/docker/docker-credential-helpers.git $ cd docker-credential-helpers
2 - Use make
to build the program you want. That will leave an executable in the bin
directory inside the repository.
$ make osxkeychain
3 - Put that binary in your $PATH
, so Docker can find it.
$ cp bin/build/docker-credential-osxkeychain /usr/local/bin/
Set the credsStore
option in your ~/.docker/config.json
file with the suffix of the program you want to use. For instance, set it to osxkeychain
if you want to use docker-credential-osxkeychain
.
{ "credsStore": "osxkeychain" }
The sub-package client includes functions to call external programs from your own command line applications.
There are three things you need to know if you need to interact with a helper:
docker-credential-osxkeychain
.https://example.com
.You can see examples of each function in the client documentation.
pass
as credentials store.pass
needs to be configured for docker-credential-pass
to work properly. It must be initialized with a gpg2
key ID. Make sure your GPG key exists is in gpg2
keyring as pass
uses gpg2
instead of the regular gpg
.
A credential helper can be any program that can read values from the standard input. We use the first argument in the command line to differentiate the kind of command to execute. There are four valid values:
store
: Adds credentials to the keychain. The payload in the standard input is a JSON document with ServerURL
, Username
and Secret
.get
: Retrieves credentials from the keychain. The payload in the standard input is the raw value for the ServerURL
.erase
: Removes credentials from the keychain. The payload in the standard input is the raw value for the ServerURL
.list
: Lists stored credentials. There is no standard input payload.This repository also includes libraries to implement new credentials programs in Go. Adding a new helper program is pretty easy. You can see how the OS X keychain helper works in the osxkeychain directory.
credentials.Helper
in YOUR_PACKAGE/
YOUR_PACKAGE/cmd/
.MIT. See LICENSE for more information.