Additional information#
This section provides the following additional information:
- Useful commands for working with Docker
- Launching keys description
- Actions to enable saving logs to files
- Configuring Docker log rotation
Docker commands#
Show containers#
To show the list of launched Docker containers use the command:
docker ps
To show all the existing Docker containers use the command:
docker ps -a
Copy files to container#
You can transfer files into the container. Use the docker cp
command to copy a file into the container.
docker cp <file_location> <container_name>:<folder_inside_container>
Enter container#
You can enter individual containers using the following command:
docker exec -it <container_name> bash
To exit the container, use the command:
exit
Images names#
You can see all the names of the images using the command
docker images
Show container logs#
You can view the container logs with the following command:
docker logs <container_name>
Delete image#
If you need to delete an image:
- run the
docker images
command - find the required image, for example: dockerhub.visionlabs.ru/luna/v.5.1.23
- copy the corresponding image ID from the IMAGE ID, for example, \"61860d036d8c\"
- specify it in the deletion command:
docker rmi -f 61860d036d8c
Delete all the existing images:
docker rmi -f $(docker images -q)
Stop container#
You can stop the container using the command:
docker stop <container_name>
Stop all the containers:
docker stop $(docker ps -a -q)
Delete container#
If you need to delete a container:
- run the
docker ps
command - stop the container (see Stop container)
- find the required image, for example: dockerhub.visionlabs.ru/luna/v.5.1.23
- copy the corresponding container ID from the CONTAINER ID column, for example, "23f555be8f3a"
- specify it in the deletion command:
docker container rm -f 23f555be8f3a
Delete all the containers:
docker container rm -f $(docker container ls -aq)
Launching keys#
To launch FaceStream with Configurator, the keys are set using environment variables:
--env=
- this parameter sets the environment variables required to start the container. The following basic values are specified:
-
CONFIGURATOR_HOST=127.0.0.1
- host on which the Configurator service is running. The local host is set if the container is running on the same server where the Configurator is running. -
CONFIGURATOR_PORT=5070
- listening port for the Configurator service. By default, port 5070 is used. -
PORT=34569
- port where FaceStream will listen. -
STREAMS_ID=""
- tag specifies a list of stream IDs that will be requested from LUNA Streams for processing. Other streams will be filtered. The "stream_id" parameter is given in response to the "create stream" request.
If the value is ""
or the STREAMS_ID
tag is not set, then FaceStream will take all existing "stream_id" from the queue.
If a non-existent value is set, an error about an incorrect UUID will be indicated when launching FaceStream.
By default, the value equals ""
.
To use the key, the CONFIGURATOR_HOST
and CONFIGURATOR_PORT
variables should be specified.
STREAMS_NAME=""
- list of streams names sets in this tag. Streams names are set using the "name" parameter at the time of their creation ("create streams" request). Streams with these names will be requested from LUNA Streams for processing. Other streams will be filtered.
Otherwise, the principle of operation is similar to the "STREAMS_ID" tag.
GROUPS_ID=""
andGROUPS_NAME=""
- tags specify a list of group IDs or a list of group names. The parameters "group_id" or "group_name" are set during stream creation ("create stream" request). Streams with these parameters will be requested from LUNA Streams for processing. Other streams will be filtered.
If the value is ""
or the GROUPS_ID
/GROUPS_NAME
tags are not set, then FaceStream will not filter streams by groups.
If a non-existent value is set, an error about an incorrect UUID will be indicated when launching FaceStream.
By default, the value equals ""
.
To use the keys, the CONFIGURATOR_HOST
and CONFIGURATOR_PORT
variables should be specified.
You can set multiple values for "STREAMS_NAME", "STREAMS_ID", "GROUPS_NAME" and "GROUPS_ID" tags. Syntax example:
--env=STREAMS_ID="037f3196-c874-4eca-9d7c-91fd8dfc9593 4caf7cf7-dd0d-4ad5-a35e-b263e742e28a"
CONFIGS_ID=""
- tag is used to set a LUNA Configurator tag, which relates to the FaceStream main configurations. The same tag should be set for "TRACK_ENGINE_CONFIG" and "FACE_STREAM_CONFIG".
If the value is set to ""
then the "TRACK_ENGINE_CONFIG" and "FACE_STREAM_CONFIG" records will be used by default. If the record by default does not exist or has an invalid JSON syntax, the configuration file from the distribution package will be used.
By default, the value equals ""
.
To use the key, the CONFIGURATOR_HOST
and CONFIGURATOR_PORT
variables should be specified.
-
CONFIG_RELOAD = 1
- tag that enables checking for changes in the "FACE_STREAM_CONFIG" section of the LUNA Configurator service and takes the following values:1
- change tracking is enabled, if there are changes in the configuration, all FaceStream containers will be automatically restarted;0
- change tracking is disabled.
By default, the value equals 1
.
PULLING_TIME = 10
- tag that sets the period for receiving new parameters from the "FACE_STREAM_CONFIG" section of the LUNA Configurator service in the range [1...3600] sec. Used in conjunction with theCONFIG-RELOAD
tag.
By default, the value equals 10
.
--device=
- this parameter is required to specify the address to the USB device. The address must be specified in the stream source when it is created. Example: --device=/dev/video0
.
See how FaceStream works with LUNA Configurator in the section "Use FaceStream with LUNA Configurator" of the administrator manual.
Description of container launch parameters#
docker run
- command to launch the selected image as a new container.
-v
- enables you to load the contents of the server folder into the volume of the container. This way the content is synchronized.
-v /var/lib/fs/fs-current/extras/conf/configs/faceengine.conf:/srv/facestream/data/faceengine.conf \
- this parameter enables you to use the FaceEngine settings from the configuration file "faceengine.conf".
-v /var/lib/fs/fs-current/extras/conf/configs/runtime.conf:/srv/facestream/data/runtime.conf \
- this parameter enables you to mount the runtime configuration file into the FaceStream container. Before changing the default settings, you need to consult with VisionLabs specialists.
--network=host
- this parameter specifies that there is no network simulation and a server network is used. If you need to change the port for third-party containers, replace this line with -p 5440:5432
. Here, the first port 5440
is the local port, and 5432
is the port used in the container.
/etc/localtime:/etc/localtime:ro
- sets the current time zone used by the container system.
--name=facestream
- this parameter specifies the name of the container to be launched. The name must be unique. If a container with the same name already exists, an error will occur.
--restart=always
- this parameter defines the restart policy. Daemon always restarts the container regardless of the completion code.
--detach=true
- running the container in the background.
Logging to server#
To enable saving logs to the server, you should:
- create directories for logs on the server;
- activate log recording and set the location of log storage inside containers;
- configure synchronization of log directories in the container with logs on the server using the
volume
argument at the start of each container.
In the Docker Compose script, synchronization of directories with folders is not configured. You need to manually add folder mounting to the
docker-compose.yml
file.
Create logs directory#
Below are examples of commands for creating directories for saving logs and assigning rights to them for LUNA Streams and FaceStream.
mkdir -p /tmp/logs/facestream /tmp/logs/streams
chown -R 1001:0 /tmp/logs/facestream /tmp/logs/streams
Logging activation#
LUNA Streams logging activation#
To enable logging to file, you need to set the log_to_file
and folder_with_logs
settings in the <SERVICE_NAME>_LOGGER
section of the LUNA Streams settings.
Go to the Configurator service interface (127.0.0.1:5070
) and set the logs path in the container in the folder_with_logs
parameter for LUNA Streams service. For example, you can use the path /srv/logs
.
Set the log_to_file
option to true
to enable logging to file.
FaceStream logging activation#
To enable logging to file, you need to set the value of the logging > mode
setting in the FACE_STREAM_CONFIG
section to l2f
(output logs only to file) or `l2b' (output logs both to file and to console).
Go to the Configurator service interface (127.0.0.1:5070
) and specify the required setting value. The location path of logs in the FaceStream container cannot be changed. It is necessary to specify the path /srv/logs
when mounting.
By default, only system warnings are displayed in the FaceStream logs. By setting the "severity" parameter, you can enable error output (see the parameter description in the administrator manual).
Mounting directories with logs when starting services#
The log directory is mounted with the following argument when starting the container:
-v <server_logs_folder>:<container_logs_folder> \
where <server_logs_folder>
is the directory created in the create logs directory step, and <container_logs_folder>
is the directory created in the activate logging step.
Example of command to launch the FaceStream with mounting a directory with logs:
docker run \
--env=CONFIGURATOR_HOST=127.0.0.1 \
--env=CONFIGURATOR_PORT=5070 \
-v /var/lib/fs/fs-current/extras/conf/configs/faceengine.conf:/srv/facestream/data/faceengine.conf \
-v /var/lib/fs/fs-current/extras/conf/configs/runtime.conf:/srv/facestream/data/runtime.conf \
-v /etc/localtime:/etc/localtime:ro \
-v /tmp/logs/facestream:/srv/logs \
--env=PORT=34569 \
--detach=true \
--restart=always \
--name=facestream \
--network=host \
dockerhub.visionlabs.ru/luna/facestream:v.5.1.23
Examples of manual container launch commands contain these arguments.
Docker log rotation#
To limit the size of logs generated by Docker, you can set up automatic log rotation. To do this, add the following data to the /etc/docker/daemon.json
file:
{
"log-driver": "json-file",
"log-opts": {
"max-size": "100m",
"max-file": "5"
}
}
This will allow Docker to store up to 5 log files per container, with each file being limited to 100MB.
After changing the file, you need to restart Docker:
systemctl reload docker
The above changes are the default for any newly created container, they do not apply to already created containers.