Create a secret:
$ docker pass set GH_TOKEN=123456789Create a secret from STDIN:
echo "my_val" | docker pass set GH_TOKENRun a container that uses the secret:
$ docker run -e GH_TOKEN= -dt --name demo busyboxInspect the secret from inside the container:
$ docker exec demo sh -c 'echo $GH_TOKEN'
123456789Explicitly assign a secret to a different environment variable:
$ docker run -e GITHUB_TOKEN=se://GH_TOKEN -dt --name demo busyboxStore the secrets:
$ docker pass set myapp/anthropic/api-key=sk-ant-...
$ docker pass set myapp/postgres/password=s3cr3tservices:
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