'set' command work differently in terminal and in script in Docker
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?