I am trying to do the simplest possible container with Nginx hosting a simple index.html file. But I can't seem to get it working. I must be missing a concept somewhere and I am hoping for a bit of help.
Here is what I am doing:
I have a folder with 2 files in it:
Dockerfile
FROM nginx:1.18.0 WORKDIR /usr/share/nginx/html COPY index.html ./index.html
<!DOCTYPE html> <html> <head> <title>Testing</title> </head> <body> <p>Hello Test App</p> </body> </html>
First I build the container. From the folder that has the files, I run this command:
docker image build --tag nginx-test:1.0.0 --file ./Dockerfile .
Then I run the container:
docker run -d -p 3737:3737 nginx-test:1.0.0
Then I browse to http://localhost:3737 (I also tried http://localhost:3737/index.html) and chrome shows an ERR_EMPTY_RESPONSE error:
How can I get my index.html file to be hosted in my container?
