You can share host directories or devices with a container by mounting them. For example, mounting /dev/log allows the container to write logs directly to the host’s system journal.
Before you begin
- The
container-tools meta-package is installed.
Procedure
-
Run the container named
mysyslog:
# podman run -dt --name=mysyslog registry.redhat.io/rhel10/support-tools
-
Run the
podman mount command to mount a working container root filesystem in a location accessible from the host. For example, mount the mysyslog container:
/var/lib/containers/storage/overlay/990b5c6ddcdeed4bde7b245885ce4544c553d108310e2b797d7be46750894719/merged
-
Display the content of the mount point using
ls command:
# ls /var/lib/containers/storage/overlay/990b5c6ddcdeed4bde7b245885ce4544c553d108310e2b797d7be46750894719/merged
bin boot dev etc home lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var
-
Display the OS version:
# cat /var/lib/containers/storage/overlay/990b5c6ddcdeed4bde7b245885ce4544c553d108310e2b797d7be46750894719/merged/etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="10 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
...
For more information, see the podman-mount(1) man page on your system.