docker / docker/cli

[RFC] UX/Consistency: the state of credential spec

Open
#309 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/stack area/swarm kind/docs
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
on docker service create / docker service update
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 file in the documentation is an absolute path, but paths should be specified relative to C:\ProgramData\docker\CredentialSpecs\, or more factually <docker root>/CredentialSpecs (docker root is configurable)
  • The example file in 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 registry option only expects a registry key name, not the full path (i.e. it searches for a key named "the-key-I-specified" inside HKLM\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 use my-credential-spec.json
    • can we provide an example file, and how to create/generate one (or refer to Windows documentation on creating one)
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 File and Registry be changed to file: and registry: ?
  • do we perform the same validation server-side? (we should)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.