5.8. Mounting directory on localhost to the container
You can make log messages from inside a container available to the host system by mounting the host /dev/log device inside the container.
Prerequisites
-
The
container-toolsmeta-package is installed.
Procedure
Run the container named
log_testand mount the host/dev/logdevice inside the container:# podman run --name="log_test" -v /dev/log:/dev/log --rm \ registry.redhat.io/ubi10/ubi logger "Testing logging to the host"Use the
journalctlutility to display logs:# journalctl -b | grep Testing Dec 09 16:55:00 localhost.localdomain root[14634]: Testing logging to the hostThe
--rmoption removes the container when it exits.