Skip to content

Environment variables

Portler injects a set of generated PORTLER_* variables into every service, on top of your .env files and config env. See Environment layering for precedence.

Per-service variables

For every service that has an assigned port, all services receive (with <NAME> being the service name upper-snake-cased, e.g. my-apiMY_API):

VariableValue
PORTLER_<NAME>_PORTAssigned host port
PORTLER_<NAME>_URLFull URL, e.g. http://localhost:51235
PORTLER_<NAME>_HOSTBind host (default 127.0.0.1)
PORTLER_<NAME>_URL_HOSTURL host (default localhost)
PORTLER_<NAME>_PROTOCOLURL scheme (default http)
PORTLER_<NAME>_DESIRED_PORTThe port: declared in portler.yml (only when declared)
PORTLER_<NAME>_CONTAINERDocker container name (Docker services only)
PORTLER_<NAME>_IMAGEDocker image (Docker services only)

When a proxy is configured, it appears as a service named proxy: PORTLER_PROXY_URL, PORTLER_PROXY_PORT, and so on.

Stack-wide variables

VariableValue
PORTLER_SERVICE_NAMESComma-separated, sorted names of all services with an assigned port
PORTLER_SERVICE_NAMEThe name of the service receiving this environment

port_env

Each name listed in a service's port_env: is set to the service's port:

  • Local services get the assigned host port.
  • Docker services get the declared internal container port (the Docker port mapping translates the assigned host port to it).

Variables Portler reads

VariableEffect
PORTLER_VOLUME_SETFallback for --volume-set; selects volume set variants of managed volumes

Inspecting the environment

bash
portler env             # generated + top-level env
portler env backend     # everything the backend would receive

Values reflect current assignments — run it while the stack is up (or after an up) to see real ports.

pnpm note

Portler sets pnpm_config_verify_deps_before_run=false for spawned services (unless you set it yourself). Service stdin is not attached to the terminal, and pnpm's script runner might otherwise abort waiting for an interactive prompt to reinstall dependencies.

Released under the MIT License.