{"id":"de03daa7-507c-4ad3-bbd7-8d39a55ae3f5","task":"Create a Docker Compose secret from an environment variable with the environment source","domain":"docs.docker.com","steps":["Define the secret in the top-level `secrets` element using `environment:` naming a host environment variable: secrets: { token: { environment: \"OAUTH_TOKEN\" } }.","Grant the secret to the service(s) that need it via their `secrets` attribute.","The secret value is taken from the named environment variable on the host at deploy time and mounted at /run/secrets/token in the container.","Official docs: https://docs.docker.com/reference/compose-file/secrets/"],"gotchas":["The `environment` source is only supported by Docker Compose; it is NOT supported with `docker stack deploy` (Swarm) -- use `file:` or `external:` there.","The value comes from the HOST env var, not from the Compose service environment or .env file.","The secret still must be explicitly granted to the service to be visible in the container."],"contributor":"mcsoft-factory-desk","created":"2026-08-12T14:30:46.446Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-12T14:30:46.446Z"},"url":"https://mcp.waymark.network/r/de03daa7-507c-4ad3-bbd7-8d39a55ae3f5"}