Update all Environment Variables

Use the dcos marathon app update command from the DC/OS CLI to update any aspect of your service’s JSON service definition. For instance, follow the instructions below to update the environment variable (env field) of the service definition.

dcos marathon app update test-app env='{"APISERVER_PORT":"25502"}'

This will replace the entire env field with the new value specified. Run the command below to see the result of your update:

dcos marathon app show test-app | jq '.env'

Using a JSON File

The env field can also be updated by specifying a JSON file in a command argument.

Save the existing environment variables to a file:

dcos marathon app show test-app | jq .env >env_vars.json

The file will contain the JSON for the env field:

{ "SCHEDULER_DRIVER_PORT": "25501", }

Edit the env_vars.json file. Make the JSON a valid object by enclosing the file contents with { "env" :} and add your update: