Starting the QNX Container Manager

In this section, you start the QNX Container Manager.

Prerequisites

Before launching the QNX Container Manager process (qcmgr), you must satisfy the following prerequisites:
  1. You must create the root and runtime root directories to use with qcmgr. If you use the default root and runtime root directory options, then the following directories must exist:
    mkdir /var/lib
    mkdir /var/run
  2. If you intend to pull images from a registry using HTTPS, the QNX target must have a Certificate Authority (CA) bundle file and qcmgr has the path to the CA bundle. The image library of qcmgr uses the path to download QNX Container application images.

    A CA bundle may be downloaded on the host and transferred to the QNX target as follows:
    wget https://curl.se/ca/cacert.pem -O /tmp/cacert.pem
    scp /tmp/cacert.pem root@<target-ip>:/etc
    The CA bundle file may then either be moved to the default directory expected by qcmgr, or the path where it currently resides can be passed to the -h option when starting qcmgr. To move it to the default directory expected by qcmgr, you may run:
    mkdir -p /var/lib/containers/certs/cabundle
    mv /etc/cacert.pem /var/lib/containers/certs/cabundle
  3. If any Pods on the system need be created with the "POD" network namespace, a network bridge must be created and its name passed as the -b option to qcmgr on startup:
    ifconfig bridge create name qcmgrbr0
    Note:
    This operation must be done as the root user.
  4. If external network connectivity is required for any Pods on the system, the external interface name must be passed as the -i option to qcmgr on startup. In addition, Packet Filter functionality and IP forwarding must be enabled as follows:
    pfctl -e
    sysctl net.inet.ip.forwarding=1
    Note:
    This operation must be done as the root user.
  5. The qrunc process must already be running. On startup, qcmgr attempts to connect qrunc.
    CAUTION:
    To ensure proper operation, if the qcmgr process is restarted, then the qrunc process must also be restarted.

Command

qcmgr [options]
Note:
Starting the QNX Container Manager must be done as the root user.

Options

You can customize the functionality of qcmgr with the following arguments:

Resource manager Options

-m Mount path
Resource manager mount path (Default: /dev/containers/qcmgr).
-t Worker threads
Number of concurrent resource manager worker threads (Default: 4).
-l Logging options
Logging options string (Default: "locations=stdout, prefix=qcmgr: , verbosity=info"). For details on qcmgr logging options, refer to Logging Options.

Container Options

-r Root directory
Root directory for storing all container data (Default: /var/lib). The qcmgr process creates the containers directory under the root directory that stores all the container data.
-x Runtime Root directory
Root directory for storing all temporary runtime data (Default: /var/run). The qcmgr process creates the containers directory under the root directory that stores the temporary runtime data.

Runtime (qrunc) Options

-e Mount path
Resource manager mount path to connect to (Default: /dev/containers/qrunc).

Network Options

-b Pod networking bridge
Network bridge to use for the Pod network. Must be specified to use the 'Pod' network namespace mode.
-p Pod CIDR
The range of IPv4 addresses from which to allocate to Pods created with the 'Pod' network namespace. Specified in CIDR format (Default: 172.17.0.0/16).
-i External Interface
External interface to use with Pod networking. If not specified, then qcmgr doesn't perform the external network configuration for Pods.

Image Library Options

-g Root directory
Location to store image data (Default /var/lib). qcmgr creates the containers/images leaf directory under the path provided.
-h Runtime CA certificate bundle
Path to a file which contains a full CA certificate bundle (in PEM format) for CURL ssl (Default: /var/lib/containers/certs/cabundle/cacert.pem).
-a Threads
Number of concurrent threads used for downloading OCI images (Default: 4).
-u Buffer size (in bytes)
Size of the download buffer in the CURL library allocated for each thread (-a). A value of 0 lets CURL use its internal default (Default: 0).
-U User ID ranges
Allowable UID ranges (comma separated list of ID or colon separated ID range) Only start a container process if the user ID falls within this provided range (e.g., '4,8:10,100').
-G Group ID ranges
Allowable GID ranges (comma separated list of ID or colon separated ID range) Only start a container process if the group ID falls within this provided range (e.g., '4,8:10,100').

Example: Invocation of qcmgr with a network bridge

The following command launches qcmgr with a specified network bridge (qcmgrbr0) and logs the output to the system logger:
qcmgr -b qcmgrbr0 -l "locations=slog2,slogpages=8,verbosity=info" &
Note:
Ensure that the jail and tar binaries already exists on the target image before starting qcmgr, as they are required for pod and container creation.
However, if there are any existing pods running in POD mode, then removing the network bridge isn't supported.
CAUTION:
Restarting qcmgr with incompatible pod options is not a supported use case. When creating a pod, ensure that the pod sandbox configuration specifies the pod options that are compatible with the current system setup and qcmgr invocation parameters. Restarting qcmgr without specifying a network bridge fails if any pods were previously created using the pod network namespace.
# qcmgr  -i vtnet0 -l "locations=slog2|stdout,slogpages=8,verbosity=error" &
[2] 4653072
# cat /tmp/valid_port_pod.json
{
	"config": {
		"metadata": {
			"name": "podsandbox600"
		},
		"qnx": {
			"network_namespace": 0
		},
		"port_mappings": [
			{
				"protocol": 0,
				"container_port": 8080,
				"host_port": 22
			},
			{
				"protocol": 2,
				"container_port": 80,
				"host_port": 30,
				"host_ip": "10.123.2.1"
			}
		],
		"hostname": "hostname3"
	}
}
# qcmctl pod create -I /tmp/valid_port_pod.json
[ERR] Pod network mode with no bridge specified
Request failed '[Invalid argument]'

For recovery, ensure that the pod options are compatible before restarting qcmgr. If qcmgr fails to start due to incompatible pod configurations, then delete all existing pods created with the pod network namespace. Restart qcmgr with the appropriate bridge configuration using the -b option.

# qcmgr -b qcmgrbr0 -i vtnet0 -l "locations=slog2|stdout,slogpages=8,verbosity=error"  &
[2] 4694032
# cat /tmp/valid_port_pod.json
{
	"config": {
		"metadata": {
			"name": "podsandbox600"
		},
		"qnx": {
			"network_namespace": 0
		},
		"port_mappings": [
			{
				"protocol": 0,
				"container_port": 8080,
				"host_port": 22
			},
			{
				"protocol": 2,
				"container_port": 80,
				"host_port": 30,
				"host_ip": "10.123.2.1"
			}
		],
		"hostname": "hostname3"
	}
}
# qcmctl pod create -I /tmp/valid_port_pod.json
8e06c8166623f3dba6bd9800c752830e052730d12fffbef66531cfcef9f5b509
# slay qcmgr
# qcmgr  -i vtnet0 -l "locations=slog2|stdout,slogpages=8,verbosity=error"  &
[3] 4747280
[2] - Done                 qcmgr -b qcmgrbr0 -i vtnet0 -l "locations=slog2
# [ERR] Pod network mode with no bridge specified
[3] + Done (1)             qcmgr -i vtnet0 -l "locations=slog2|stdout,slog
# rm -rf /var/lib/containers/pods/
# qcmgr  -i vtnet0 -l "locations=slog2|stdout,slogpages=8,verbosity=error"  &
[2] 4763664
# pidin ar | grep qcmgr
4763664 qcmgr -i vtnet0 -l locations=slog2|stdout,slogpages=8,verbosity=error
4767764 grep qcmgr
Page updated: