yuliabarabash2601
yuliabarabash2601

Reputation: 23

Cannot mount file as a volume in nginx

I am new to Docker and I have only started learning. I have faced a problem to mount index.html in Nginx. I am using Docker Toolbox for Windows 10 Home. I set the shared folder for my virtual machine 1.

When I want to mount a server with index.html I see the problem 404 Not Found. I use the following command to do this.

docker container run --name con6 -p 80:80 -v /c/Docker/html://usr/share/nginx/html nginx

Could somebody help me? Thank you in the advance

I have the following input after loading localhost:

2020/03/29 21:59:14 [error] 6#6: *1 "/usr/share/nginx/html/index.html/index.html" is not found (20: Not a directory), client: 192.168.99.1, server: localhost, request: "GET /index.html/ HTTP/1.1", host: "192.168.99.100"

192.168.99.1 - - [29/Mar/2020:21:59:14 +0000] "GET /index.html/ HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36" "-"

Upvotes: 1

Views: 933

Answers (1)

nischay goyal
nischay goyal

Reputation: 3480

Can you please run the below command to mount the HTML into the container.

docker container run --name con6 -p 80:80 --mount type=bind,source="/c/Docker/html",target="/usr/share/nginx/html" nginx

For reference:- https://docs.docker.com/storage/bind-mounts/

Upvotes: 0

Related Questions