> For the complete documentation index, see [llms.txt](https://leehyokyun.gitbook.io/openbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://leehyokyun.gitbook.io/openbook/6-2.-docker-1-docker.md).

# 6-2. Docker #1 : Docker 속성

Docker에 대하여

### Volume Mount

* Docker의 Volume Mount는 단순히 볼륨 경로를 설정하는 것이 아니라, host의 디스크와 연결(binding)하는 작업이다. 기본적으로 볼륨은 Host와 공유하지 않기에, 컨테이너가 삭제될 경우 그대로 데이터는 소멸한다. 이 문제를 해결하기 위해 Mount(-v Option) 활용 시 Host의 외부 환경 디스크와 연결하여 실제 데이터를 영속화할 수 있다.
* -v 옵션과 데이터의 흐름 `docker run -v /host/path:/container/path nginx` 명령어의 실행은 호스트의 `/host/path`를 컨테이너의 `/container/path`에 붙인다는 의미이다.&#x20;
  * 컨테이너 내부에서 `/container/path/file.txt`를 생성하면, 실제로는 호스트의 `/host/path/file.txt`에 저장된다. 컨테이너는 자기 폴더라고 인식하지만 실제 저장은 호스트에서 일어난다. 지정한 호스트의 디스크 경로를 직접 활용하여 물리적으로 파일과 데이터가 해당 경로로 저장되며, 컨테이너 내부에서 지정한 기본 Volume 경로에는 저장되지 않고 Host에 완전히 링크된다.
* 쉽게 말해, Volume의 I/O를 연결해서 실제 데이터 파일은 bind 경로에 저장하고, 인식 대상은 컨테이너 내부의 저장 공간으로 이원화 관리/연결 하는 개념이다.

### DinD / DooD

* 도커 안의 도커 실행 방식 정의 도커를 컨테이너 안에서 어떻게 쓸 것인가에 대한 방식을 정의한 개념이다. Jenkins 등 CI/CD 툴을 컨테이너로 띄우고 그 안에서 다시 테스트용 도커 이미지를 빌드하거나 컨테이너를 실행해야 할 때 활용한다.

#### DinD (Docker in Docker)

* 컨테이너 내부에서 Docker 데몬 자체를 또 띄우는 방식이다. 컨테이너 내부에 완전한 도커 환경이 또 생성되어, 마치 VM처럼 host Daemon Docker와 완전히 격리된다.
* 내부에서 docker daemon을 직접 실행한 후 docker run을 실행하므로 host와 완전히 격리된다는 특징을 가진다. 다만 이 방식을 구현하기 위해서는 컨테이너 실행 시 `--privileged` 옵션을 주어 자원에 대한 권한을 넘겨주어야 하므로 보안상 매우 취약하고 위험하다는 단점이 존재한다.

#### DooD (Docker out of Docker)&#x20;

* 컨테이너 내부에 도커 데몬을 실행하지 않고, Host의 Docker 데몬을 공유하여 사용하는 방식이다. 호스트의 Docker Daemon 소켓 파일인 `/var/run/docker.sock` 파일을 컨테이너 내부와 볼륨 마운트로 연결한다.&#x20;
* 내부 컨테이너 안에서 도커 명령(docker CLI)을 내리면, 그 명령은 소켓을 타고 호스트의 도커 데몬으로 전달되어 실행된다. 결과적으로 컨테이너 안에서 생성한 컨테이너는 내부 컨테이너의 자식이 아니라 호스트 도커 데몬의 자식(형제 컨테이너)으로 생성된다. `--privileged` 옵션이 필요 없고 호스트 데몬을 공유하므로 구조가 단순하며, CI/CD 환경에서 컨테이너 기반 빌드를 수행할 때 주로 채택되는 안전한 방식이다.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://leehyokyun.gitbook.io/openbook/6-2.-docker-1-docker.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
