Red Hat Training

A Red Hat training course is available for RHEL 8

5.7. localhost의 디렉터리를 컨테이너에 마운트

컨테이너 내부에 호스트 /dev/log 장치를 마운트하여 컨테이너 내부에서 로그 메시지를 호스트 시스템에서 사용할 수 있도록 할 수 있습니다.

사전 요구 사항

  • container-tools 모듈이 설치되어 있습니다.

절차

  1. log_test 라는 컨테이너를 실행하고 컨테이너 내부에 호스트 /dev/log 장치를 마운트합니다.

    # podman run --name="log_test" -v /dev/log:/dev/log --rm \
      registry.redhat.io/ubi8/ubi logger "Testing logging to the host"
  2. journalctl 유틸리티를 사용하여 로그를 표시합니다.

    # journalctl -b | grep Testing
    Dec 09 16:55:00 localhost.localdomain root[14634]: Testing logging to the host

    rm 옵션은 종료 시 컨테이너를 제거합니다.

추가 리소스

  • podman-run 도움말 페이지