| title | Container Runtime Environment Variables | ||
|---|---|---|---|
| expires_at | never | ||
| tags |
|
Diego provides several collections of environment variables to processes running in containers. These include the following layers, in order:
- Environment variables baked into the Docker image (for Docker-image-based containers only)
- Container-level environment variables (defined on the
TaskandDesiredLRPobjects) - Configuration environment variables (LRPs only, described below)
- Process-level environment variables (defined on the
RunActionobject)
LRPs have additional runtime properties that are exposed to processes in the container via environment variables. These are as follows:
INSTANCE_INDEXis an integer denoting the index of theActualLRP. This will be in the range0, 1, 2, ...N-1whereNis the number of instances on theDesiredLRP.INSTANCE_GUIDis a unique identifier associated with anActualLRP. This will change every time a container is created.CF_INSTANCE_INDEXandCF_INSTANCE_GUIDare aliases of these environment variables.
These environment variables are provided only if the operator deploying Diego has enabled -exportNetworkEnvVars on the Cell rep.
CF_INSTANCE_IPprovides the IP of the host running the container. This is the IP used to address the container from the outside.CF_INSTANCE_PORTcontains the host-side port corresponding to the first port in theDesiredLRPportsarray.CF_INSTANCE_ADDRis identical to$CF_INSTANCE_IP:$CF_INSTANCE_PORT.CF_INSTANCE_PORTScontains a list of JSON objects of the form[{"external":60413,"internal":8080},{"external":60414,"internal":2222}]. The internal ports are the container-side ports specified in theDesiredLRPportsarray, and the external ports are the corresponding host-side ports.