리눅스와 도커 - namespace
배경
도커 문서에서 도커가 사용하는 기술에 대해 다음과 같이 이야기한다.
Docker uses a technology called namespaces to provide the isolated workspace called the container. When you run a container, Docker creates a set of namespaces for that container. These namespaces provide a layer of isolation. Each aspect of a container runs in a separate namespace and its access is limited to that namespace.
즉, namespace라는 기술을 사용해 자원을 격리(isolate)했다는 것이다. 나는 namespace가 무엇인지 알아보기로 했다.
도커가 사용하는 기술
도커는 Container의 일종이다. Container는 namespace와 Cgroup이라는 리눅스 커널 기능을 활용하여 구현된다. Container에서 활용하는 Namespace와 Cgroup의 표준은 2015년 OCI(Open Container Initiative)에서 정의되어 있다.
Namespace
리눅스 매뉴얼 페이지에서 namespace는 다음과 같이 설명한다.
A namespace wraps a global system resource in an abstraction that makes it appear to the processes within the namespace that they have their own isolated instance of the global resource. Changes to the global resource are visible to other processes that are members of the namespace, but are invisible to other processes. One use of namespaces is to implement containers.
기본적으로 프로세스들은 하나의 시스템에서 자원들을 모두 공유한다.
namespace는 하나의 시스템안에 있는 어떠한 집합의 프로세스들(processes within the namespace)이 전체 자원의 일부를 독립적으로 사용하게 하는 기능이다. 이를 프로세스를 격리(isolate)한다고 말한다.
리눅스 커널에서는 다음과 같은 namespace를 지원한다.
- Cgroup: Cgroup root directory
- ipc: System V IPC, POSIX message queues
- network: Network devices, stacks, ports, etc
- mount: Mount points
- pid: Process IDs
- time: Boot and Monotonic clock
- user: user and group IDs
- uts: Hostname and NIS domain name
아직 모르는 것
- System V IPC, POSIX Message queue, Network stacks, NIS Domain name 등과 같은 각 namespace의 역할
참고자료
- Docker overview | Docker Documentation
- Docker(container)의 작동 원리: namespaces and cgroups
- 리눅스 네임스페이스(Linux Namespace)란?
- https://lascrea.tistory.com/163
- 도커 컨테이너는 가상머신인가요? 프로세스인가요?
'회고 > Today I Learned' 카테고리의 다른 글
Tqdm과 멀티프로세싱 (0) | 2021.07.26 |
---|---|
리눅스와 도커 - Cgroups (0) | 2021.06.20 |
댓글
이 글 공유하기
다른 글
-
Tqdm과 멀티프로세싱
Tqdm과 멀티프로세싱
2021.07.26 -
리눅스와 도커 - Cgroups
리눅스와 도커 - Cgroups
2021.06.20