Skip to content

Instantly share code, notes, and snippets.

@littlefuntik
Last active March 14, 2023 23:47
Show Gist options
  • Save littlefuntik/951a17a39fec19b12d3d5ad34281c7aa to your computer and use it in GitHub Desktop.
Save littlefuntik/951a17a39fec19b12d3d5ad34281c7aa to your computer and use it in GitHub Desktop.
Get runned docker container initial environments variables.
#!/bin/sh
DOCKER_CONTAINER_NAME_OR_ID="$1"
if [[ ! $DOCKER_CONTAINER_NAME_OR_ID ]]; then
echo "First argument must be RUNNED(!) docker container name or ID."
exit 1
fi
docker inspect -f '{{range $index, $value := .Config.Env}}{{println $value}}{{end}}' $DOCKER_CONTAINER_NAME_OR_ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment