Skip to main content

Editing the environment variables of an existing container

Updated this week

Introduction

The standard way to use environment variables is when you are performing the initial install.

When you create and edit the compose.yml file (as per the normal installation instructions), you can add the additional environment variables into your compose file to install, set up and configure your container in one step.

However, it can often take a few attempts to enter and test the desired settings within a compose file, so the following instructions explain how to edit your existing container's environment variables.

The location of your compose yml file is dependent on how you installed the container.

For Docker installs:

  • Our installation instructions assume the file is in ~/evvr

  • The name of the yml file is compose.yml.

For Debian installs:

  • The compose file will be in /srv/edgevis-encoder

  • The name of the yml file is edgevis-encoder.yml

Stopping your container

To begin, you should enter the following commands:

#For Docker installs
cd ~/evvr
sudo docker compose down

#OR for Debian installs
cd /srv/edgevis-encoder
sudo docker compose -f edgevis-encoder.yml down

Editing the compose file

To open the file in an editor, you can use:

# Docker
nano compose.ymv

# Debian
nano edgevis-encoder.yml

These environment variables can be specified directly in the yml file like this - simply add new entries in the enviromnent: section

services:
edgevis-encoder:
image: digitalbarriers/evvr:9.0.0
container_name: edgevis-encoder
ports:
- "8443:443"
- "8554:8554"
volumes:
- edgevis-config:/config
- edgevis-recordings:/mnt/recordings
- /dev:/dev
environment:
- EV_RTSP_PORT=8554
>>>>>>>>>>> ADD NEW ENTRIES HERE <<<<<<<<<<<<
device_cgroup_rules:
- 'c 81:* rmw'
- 'c 116:* rmw'
...

To save your file, hit CTRL + O (letter O), then hit Enter to confirm the filename.

To exit nano, hit CTRL + X.

Applying your new configuration

Once you have saved and exited from the text editor, you can restart the container using this command:

#Docker
sudo docker compose up -d

#Debian
sudo docker compose -f edgevis-encoder.yml up -d

If your compose file is valid, then the container should now start up. If it is not, you may see an immediate error message or the container may fail to initialise (depending on the error you've made). If your container fails to start up, you can check the container's log files to see its current state.

Did this answer your question?