Skip to content

Instantly share code, notes, and snippets.

@white-gecko
Created August 7, 2015 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save white-gecko/a7e31d6eee879b9cf179 to your computer and use it in GitHub Desktop.
Save white-gecko/a7e31d6eee879b9cf179 to your computer and use it in GitHub Desktop.
Docker environment management with $DOCKER_ENV
#!/bin/bash
list ()
{
echo "local"
echo "remote1"
}
env_remote1 ()
{
export DOCKER_HOST="remote1.org:2375"
export DOCKER_TLS_VERIFY="1"
export DOCKER_CERT_PATH="$HOME/mydockerkeys/remote1/"
}
env_local ()
{
export DOCKER_HOST="unix:///var/run/docker.sock"
export DOCKER_TLS_VERIFY=""
export DOCKER_CERT_PATH=""
}
env_${DOCKER_ENV}
if [ $1 == "list-env" ]
then
list
else
/usr/bin/docker $@
fi
@white-gecko
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment