컨테이너 안에서는 호스트의 파일 시스템 전체를 볼 수 없다. 컨테이너 안에서는 파일 시스템
전체의 한 부분집합을 볼 수 있을 뿐인데, 이는 컨테이너 실행 시 루트 디렉터리가 바뀌기 때문
이다.
리눅스에서 루트 디렉터리는
chroot
라는 명령으로 변경할 수 있다. 이 명령은 현재 프로세
스에 대한 루트 디렉터리가 파일 시스템 안의 다른 어떤 위치를 가리키게 만든다.
chroot
명
령을 성공적으로 실행하고 나면, 전체 파일 시스템 위계구조에서 새 루트 디렉터리보다 위쪽에
있는 것에는 전혀 접근할 수 없다([그림
4
-
1
] 참고). 파일 시스템에서 루트보다 더 위로 올라
가는 방법은 없기 때문이다.
chroot
의 매뉴얼 페이지에 나온 설명은 다음과 같다. “루트 디렉터리를
NEWROOT
로 설
정해서
COMMAND
를 실행한다. 명령이 지정되지 않으면
${
SHELL
} -
i
(기본은
/
bin
/
sh
-
i
)를 실행한다.
호스트의 파일들:
/some/directory/on/host/file1
/some/directory/on/host/dir1/file2
/file1
/dir1/file2
루트를
/some/directory/on/host
로
변경한 프로세스가 보는 파일들:
그림
4-1
루트를 변경하면 프로세스가 파일 시스템의 한 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.