[RFC] UX/Consistency: the state of credential spec
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
While working on https://github.com/moby/moby/pull/34002, I noticed there's a lot of confusing bits in this feature that we may want to improve on;
on docker run / docker create
-
set through
--security-opt credentialspec=file://foo(https://github.com/moby/moby/pull/23389) -
flag
--credentialspecwas not implemented, and removed in https://github.com/moby/moby/pull/31976 -
compose-file (version: 2 - undocumented https://docs.docker.com/compose/compose-file/compose-file-v2/#security_opt):
version: '2' services: sqlserver: ... security_opt: - "credentialspec=file://sqlserverapp.json"
on docker service create / docker service update
- set through dedicated flag:
--credential-spec=file://foo(https://github.com/moby/moby/pull/32339) - compose-file (version 3): https://docs.docker.com/compose/compose-file/#credential_spec
- top-level option for service
Docker compose docs / implementation (version 3):
Documentation needs some updating;
credential_spec:
file: c:/WINDOWS/my-credential-spec.txt
credential_spec:
registry: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Containers\CredentialSpecs
Using:
registry: "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Containers\CredentialSpecs"
Produces an error:
yaml: line 6: found unknown escape character
And has to be changed to;
registry: "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\Containers\\CredentialSpecs"
In addition:
- The example
filein the documentation is an absolute path, but paths should be specified relative toC:\ProgramData\docker\CredentialSpecs\, or more factually<docker root>/CredentialSpecs(docker rootis configurable) - The example
filein the documentation is specified using a Linux path, but should use Windows (backslash, instead of forward slash) - We should explain if "file" refers to a file on the local host, the daemon host, or inside the container
- The
registryoption only expects a registry key name, not the full path (i.e. it searches for a key named "the-key-I-specified" insideHKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Containers\CredentialSpecs) - There's no example of the expected format of the credential specs file
- the example shows
.txt, but the credential specs file is actually a JSON file, in which case, our example should usemy-credential-spec.json - can we provide an example file, and how to create/generate one (or refer to Windows documentation on creating one)
- the example shows
Error message consistency
Using this compose file;
version: '3.3'
services:
web:
image: "nginx:alpine"
credential_spec:
file: c:/WINDOWS/my-credential-spec.txt
registry: "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Virtualization\\Containers\\CredentialSpecs"
produces an error, because both file: and registry: is specified;
service web: Invalid credential spec - must provide one of `File` or `Registry`
The error is correct, but given that this error is generated client-side;
- should
FileandRegistrybe changed tofile:andregistry:? - do we perform the same validation server-side? (we should)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Docker CLI credential-spec entry points for docker run/create and service create/update, then compare the Compose v2 and v3 documentation and client-side validation described here. Resolve the proposed option names, path and registry semantics, examples, and server-side validation scope. Done means the behavior and documentation are consistent and the conflicting file/registry case is validated consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli, documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100