Skip to content
Skip to content
PGB Learn

Container environment variables, secrets and logs

Configure your container with variables and project secrets, and read build and runtime logs to fix problems.

Updated Nov 12, 2026

Environment variables

  1. Open Containers, choose Configure on your container, then open the Environment Variables tab.
  2. Choose + Add Variable, enter a name and value, and repeat as needed.
  3. Choose Save Container Attributes.

Variables are given to your app when it starts. Names use letters, digits and underscores and cannot start with a digit. Each value can be up to 32 KB. Changes take effect on the next deploy, so choose Redeploy after saving.

Some variables are added for you, including DATABASE_URL, STORAGE_BUCKET and PGB_PROJECT_ID, so your app can reach your project's database and storage with no setup.

Project-wide secrets

Keys and passwords belong in Secrets & Env (sidebar > Configuration), not in a container's variable list. Secrets are encrypted and are injected into every container in the project. On a container's Environment Variables tab, they appear as "Project-wide variables". Click one to override it for just that container. If a container variable has the same name as a secret, the container's value wins.

Values are masked after you save them.

Environment tags

Each container has a Deployment Environment: Live / Production, Staging Branch or Development / Preview. It is a tag for routing and keeping environments apart. Use Duplicate to clone a container into a staging or development copy with its own variables.

Read the logs

  • Deploy Logs: the build output. Use it when a deploy fails. Refresh to update.
  • Runtime Logs: what your app prints while running. Turn on Auto-refresh (5s) to follow along. Use it when the deploy worked but the app crashes or misbehaves.
  • Unified Logs (sidebar > Observability) shows all your project's services in one stream.

Troubleshooting

Symptom Check
Build fails Read Deploy Logs. Check the Build Command and Start Command, or your Dockerfile.
It deploys but returns errors Read Runtime Logs. Check the Internal Port matches the port your app listens on.
It never becomes ready after waking Check that your Health Check Endpoint exists and returns success.
The first request after idle is slow Normal for scale to zero. See Scale to zero.
It stopped with SUSPENDED It reached its disk limit. Clear space and redeploy.

Good to know

  • Anything printed to standard output or error shows in Runtime Logs, so avoid printing secrets.

More guides in Console: containers & domains