I have an entrypoint script that gets called in my Dockerfile's entrypoint:
ENTRYPOINT ["/bin/sh", "-c" , "/var/run/fmx/Scripts/entrypoint.sh"]
As part of this script, it retrieves a certain value from a file (a port number, 5140).
Checking the logs, using kubectl logs < pod-name >
, I can see that the value does get retrieved from the file and printed:
eccd@director-0-ccd-c16c002:~> kubectl logs < pod-name >
5140
rsyslogd: unknown priority name "" [v8.2106.0]
rsyslogd: module 'imfile' already in this config, cannot be added [v8.2106.0 try https://www.rsyslog.com/e/2221 ]
In the script, I am doing the following:
#!/bin/bash
export RSYSLOG_LISTEN_PORT=$(sed -nE 's/.*port="([^"]+)".*/\1/p' /etc/rsyslog.d/0_base.conf)
echo $RSYSLOG_LISTEN_PORT
However, inside the pod, printenv | grep RSYSLOG_LISTEN_PORT
returns nothing, showing the env var doesn't get set. I think this is due to the script being ran as a child process, and being unable to affect the parent process: https://stackoverflow.com/a/496777/18397787
Is there any way I can achieve having the value being set as an env var?