I have set some environment variables(available only at runtime not known while creating container) in a running docker container as I explained here
Now when I go inside the container and run 'set' command I can see the environment variables but 'env' command does not show the variables I set using script.
Now I want to read the environment variables from the host machine using a script. My script is as below-
#!/bin/bash
set > envVariableList
But after successful execution of the script inside container 'envVariableList' file does not contain the environment variables I set after starting the container. The confusion here is, output of 'set' command in bash shell contains the environment variables but 'set' command in script gives different output to 'envVariableList' file. why? FYI: The script is run as 'root' inside container.
Can anyone please help me to read the custom environment variables set inside container from host machine?