# Docker 이미지 내부의 파일에 접근하는 방법은 무엇인가요?

**URL:** https://meta.discourse.org/t/how-can-i-access-a-file-inside-the-docker-image/144610
**Category:** Self-hosting
**Tags:** docker
**Created:** [3월 17, 2020, 4:42오후 UTC](https://meta.discourse.org/t/how-can-i-access-a-file-inside-the-docker-image/144610 "2020-03-17T16:42:40Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Nacho\_Caballero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nacho_caballero/32/130189_2.png) [@Nacho\_Caballero](https://meta.discourse.org/u/Nacho_Caballero)
#### Post date: [3월 17, 2020, 4:42오후 UTC](https://meta.discourse.org/t/how-can-i-access-a-file-inside-the-docker-image/144610/1 "2020-03-17T16:42:40Z")

</div>

Docker 이미지 내부에 파일을 생성한 경우, 외부에서 어떻게 접근할 수 있나요?

예를 들어:

```plaintext
/var/discourse/launcher enter app
touch temp.txt
^D

```

`temp.txt`에 어떻게 접근할 수 있을까요?

---

<div class="post-metadata">

### Author: ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)
#### Post date: [3월 17, 2020, 4:49오후 UTC](https://meta.discourse.org/t/how-can-i-access-a-file-inside-the-docker-image/144610/2 "2020-03-17T16:49:20Z")

</div>

man docker를 시도해 보세요

docker cp

---

<div class="post-metadata">

### Author: ![Nacho\_Caballero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nacho_caballero/32/130189_2.png) [@Nacho\_Caballero](https://meta.discourse.org/u/Nacho_Caballero)
#### Post date: [3월 17, 2020, 4:50오후 UTC](https://meta.discourse.org/t/how-can-i-access-a-file-inside-the-docker-image/144610/3 "2020-03-17T16:50:49Z")

</div>

containerId는 어디서 찾을 수 있나요?

---

<div class="post-metadata">

### Author: ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)
#### Post date: [3월 17, 2020, 4:53오후 UTC](https://meta.discourse.org/t/how-can-i-access-a-file-inside-the-docker-image/144610/4 "2020-03-17T16:53:53Z")

</div>

Docker ps

정말 man docker를 확인해 보시는 것이 좋습니다.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [3월 17, 2020, 4:55오후 UTC](https://meta.discourse.org/t/how-can-i-access-a-file-inside-the-docker-image/144610/5 "2020-03-17T16:55:05Z")

</div>

한 걸음 물러서서 실제로 해결하려는 문제가 무엇인지 설명해 주셔야 합니다. 현재까지 설명하신 내용은 아마도 해결책이 아닐 가능성이 높기 때문입니다. 질문에 대한 답은, 컨테이너 내의 `/shared`에 있는 파일들은 표준 설치 환경에서는 `/var/discourse/shared/standalone` 경로로 접근할 수 있다는 것입니다. 하지만 이는 명시되지 않은 여러분의 실제 문제에 대한 해결책이 아닐 가능성이 큽니다.

---

<div class="post-metadata">

### Author: ![Nacho\_Caballero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nacho_caballero/32/130189_2.png) [@Nacho\_Caballero](https://meta.discourse.org/u/Nacho_Caballero)
#### Post date: [3월 17, 2020, 4:58오후 UTC](https://meta.discourse.org/t/how-can-i-access-a-file-inside-the-docker-image/144610/6 "2020-03-17T16:58:08Z")

</div>

제이, 고마워. 저는 Rails 쿼리를 실행 중인데 그 결과를 내보내고 싶어. 보통은 [Data Explorer](https://meta.discourse.org/t/32566?silent=true)를 사용하지만, 이 보고서를 위해 Rails를 직접 사용하려고 해.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [3월 17, 2020, 5:00오후 UTC](https://meta.discourse.org/t/how-can-i-access-a-file-inside-the-docker-image/144610/7 "2020-03-17T17:00:54Z")

</div>

하! 그럼 이거면 되겠네! 백업 디렉터리에 넣어두면 그 안에 있는 게 별로 없어서 관리하기가 훨씬 쉬울 거야.
