Ascend Docker Runtime Reference

The Ascend Docker Runtime component information includes the instructions for outputting edge application container logs, default content mounted by the Ascend Docker Runtime, and Ascend Docker Runtime commands. You can select the corresponding information for reference based on the site requirements. The following is an example:

Background

Storage space of edge devices is limited. In addition, many edge devices use flash memory such as eMMCs as storage media, and the service life of these media is limited. To prevent the storage space from being used up quickly or to prevent storage media from reaching the end of their service life rapidly, this document describes how to appropriately output edge container logs.

Introduction

Edge application containers running on Atlas hardware are managed by an edge management platform compatible with Kubernetes, such as Huawei Cloud IEF or a third-party edge platform built based on KubeEdge. On such platforms, container logs can be output in the following modes:

  • Standard output (STDOUT or STDERR) using the container console
  • Log mounting to the host directory
  • Direct output to the log service

If a log server exists in the system, you are advised to export logs to the log service in the container. If no log server exists, you are advised to mount logs to the host directory to export the logs to reduce the impact of logs on hardware and other services.

Standard Output Using the Container Console

In this mode, applications output container logs as standard outputs. By default, the Docker engine captures the standard output of all containers and writes the output to a file in JSON format. The file is saved to the /var/lib/docker/containers/containerid directory on the host, as shown in Figure 1.

Figure 1 Path of the containerid-json.log file

If the edge management platform does not support log file rotation or the log rotation configuration is incorrect, the /var/lib/docker directory will be fully occupied, affecting the deployment of new containers and the normal running of other container services. Therefore, this mode is not recommended.

Log Mounting to the Host Directory

Figure 2 illustrates how to collect edge platform logs in this mode.

Figure 2 Solution architecture

The application mounts the container logs to the edge host. The edge management platform provides host log collection and rotates host file logs.

  • The application can mount container logs to non-key large-capacity directories on the host. It is not recommended that container logs be mounted to storage media such as eMMCs to avoid affecting the overall hardware service life.
  • Generally, the edge container management platform supports this mode. This mode is recommended to reduce the impact on system directory var/lib/docker. For security purposes, the configuration must meet the security requirements of your organization.

Direct output to the log service

If there is a log server in the application environment, logs can be directly sent to the external log server. In this way, logs do not need to be written to disks in the edge environment, minimizing the impact on hardware and other services. See Figure 3.

Figure 3 Solution architecture

Default Content Mounted by the Ascend Docker Runtime

The Ascend Docker Runtime mounts the following directories and files to the container in read-only mode by default based on the actual environment.

Table 1 Default mounting directories and files for the Atlas 200 AI accelerator module (RC)

Path

Description

/dev/davinciX

NPU device. X indicates the ID, for example, davinci0.

/dev/davinci_manager

Management device.

/usr/local/Ascend/driver/tools

Directory for storing the tool packages provided by the driver.

/usr/local/Ascend/driver/lib64

Directory for storing user-mode libraries provided by the driver.

/usr/local/sbin/npu-smi

File for storing the npu-smi tool.

/etc/hdcBasic.cfg

Basic HDC file.

/etc/sys_version.conf

File for storing the driver version information.

Table 2 Default mounting directories and files (Atlas 200I SoC A1A200I SoC A1 core board)

Path

Description

/dev/davinciX

NPU device. X indicates the ID, for example, davinci0.

/dev/davinci_manager

Device manager related to Da Vinci.

/usr/local/bin/npu-smi

File for storing the npu-smi tool.

/etc/hdcBasic.cfg

Basic HDC file.

/etc/sys_version.conf

File for storing the driver version information.

Table 3 Default mounting directories and files (Atlas 500 AI edge station (model 3000))

Path

Description

/dev/davinciX

NPU device. X indicates the ID, for example, davinci0.

/dev/davinci_manager

Management device.

/dev/hisi_hdc

Management device.

/dev/devmm_svm

Management device.

/home/data/miniD/driver/lib64

Directory for storing user-mode libraries provided by the driver.

/usr/local/lib/libdcmi.so

File for storing the DCMI dynamic library.

/usr/local/bin/npu-smi

File for storing the npu-smi tool.

Table 4 Default mounting directories and files for other devices

Path

Description

/dev/davinciX

NPU device. X indicates the ID, for example, davinci0.

/dev/davinci_manager

Management device.

/dev/hisi_hdc

Management device.

/dev/devmm_svm

Management device.

/usr/local/Ascend/driver/lib64

Directory for storing user-mode libraries provided by the driver.

/usr/local/Ascend/driver/include

Directory for storing the header file provided by the driver.

/usr/local/dcmi

Directory for storing DCMI header files and libraries.

/usr/local/bin/npu-smi

File for storing the npu-smi tool.

Ascend Docker Runtime Commands

After the Ascend Docker Runtime is installed, an executable tool is generated in the installation directory. The involved commands are internal commands, which cannot be directly used. For details about the commands, see Command description.

Table 5 Command description

Tool

Short Command

Long Command

ascend-docker-cli

d

devices

p

pid

r

rootfs

o

options

f

mount-file

i

mount-dir

ascend-docker-plugin-install-helper

-

add

-

rm

h

-

ascend-docker-runtime

-

create

b

bundle

ascend-docker-destroy

-

-

  • Ascend Docker Runtime directly transfers input parameters to runc or docker-runc. Therefore, parameters related to runc or docker-runc are also accepted by Ascend Docker Runtime. Select parameters by referring to the command line options of runc or docker-runc in the environment.
  • The ascend-docker-hook tool ignores parameters and accepts standard input during running.