Skip to content

Instantly share code, notes, and snippets.

@askalee
Created June 8, 2018 08:18
Show Gist options
  • Save askalee/616d9696b53deb14100bf35168601973 to your computer and use it in GitHub Desktop.
Save askalee/616d9696b53deb14100bf35168601973 to your computer and use it in GitHub Desktop.
Get docker container environment variables
#!/bin/bash
containerName=$1
echo "containerName: $containerName"
if [ "$containerName" == "" ]; then
echo "USAGE: $0 containerName"
echo " containerName: id or name"
exit 1
fi
docker inspect -f \
'{{range $index, $value := .Config.Env}}{{println $value}}{{end}}' \
$containerName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment