Skip to content

Additional information#

This section provides the following additional information:

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

Delete image#

If you need to delete an image:

  • run the docker images command
  • find the required image, for example dockerhub.visionlabs.ru/luna/luna-image-store
  • 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/luna-image-store
  • 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)

Check service logs#

You can use the following command to show logs for the service:

docker logs <container_name>

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.

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 LP service containers;
  • configure synchronization of log directories in the container with logs on the server using the volume argument at the start of each container.

Docker Compose script is already configured to synchronize directories with the folders created in the section below.

Create logs directory#

You need to create the following directories for storing logs and assign them the appropriate rights.

mkdir -p /tmp/logs/configurator /tmp/logs/image-store /tmp/logs/accounts /tmp/logs/faces /tmp/logs/licenses /tmp/logs/events /tmp/logs/python-matcher /tmp/logs/handlers /tmp/logs/remote-sdk /tmp/logs/tasks /tmp/logs/tasks-worker /tmp/logs/sender /tmp/logs/api /tmp/logs/admin /tmp/logs/backport3 /tmp/logs/backport4
chown -R 1001:0 /tmp/logs/configurator /tmp/logs/image-store /tmp/logs/accounts /tmp/logs/faces /tmp/logs/licenses /tmp/logs/events /tmp/logs/python-matcher /tmp/logs/handlers /tmp/logs/remote-sdk /tmp/logs/tasks /tmp/logs/tasks-worker /tmp/logs/sender /tmp/logs/api /tmp/logs/admin /tmp/logs/backport3 /tmp/logs/backport4

If you need to use the Python Matcher Proxy service, then you need to additionally create the /tmp/logs/python-matcher-proxy directory and set its permissions.

Logging activation#

LP services 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 settings for each service.

Automatic method

To update logging settings, you can use the logging.json settings file provided with the distribution package.

Run the following command after starting the Configurator service:

docker cp /var/lib/luna/current/extras/conf/logging.json luna-configurator:/srv/luna_configurator/used_dumps/logging.json

Update your logging settings with the copied file.

docker exec -it luna-configurator python3 ./base_scripts/db_create.py --dump-file /srv/luna_configurator/used_dumps/logging.json

Manual method

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 all services whose logs need to be saved. For example, you can use the path /srv/logs.

Set the log_to_file option to true to enable logging to file.

Configurator service logging activation#

The Configurator service settings are not located in the Configurator user interface, they are located in the following file:

/var/lib/luna/current/example-docker/luna_configurator/configs/luna_configurator_postgres.conf

Set the path to the logs location in the container in the FOLDER_WITH_LOGS = ./ parameter of the file. For example, FOLDER_WITH_LOGS = /srv/logs.

Set the log_to_file option to true to enable logging to file.

You should restart Configurator after making changes.