-
Notifications
You must be signed in to change notification settings - Fork 6
feat: refine docs #531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: refine docs #531
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| ### Remove a specific secret: | ||
|
|
||
| ```console | ||
| $ docker pass rm GH_TOKEN | ||
| ``` | ||
|
|
||
| ### Remove multiple secrets: | ||
|
|
||
| ```console | ||
| $ docker pass rm GH_TOKEN NPM_TOKEN | ||
| ``` | ||
|
|
||
| ### Remove all secrets: | ||
|
|
||
| ```console | ||
| $ docker pass rm --all | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| ### Run a command with one secret in its environment: | ||
|
|
||
| ```console | ||
| $ SE_TOKEN=se://gh-token docker pass run -- gh repo list | ||
| ``` | ||
|
|
||
| ### Multiple references: | ||
|
|
||
| ```console | ||
| $ DB_PASSWORD=se://myapp/postgres/password API_KEY=se://myapp/anthropic/api-key docker pass run -- ./my-binary | ||
| ``` | ||
|
|
||
| ### Resolve references from a dotenv file: | ||
|
|
||
| ```console | ||
| $ docker pass run --env-file .env -- ./my-binary | ||
| ``` | ||
|
|
||
| ### Multiple files (later overrides earlier; files override the process environment): | ||
|
|
||
| ```console | ||
| $ docker pass run --env-file .env --env-file .env.local -- ./my-binary | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| ### Set a secret: | ||
|
|
||
| ```console | ||
| $ docker pass set POSTGRES_PASSWORD=my-secret-password | ||
| ``` | ||
|
|
||
| ### Or pass the secret via STDIN: | ||
|
|
||
| ```console | ||
| $ echo my-secret-password > pwd.txt | ||
| $ cat pwd.txt | docker pass set POSTGRES_PASSWORD | ||
| ``` | ||
|
|
||
| ### Set a secret with metadata: | ||
|
|
||
| ```console | ||
| $ docker pass set POSTGRES_PASSWORD=my-secret-password --metadata owner=alice --metadata expiry=2027-03-01 | ||
| ``` | ||
|
|
||
| ### Or pass a JSON payload with secret and metadata via STDIN: | ||
|
|
||
| ```console | ||
| $ echo '{"secret":"my-secret-password","metadata":{"owner":"alice"}}' | docker pass set POSTGRES_PASSWORD | ||
| ``` | ||
|
|
||
| ### Overwrite an existing secret: | ||
|
|
||
| ```console | ||
| $ docker pass set POSTGRES_PASSWORD=new-secret-password --force | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| ### Using keychain secrets in containers | ||
|
|
||
| Create a secret: | ||
|
|
||
| ```console | ||
| $ docker pass set GH_TOKEN=123456789 | ||
| ``` | ||
|
|
||
| Create a secret from STDIN: | ||
|
|
||
| ```console | ||
| echo "my_val" | docker pass set GH_TOKEN | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [MEDIUM] Inconsistent shell prompt prefix in Every other echo "my_val" | docker pass set GH_TOKENThis makes the line look like output rather than a command to type, which will confuse users reading $ echo "my_val" | docker pass set GH_TOKEN |
||
| ``` | ||
|
|
||
| Run a container that uses the secret: | ||
|
|
||
| ```console | ||
| $ docker run -e GH_TOKEN= -dt --name demo busybox | ||
| ``` | ||
|
|
||
| Inspect the secret from inside the container: | ||
|
|
||
| ```console | ||
| $ docker exec demo sh -c 'echo $GH_TOKEN' | ||
| 123456789 | ||
| ``` | ||
|
|
||
| Explicitly assign a secret to a different environment variable: | ||
|
|
||
| ```console | ||
| $ docker run -e GITHUB_TOKEN=se://GH_TOKEN -dt --name demo busybox | ||
| ``` | ||
|
|
||
| ### Using keychain secrets in Compose | ||
|
|
||
| Store the secrets: | ||
|
|
||
| ```console | ||
| $ docker pass set myapp/anthropic/api-key=sk-ant-... | ||
| $ docker pass set myapp/postgres/password=s3cr3t | ||
| ``` | ||
|
|
||
| ```yaml | ||
| services: | ||
| api: | ||
| image: service1 | ||
| environment: | ||
| - ANTHROPIC_API_KEY=se://myapp/anthropic/api-key | ||
| - POSTGRES_PASSWORD=se://myapp/postgres/password | ||
|
|
||
| worker: | ||
| image: service2 | ||
| command: worker | ||
| environment: | ||
| - ANTHROPIC_API_KEY=se://myapp/anthropic/api-key | ||
|
|
||
| db: | ||
| image: postgres:17 | ||
| environment: | ||
| - POSTGRES_PASSWORD=se://myapp/postgres/password | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[MEDIUM]
se://<ID|pattern>in Long description misrepresents supported syntaxThe updated
Longdescription says:This implies glob/wildcard patterns (e.g.
se://myapp/*) are accepted. However, the underlyingresolveReffunction callssecrets.ParseID(name)first, which validates only[A-Za-z0-9._:-/]— the*wildcard character is explicitly excluded. Anyse://reference containing a wildcard is rejected before pattern resolution is attempted.The original description said
se://NAME, which accurately reflected the supported syntax. Consider reverting tose://<NAME>orse://<ID>to avoid misleading users who will get a cryptic error when they tryse://myapp/*.