CLIdock env

dock env

Manage project environment variables.

Environment variables are settings your app reads while it runs. They are where you put secrets, database URLs, API keys, and production settings.

Do not commit secrets Put secrets in DockHosting environment variables, not in Git.

Commands

dock env ls [project]
dock env set KEY=VALUE [KEY=VALUE...]
dock env unset KEY [KEY...]

List variables

dock env ls
dock env ls my-app

Prints the variables configured for the project.

Set variables

dock env set NODE_ENV=production API_URL=https://api.example.com

Sets one or more variables. Values are stored on the project.

Remove variables

dock env unset DEBUG OLD_SECRET

Removes one or more keys.

Applying changes

After changing environment variables, run dock deploy or restart the project so the container sees the new values.

What KEY=VALUE means

KEY is the variable name. VALUE is the value your app reads.

dock env set NODE_ENV=production

Your app reads it as:

process.env.NODE_ENV

Common variables

VariableWhat it usually means
DATABASE_URLFull database connection string
NODE_ENVNode.js mode, usually production
PORTPort your app listens on
API_KEYSecret token for an external service
REDIS_URLRedis/Valkey connection string