• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    해결됨

docker volume 설정 시 mount 에러

23.08.25 19:40 작성 조회수 1.74k

0

영상에서 알려주신대로 파일을 설정하고

실행하면 다음과 같은 에러가 발생합니다.

잘 안보일 수 있어서 아래에 적습니다.

Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/run/desktop/mnt/host/e/Study-App/codecamp-backend/class/section04/04-07-docker-compose-with-mongoose-board2/backend/index.js" to rootfs at "/myfolder/index.js": mount /run/desktop/mnt/host/e/Study-App/codecamp-backend/class/section04/04-07-docker-compose-with-mongoose-board2/backend/index.js:/myfolder/index.js (via /proc/self/fd/9), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

 

 

결국 경로를 못찾는다는 얘기로 이해했는데요.

그래서 yaml파일을 다음과 같이 고쳐봤습니다.

 

그러면 실행이 되는 것처럼 나오지만 이러한 에러가 발생합니다.

 

근데 이상한건 다른 터미널에서 docker ps를 실행하면 다음과 같이 하나만 실행된 것처러럼 나오는데...

막상 현재 실행되고 있는 터미널에서 ctrl + c를 하면 다음과 같이 2개가 중지되는걸로 나옵니다.

어디서부터 잘못된 걸까요 ㅠ_ㅠ

답변 3

·

답변을 작성해보세요.

0

yisi님의 프로필

yisi

질문자

2023.08.28

말씀하신대로 진행해 보려 했으나 실패했습니다. ;;;

우선 해본 것은 제가 E 드라이브에서 공부를 하고 있으므로 Docker의 image파일 경로를 E로 변경했습니다.

그리고 file-sharing을 해보려고 했는데 메뉴가 없습니다.

image

 

그래서 좌측에 있는 메뉴 Volumes에 들어가서 설정해보려고 했으나

image설정할 때 이름을 적는것 외에는 다른 설정이 없습니다.

이미지에 보이는 Volume은 제가 docker-compose up 실행 시 자동으로 생겼습니다.

 

여전히 에러는 발생하고 있는데요

====================================================================

[+] Running 1/0

✔ Container backend-my-database-1 Running 0.0s

Attaching to backend-my-backend-1, backend-my-database-1

Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/run/desktop/mnt/host/e/Study-App/codecamp-backend/class/section04/04-07-docker-compose-with-mongoose-board2/backend/index.js" to rootfs at "/myfolder/index.js": mount /run/desktop/mnt/host/e/Study-App/codecamp-backend/class/section04/04-07-docker-compose-with-mongoose-board2/backend/index.js:/myfolder/index.js (via /proc/self/fd/9), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

====================================================================

 

그리고 구글에서 찾은 어떤 내용에 docker run -v 호스트경로:docker경로 로 작성하면 된다고 해서 compose up시 실행해봤으나 docker-compose up에서는 unknown shortand flag로 에러가 났습니다.

그 외에는 아직 적절한 방법을 찾지 못하고 있습니다;;;

 

뭔가 좋은 방법이 없을까요?

0

yisi님의 프로필

yisi

질문자

2023.08.28

말씀하신 3개의 에러화면 입니다.

 

 

PS E:\Study-App\codecamp-backend\class\section04\04-07-docker-compose-with-mongoose-board2\backend> docker-compose up

[+] Running 2/2

✔ Container backend-my-backend-1 Created 0.6s

✔ Container backend-my-database-1 Created 0.0s

Attaching to backend-my-backend-1, backend-my-database-1

Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init:

error mounting "/run/desktop/mnt/host/e/Study-App/codecamp-backend/class/section04/04-07-docker-compose-with-mongoose-board2/backend/email.js" to rootfs at "/myfolder/email.js": mount /run/desktop/mnt/hos

t/e/Study-App/codecamp-backend/class/section04/04-07-docker-compose-with-mongoose-board2/backend/email.js:/myfolder/email.js (via /proc/self/fd/9), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

PS E:\Study-App\codecamp-backend\class\section04\04-07-docker-compose-with-mongoose-board2\backend>

 

그리고 package.json을 필요로 하는 명령어는

RUN yarn install과

CMD yarn start:dev 인데요.

RUN yarn install은 주석 처리하고 시도해봤는데 동일한 에러가 발생하고,

CMD yarn start:dev는 서버 실행 명령어라.... 시도해 보지 않았습니다.

안녕하세요! yisi님!

공유해주신 스크린샷을 보니, 수업때 진행했던 내용과 크게 다르지 않은 것 같네요!
코드의 문제는 아닌 것 같고, 환경의 문제를 의심해 보아야 할 것 같아요!

위 명령줄을 잠깐 보니, 윈도우 파워쉘에서 실행중이신 것 같은데, 현재 E드라이브에서 진행중이신 것 같아요!
윈도우 E드라이브와 Docker간의 볼륨 공유가 허용되고 있는지를 파악해 보시는게 좋을 것 같아요

Docker Desktop 설정에서 File-Sharing 관련하여, E드라이브가 공유되고 있는지 확인해보세요!

0

안녕하세요! yisi님!

보여주신 스크린샷을 확인해 보니, package.json이 없다고 나오고 있네요!
아무래도 Dockerfile 내부에서 yarn install, npm install 등의 package.json 파일을 필요로 하는 명령이 실행되고 있는 것 처럼 보여요!

Dockerfile 내부에서 package.json을 필요로 하는 명령이 포함되어있다면, 해당 명령을 지워주시고 다시 한 번 시도해 보세요!

만약, 해결이 되지 않는다면, Dockerfile해당 폴더구조, 에러화면 총 3장의 스크린샷을 올려주시면 더 정확하게 답변을 드릴 수 있을 것 같아요!^^