Read DOCKER_AGENT_ENV_-prefixed secret variables before the plain names
Los mantenedores suelen responder en 1 día
@aheritier ya está trabajando en esto.
Desde el 22/10/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.
- Lenguaje dominante
- Go
- Estrellas
- 4.6k
- Forks
- 522
- Merge medio
- 10 h 33 min
- PR fusionados (30 d)
- 231
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de docker/docker-agent
-
Error when trying to run sandbox example?Posiblemente ocupada @dgageot la tomó hace 2 días. Abiertoarea/cli
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
docker/docker-agent#4672 · 1 comentario · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
pkg/hooks tests fail with a misleading assertion when jq is not installedPosiblemente ocupada @dwin-gharibi la tomó hace 59 días. Abiertoarea/testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
docker/docker-agent#4052 ·
Los mantenedores suelen responder en 1 día
-
`remove_directory` and `create_directory` hide work they already did when a later path failsPosiblemente ocupada @dwin-gharibi la tomó hace 78 días. Abiertoarea/tools
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
docker/docker-agent#3933 ·
Los mantenedores suelen responder en 1 día
-
`edit_file` silently edits the first match when `oldText` occurs more than oncePosiblemente ocupada @dwin-gharibi la tomó hace 78 días. Abiertoarea/tools
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
docker/docker-agent#3929 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
area/config area/mcp area/providers area/security kind/feat status/needs-design
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
docker/docker-agent#4703 ·
Los mantenedores suelen responder en 1 día
Todos los issues de docker/docker-agent
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 63/100
Los mantenedores suelen responder en 1 día
-
[Bug]: APIGW request ID headers are inconsistent between server and clientPosiblemente ocupada @zouxingyuks la tomó hoy. Abiertoproduct/backlog
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
TencentBlueKing/bk-nodemgr#3782 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
praetorianer777/Dynamo#53 ·
Los mantenedores suelen responder en 1 día
-
internal test setup
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
SAP/terraform-provider-scc#430 ·