Share CLI credentials over a unix socket #5948
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a proof of concept to share docker credentials from the CLI.
Related to #5858
What is the benefit of this?
curl http://localhost/credentials --unix-socket ~/.docker/run/docker_cli_credential_server.sock
- What I did
Created a command called
auth
which is a manager for the CLI credentials. This allows us to expose the credentials that the CLI have access to (config, credential helper etc.).docker auth credential-server
This will create a new unix socket inside the default docker config directory
~/.docker/run/docker_cli_credential_server.sock
. Using this socket you can retrieve the credentials, save credentials back and delete credentials.The CLI has a built in mechanism that would detect the
docker_cli_credential_server.sock
and implements thecredentials.Store
interface so that any calls to the socket would correctly returntypes.AuthConfig
as normal. This means that the socket iteslf becomes a credential store.This also solves situatations where the docker CLI need credentials when run inside of a docker container.
- How I did it
- How to verify it
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)