인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

인프런 커뮤니티 질문&답변

jjae님의 프로필 이미지
jjae

작성한 질문수

초보를 위한 도커 안내서

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

작성

·

568

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

subicura님의 프로필 이미지
subicura
지식공유자

안녕하세요!

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

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

감사합니다!

jjae님의 프로필 이미지
jjae
질문자

안녕하세요.

로컬의 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

subicura님의 프로필 이미지
subicura
지식공유자

안녕하세요!

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
질문자

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

jjae님의 프로필 이미지
jjae

작성한 질문수

질문하기