I used a data volume to start the container.
docker run --name nginx-container -v /root/nginx/nginx.conf:/etc/nginx/nginx.conf -p 80:80 -d nginx
I modified the local configuration file through
docker exec -it nginx-container nginx -s reloadSend restart command, found useless, still use the original configuration file, must be
docker stop nginx-containerThen again
docker start nginx-container
Is my usage incorrect? I still can’t do this, the configuration in the container will be modified if the data volume should be modified locally. However, I connect to the container to check, and it is still the original configuration, indicating that the local modification has not taken effect, is there any missing link?
When I saw the official mapping the data volume, I added ro to the back, which means read-only. I don’t add anything, should I have the right to modify it?
In addition, I map a local index.html into the container, visit the home page and modify the local index.html, which is effective, but the mapped configuration file is not.
docker exec -it nginx-container service nginx reload