Member-only story
‘An accident caused by Docker container mounting’
Will Script House Set as“ Star symbol ⭐ ”
Received article updates as soon as possible
Source | Java Technology North (ID: javanorth)
background
Deploying nginx using Docker and configuring file mounting with the following parameters:
-v /deploy/nginx/conf.d/doc.crt:/etc/nginx/conf.d/doc.crt
-v /deploy/nginx/conf.d/doc.key:/etc/nginx/conf.d/doc.key
-v /deploy/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
Due to technical reasons, it is necessary to add a location in the future*.html
Disable cache, configure as follows
if ($request_filename ~* .*\\.(htm|html)$) {
add_header Cache-Control "no-store";
}
So I directly modified it on the host computer/deploy/nginx/conf.d/default.conf
File.
Then run itdocker exec -it pc-nginx nginx -s reload
Make the configuration effective.
But the actual test results did not take effect
I thought the configuration was wrong, so I spent a long time and changed several methods, but none of them worked.
Until I entered the container and checked the files inside, I found that the files…