Read DOCKER_AGENT_ENV_-prefixed secret variables before the plain names
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Overview
Let docker-agent read DOCKER_AGENT_ENV_<NAME> in preference to <NAME> for every secret it resolves (e.g. DOCKER_AGENT_ENV_ANTHROPIC_API_KEY before ANTHROPIC_API_KEY).
Motivation
docker-agent resolves op:// 1Password references, which is a nice way to avoid plain-text keys. But the variable names are shared with other tools: exporting ANTHROPIC_API_KEY="op://…" in the shell breaks Claude Code, Codex and provider SDKs, which do not resolve op://. Today the workarounds are the docker-agent env file (~/.config/cagent/.env) or a per-model token_key, which must be repeated in every model of every config and does not apply to --model provider/model.
Use cases
export DOCKER_AGENT_ENV_ANTHROPIC_API_KEY="op://Personal/Anthropic/api-key"
export ANTHROPIC_API_KEY=sk-ant-... # or unset; used by other tools
docker agent run agent.yaml # uses the op:// reference
Also lets a user point docker-agent at a different key (separate billing/project) without touching other tools.
Proposed solution
A PrefixedProvider decorator in pkg/environment, wired through a single chain constructor as OnePassword(Prefixed(Multi(sources...))), so a prefixed value can itself be an op:// reference.
Decisions (revised after code review, see the comment below):
- Prefix
DOCKER_AGENT_ENV_.DOCKER_AGENT_is docker-agent's settings namespace; names already in it are never looked up as overrides. - Precedence:
DOCKER_AGENT_ENV_<NAME>wins across the whole chain,--env-from-fileincluded. - Empty values: an empty override is ignored and
<NAME>is used.
Doctor and follow-ups:
docker agent doctor(findSource) queries sources directly and would report the key as missing; teach it the prefix and show which name supplied the value.- The TUI transcriber reads
OPENAI_API_KEYwithos.Getenv(bypassing bothop://and the prefix); fixing it needs lazy resolution, so it is deferred to a separate PR.
Known limitation: in --sandbox, keys Docker Desktop proxies itself (OPENAI_API_KEY, ANTHROPIC_API_KEY, …) never go through our chain, so neither op:// nor the prefix applies to them there. Documented, not changed.
Alternatives
- Per-model
token_key: works, but verbose and not available for--modelshorthand. - Docker Agent env file: works, but a plain shell export of the same name still wins, which is the common setup for users of several AI tools.
Related issues
- #4701: docs fix for the credential helper scope and an
op://isolation tip. - #4703: credential helper for all secrets.
- #4708: implementation.
- Lingua principale
- Go
- Stelle
- 4.6k
- Fork
- 522
- Merge medio
- 11h 42m
- PR unite (30g)
- 208
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di docker/docker-agent
-
Error when trying to run sandbox example?Forse già presa @dgageot l’ha presa 2 giorni fa. Apertaarea/cli
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
docker/docker-agent#4672 · 1 commento · 1 reazione · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
pkg/hooks tests fail with a misleading assertion when jq is not installedForse già presa @dwin-gharibi l’ha presa 60 giorni fa. Apertaarea/testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
docker/docker-agent#4052 ·
I maintainer di solito rispondono entro 1 giorno
-
`remove_directory` and `create_directory` hide work they already did when a later path failsForse già presa @dwin-gharibi l’ha presa 78 giorni fa. Apertaarea/tools
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
docker/docker-agent#3933 ·
I maintainer di solito rispondono entro 1 giorno
-
`edit_file` silently edits the first match when `oldText` occurs more than onceForse già presa @dwin-gharibi l’ha presa 78 giorni fa. Apertaarea/tools
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
docker/docker-agent#3929 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
area/config area/mcp area/providers area/security kind/feat status/needs-design
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
docker/docker-agent#4703 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di docker/docker-agent
Issue simili
-
[BUG] deploy.restart_policy without condition drops the restart policyForse già presa @akshat-lakhera l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
docker/compose#14383 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
AvengeMedia/dank-greeter#39 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
dokku/dokku-datastore#367 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: ap gateway image build cannot find local policies on WindowsForse già presa @Jayzilva l’ha presa oggi. ApertaAspect/Configuration Severity/Major
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
wso2/api-platform#3912 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni