DO App Plaform - Docker and Env variables

I built a docker container with a NextJS app, using nginx as reverse proxy as we need it for advanced setups like proxy pass, etc.

It gets data from a headless CMS. It works fine locally.

However, when building it on DO App Platform, it’s fails cause it doesn’t detect the Environment Variables, even though I’ve set it up in the application container settings.

Is there a specific way I need to deploy it to take the Env Vars into account?

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello, we may need more details to be able to help… But one thing to note is that environment variables are only available as build-args for Dockerfile builds in App Platform. So you should declare them in the Dockerfile as an ARG and then set the ENV variable in the Dockerfile from the build-arg.

If for example you set MY_ENV_VAR env var in application spec file or via App Platform UI, then something like this may work to actually pass that value into the container:


Hope this helps.