Created
September 21, 2020 03:48
-
-
Save elreydetoda/a52dc42112017209647e8ff72f174dea to your computer and use it in GitHub Desktop.
Dynamic Env Vars for Docker: https://blog.elreydetoda.site/dynamic-env-vars-while-shipping-docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mapfile -t env_varz < <(env | grep -iE 'packet|tf_|vagrant_|circle|release' | cut -d '=' -f 1) | |
IFS=" " read -r -a env_vars_array <<< "$(printf ' -e %s' "${env_varz[@]}")" | |
docker container run --rm -it "${env_vars_array[@]}" -v "${PWD}/scripts":/scripts bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment