Using Environment Variables
Environment variables are key-value pairs that can be used to configure and customize the behaviour of server running inside a container. These variables are accessible to processes running within the container and are commonly used to store configuration settings, credentials, and other runtime information.
In Salad Portal, you can set environment variables for your containers by providing a key-value pair. The ”key” represents the name of the environment variable, and the ”value” represents its associated data.
📘 Default Environment Variables
Note that there are several environment variables that are always passed to, and accessible from, the container:
SALAD_MACHINE_ID is the ID of the machine the particular container instance is running on.
SALAD_CONTAINER_GROUP_ID is the ID of the entire container group.
HOSTNAME
Using Environment Variables in Salad Portal
To use environment variables in Salad Portal, follow these steps:
Step 1: Deploy a New Container
If you haven’t already, create a new container group. Please refer to our separate documentation on ”How to Create a Container” for detailed instructions on this step.
Step 2: Configure Environment Variables
In the container group creation or configuration process, locate the “Environment Variables” section in Optional Settings and click on the “Edit” button.
![](https://mintlify.s3-us-west-1.amazonaws.com/salad/container-engine/images/0e27b45-Screenshot_2024-03-12_162642.png)
Enter the key and value for the environment variable you want to set and click the “Configure” button to confirm the environment variable. Example: Key: APP_VERSION and Value: v2.1.0
![](https://mintlify.s3-us-west-1.amazonaws.com/salad/container-engine/images/62befd0-image.png)
Step 3 : Run Your Container
Once the container is configured, you can deploy it by clicking on button “Deploy”. Salad Portal will deploy the container group and you can start the container by click on “Start” button.
![](https://mintlify.s3-us-west-1.amazonaws.com/salad/container-engine/images/3268aa8-image.png)
👍 Congratulations!
Your container is now running and utilize environment variables to customize the behaviour of your containers in Salad Portal. If you have any questions or need further assistance, please refer to our support resources or contact our customer support team.
Was this page helpful?