How to disable sendfile in docker instance
I have a dginx nginx instance running. The docker instance has a file called
/etc/nginx/nginx.conf
It has the following settings
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request"
access_log /var/log/nginx/access.log main;
sendfile on;
....
}
I am starting a docker instance by running the following command.
docker run -d -P -v /Users/user/site:/usr/share/nginx/html --name mysite nginx
How do I run the above command but change its config parameter to disable sendfile?
This answer is similar to mine . Do I need to create an assembly file? I am a bit confused.
+3
source to share
2 answers
There are many alternatives:
- has nginx.conf on the volume, so you can load different for different containers (or use the default if no mount volume options were passed)
- doesn't run nginx directly, but a shell script that does it with sed and then downloads nginx (or downloads nginx directly if no changes are needed)
- in nginx.conf or bash that load nginx, keep in mind the environment variables passed from the docker command line and define several to change the container behavior in specific ways.
- see above, set the volume on startup with just a bash script (which changes conf and starts nginx) and runs that script on startup.
- create a new nginx based image that just modifies the config file and will only weigh the difference between both containers (config file).
There are more variations on this using higher level tools, but this one is simple enough
0
source to share