Environment Variables Not Inherited by Worker Processes in Docker Container #583
Replies: 2 comments 1 reply
-
This seems to work fine, however I indeed do not see the variables in
|
Beta Was this translation helpful? Give feedback.
-
I found it interesting that Docker and nginx are being used together, so I did some research and found a reference stating that the TZ environment variable is implicitly inherited by the worker processes. Reference: https://nginx.org/en/docs/ngx_core_module.html#env For your information, when you run a Docker container with the -e parameter, these are treated as Linux environment variables within the container (you can verify this by running the 'env' command via docker exec). I hope this reference is very helpful for your work. Have a nice day! |
Beta Was this translation helpful? Give feedback.
-
Description:
I need to pass a few environment variables to the worker processes because I am using another module that requires specific environment variables to be passed. However, I am experiencing an issue where environment variables set in the master process are not inherited by the worker processes when running Nginx in a Docker container. Despite using the
env
directive in thenginx.conf
file and setting environment variables correctly, the worker processes do not seem to have access to these variables.I can see the variables I set when I list the environment variables in the container, but they are not present in
/proc/PID_of_nginx_worker/environ
.Steps to Reproduce:
env
directive to thenginx.conf
file:Expected Behavior:
The worker processes should inherit the environment variables
TZ
andTEST_ENV_VARIABLE
from the master process and be accessible in/proc/PID_of_nginx_worker/environ
.Actual Behavior:
The worker processes do not inherit the environment variables, and they are not accessible.
How to Check:
You can verify the environment variables in the worker processes using the following script:
Any guidance or solutions to ensure environment variables are correctly inherited by worker processes would be greatly appreciated.
Thank you for your assistance!
Beta Was this translation helpful? Give feedback.
All reactions