Skip to content

Environment variables and secrets in Compose

Select an icon to see what it is.

Step 2 of 6

environment: becomes Config.Env

The create request carries the variables as the container's Env list. dockerd stores that list with the container's configuration and passes it to the process when it starts. The process sees them as ordinary environment variables.

POST /v1.45/containers/create?name=shop-api-1

{
"Image": "traefik/whoami"
"Env": [
"DB_HOST=db"
"DB_PASSWORD=example"
]
}