Multiple Restreamer

It is possible to run multiple Restreamer on one device, i.e. in order to restream more than one camera or stream on one device. This guide will show you what to take care of such that the different Restreamer containers don’t step on each others feet.

There three things to consider when starting the Docker images:

  • each containter needs a different name
  • each containter needs a different port
  • each containter needs a different volume

Example

Imagine that you want to run 4 Restreamer instances on one device. The Docker command lines could look like this

docker run -d --restart always -e "RS_USERNAME=..." -e "RS_PASSWORD=..." --name camera1 -p 8091:8080 -v /mnt/camera1/db:/restreamer/db datarhei/restreamer-armv7l:latest
docker run -d --restart always -e "RS_USERNAME=..." -e "RS_PASSWORD=..." --name camera2 -p 8092:8080 -v /mnt/camera2/db:/restreamer/db datarhei/restreamer-armv7l:latest
docker run -d --restart always -e "RS_USERNAME=..." -e "RS_PASSWORD=..." --name camera3 -p 8093:8080 -v /mnt/camera3/db:/restreamer/db datarhei/restreamer-armv7l:latest
docker run -d --restart always -e "RS_USERNAME=..." -e "RS_PASSWORD=..." --name camera4 -p 8094:8080 -v /mnt/camera4/db:/restreamer/db datarhei/restreamer-armv7l:latest

Note that each container has a different name

... --name camera1 ...
... --name camera2 ...
... --name camera3 ...
... --name camera4 ...

To give an explicit name is not required, but makes it easier to work with the containers.

Each container has to map to a different port on your device

... -p 8091:8080 ...
... -p 8092:8080 ...
... -p 8093:8080 ...
... -p 8094:8080 ...

The instance called camera1 will be reachable on http://localhost:8091/, the instance camera2 on http://localhost:8092/, and so on. If the ports are not different, also Docker would complain.

Most importantly is that you map different directories to the /restreamer/db volume

... -v /mnt/camera1/db:/restreamer/db ...
... -v /mnt/camera2/db:/restreamer/db ...
... -v /mnt/camera3/db:/restreamer/db ...
... -v /mnt/camera4/db:/restreamer/db ...

If you map always the same directory, the different Restreamer instances would overwrite the configuration files of each other. The configuration file contains all required information about the currently connected streams. In case of a restart the Restreamer can automatically reconnect to the previously connected streams.

With different directories mounted to the volume, each Restreamer has its own configuration file that will not get overwritten by the other Restreamers.