Skip to content

CLI tool does not work when SSHing into the container due to missing env vars #2057

Answered by j-sacra
j-sacra asked this question in Help wanted
Discussion options

You must be logged in to vote

Adding the required env vars to /.profile seems to work!
Looks like I do need to force it to load by running source /root/.profile once in the ssh session. But after that a printenv shows that all exported vars are loaded correctly. Testing on Azure it also looks like these are persisted for the user which is nice as I don't need to run it everytime I want to use the CLI.

# Specify the path to the profile script you want to modify
PROFILE_SCRIPT="/root/.profile"

# Append export statements to the profile script
echo "export DB_DRIVER='${DB_DRIVER:-}'" >> "$PROFILE_SCRIPT"
echo "export DB_HOST='${DB_HOST:-}'" >> "$PROFILE_SCRIPT"
echo "export DB_NAME='${DB_NAME:-}'" >> "$PROFILE_SCRIPT"
ec…

Replies: 8 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@j-sacra
Comment options

Answer selected by j-sacra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2055 on March 12, 2024 12:18.