Last active
August 29, 2015 14:04
-
-
Save vbatts/b2b0e114647d59635e5b to your computer and use it in GitHub Desktop.
Docker: Environment variables are no place for secrets
This file contains hidden or 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
#!/bin/sh | |
envfile=$(mktemp) | |
# Hard set one variable | |
echo FOO=bar >> ${envfile} | |
# and one pass through | |
echo BAZ >> ${envfile} | |
export BAZ="bif" | |
# run the container | |
container=$(docker run -d --env-file ${envfile} busybox true) | |
docker wait ${container} | |
echo "NOTICE: both FOO and BAZ are recorded" | |
docker inspect -f '{{.Config.Env}}' ${container} | |
rm ${envfile} | |
docker rm ${container} | |
## Output: | |
# 0 | |
# NOTICE: both FOO and BAZ are recorded | |
# [FOO=bar BAZ=bif HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin] | |
# f7f38ba54e48fbda5e446e06d46fa3a62ae0f87f1cc0923bf4c2c3d251f5658f | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Isn't this WAD? I'm focused.