Deploying Docker containers with environment variables help

When I’m running my Docker image locally, I can do docker run -e DATABASE_URL="postgres://user:password@localhost:5432/database example-server

What would be the best practice to pass a DATABASE_URL as an environment variable to a Docker container in Render?

I know that the environment variables that you can define in the dashboard are used as Docker build args on the build so that is not a secure way which your documentation also states. I also read about the Docker secrets from here but those are only available at build time, right? So if I add a DATABASE_URL as a secret like that, it will only be visible to the build command but it won’t be available at run time :thinking:

I would set it as an environment variable - it will be available at build and runtime,


John B
Render Support, UTC+1 :uk:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.