How do i set custom environment variables when running build in docker?

custom environment variables are able to to be set in the schedule a build dialog, but how do i do this with docker?

1 Like

Hi @keven-pogrzeba,

Thanks for asking this here! :wink:

You can use App Env Vars and Secret Env Vars in the Workflow Editor to set permanent environment variables. There are also Workflow Env Vars, which are only accessible for that workflow (http://devcenter.bitrise.io/bitrise-cli/workflows/#define-workflow-specific-parameters-environment-variables).

Most likely this is not what you meant, but if you run docker commands in e.g. a Script step you pass env vars the same way you would locally, with the -e flag passed to docker run (e.g. docker run -e "KEY=value" ... - docs: https://docs.docker.com/engine/reference/run/#env-environment-variables).

Unless you run docker commands directly, you can simply use the App/Secret/Workflow Env Vars as noted above.

If you have any questions just let us know!
Happy Building! :slight_smile: