Chapter 30. Creating and running containers
This section provides information about creating and running containers with the real-time kernel.
Prerequisites
-
Install
podmanand other container related utilities. - Get familiar with administration and management of Linux containers on RHEL.
-
Install the
kernel-rtpackage and other real-time related packages.
30.1. Creating a container Copy linkLink copied to clipboard!
You can use all the following options with both the real time kernel and the main RHEL kernel. The kernel-rt package brings potential determinism improvements and allows the usual troubleshooting.
Prerequisites
- You have administrator privileges.
Procedure
The following procedure describes how to configure the Linux containers in relation with the real time kernel.
Create the directory you want to use for the container. For example:
mkdir cyclictest
# mkdir cyclictestCopy to Clipboard Copied! Toggle word wrap Toggle overflow Change into that directory:
cd cyclictest
# cd cyclictestCopy to Clipboard Copied! Toggle word wrap Toggle overflow Log into a host that provides a container registry service:
podman login registry.redhat.io Username: my_customer_portal_login Password: *** Login Succeeded!
# podman login registry.redhat.io Username: my_customer_portal_login Password: *** Login Succeeded!Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a
Containerfile:Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you are building from a custom Containerfile modify your Containerfile and build it. Here is an example with cyclisttest. If not creating your own image, you can also pull the realtime-tests-container image to run cyclictest:
podman build -t cyclictest .
# podman build -t cyclictest .Copy to Clipboard Copied! Toggle word wrap Toggle overflow
30.2. Running a container Copy linkLink copied to clipboard!
You can run a container built with a Containerfile.
Procedure
Run a container using the
podman runcommand:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
This example shows the podman run command with the required, real time-specific options. For example:
-
The first in first out (FIFO) scheduler policy is made available for workloads running inside the container through the
--cap-add=sys_niceoption. This option also allows setting the CPU affinity of threads, another important configuration dimension when tuning a real time workload. The
--device=/dev/cpu_dma_latencyoption makes the host device available inside the container (subsequently used by the cyclictest workload to configure the CPU idle time management). If the specified device is not made available, an error similar to the message below appears:WARN: stat /dev/cpu_dma_latency failed: No such file or directoryWhen confronted with error messages like these, refer to the podman-run(1) manual page. To get a specific workload running inside a container, other
podman-runoptions may be helpful.In some cases, you also need to add the
--device=/dev/cpuoption to add that directory hierarchy, mapping per-CPU device files such as/dev/cpu/*/msr.