I use the official nginx docker image (https://registry.hub.docker.com/_/nginx/). When I modify the Index.html I don't see my change. Setting sendfile off
in nginx.conf didn't help.
I only see the change if i rebuild my image.
Here is my Dockerfile:
FROM nginx
COPY . /usr/share/nginx/html
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
And that's the commands I use to build and run it:
docker build -t some-nginx .
docker run --name app1 -p 80:80 -v $(pwd):/user/share/nginx/html -d some-nginx
Thank you
Just modify sendfile off in nginx.conf file can be work.
It's not caching. Once a file is copied into a container image (using the
COPY
instruction), modifying it from the host will have no effect - it's a different file.You've attempted to overwrite the file by bind-mounting a volume from the host using the
-v
argument todocker run
. This will work - you will now be using the same file on host and container, except you made a typo - it should be/usr
not/user
.