• 카테고리

    질문 & 답변
  • 세부 분야

    데브옵스 · 인프라

  • 해결 여부

    미해결

nginx 실습 관련 질문드립니다.

21.07.03 22:55 작성 조회수 466

1

nginx 실습 시 

localhost:50000 으로 요청하면 작성한 index.html이 아닌 nginx 본 메인페이지가 뜨고

명령프롬프트 창에는 다음과 같이 나옵니다

Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/Users/multicampus/docker_lab/wp/index.html" to rootfs at "/usr/share/nginx/html/index.html" caused: mount through procfd: 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. 

답변 1

답변을 작성해보세요.

1

안녕하세요!

에러 메시지로 보아 파일을 디렉토리로 연결했거나, 디렉토리를 파일로 연결한 것으로 보입니다.

/Users/multicampus/docker_lab/wp/index.html 해당 위치에 파일이 정확하게 있는지 다시 확인해보시고 docker 실행명령어를 알려주시겠어요?

감사합니다!

jjae님의 프로필

jjae

질문자

2021.07.04

안녕하세요.

로컬의 index.html 을 브라우저로 실행 시 주소 창에는

file:///C:/Users/multicampus/docker_lab/wp/index.html

이렇게 나오고,

명령어는 다음과 같습니다.

docker run -d --rm -p 50000:80 -v /Users/multicampus/docker_lab/wp/index.html:/usr/share/nginx/html/index.html nginx

안녕하세요!

windows의 사용중이시라면 다음과 같이 "c:/"를 붙여보시겠어요?

docker run -d --rm -p 50000:80 -v c:/Users/multicampus/docker_lab/wp/index.html:/usr/share/nginx/html/index.html nginx

그리고 도커 데스크톱 설정중에 공유 폴더가 체크되어 있는지도 확인 부탁드립니다.

감사합니다!

jjae님의 프로필

jjae

질문자

2021.07.04

정상적으로 동작합니다! 감사합니다.