실행 중인 LXC 컨테이너에 디렉토리를 바인드 마운트하는 방법은 무엇입니까?

실행 중인 LXC 컨테이너에 디렉토리를 바인드 마운트하는 방법은 무엇입니까?

IOW - 구성 파일 및 컨테이너 재시작을 통해 변경 사항을 적용하지 않고 일시적으로 마운트하고 서비스를 중단하지 않습니다.

답변1

LXD(Ubuntu 16.04에 설치됨)에는 이제 "장치"를 생성하고 이를 컨테이너에 마운트할 수 있는 멋진 기능이 포함되어 있습니다.

lxc config device add <container name> <something share name> disk source=<path on host> path=<path on guest>

예를 들어,

"호스트 머신"에서

mkdir -p /shared/to/guest
echo "hello" > /shared/to/guest/test.txt
lxc config device add testcontainer sharetest disk source=/shared/to/guest path=/shared

"게스트 컨테이너"에 로그인하여 cat /shared/test.txt;-)를 확인하세요.

관련 정보