Report this

What is the reason for this report?

How to use App Platform env variables in Docker build phase?

Posted on October 8, 2020
Philippe

By Philippe

CTO

I’m currently trying to port my webapp from heroku to App Platform, and I’m struggling to use env variable set in the App Platform UI in my docker build phase. Any idea? Thanks



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You can pass the values of environment variables from the host to your containers without much effort. Simply don’t specify a value in the command line, and make sure that the environment variable is named the same as the variable the containerized app expects:

$ docker run -e var_name (…) In the above snippet, the value of a var_name variable in the current environment is used to set the value of var_name in the container environment upon startup.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.