Skip to content

Instantly share code, notes, and snippets.

@diginc
Last active August 29, 2015 14:04
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 diginc/a97090e2c0443b1d689e to your computer and use it in GitHub Desktop.
Save diginc/a97090e2c0443b1d689e to your computer and use it in GitHub Desktop.
docker bash aliases
alias sdo='sudo docker'
function dockinfo {
if [ -z "$1" ] ; then
echo "dockinfo usage: dockinfo <container> [inspect format string]"
echo -e """ Example inspection elements:\n "Args"\n "Config"\n "Created"\n "Driver"\n "ExecDriver"\n "HostConfig"\n "HostnamePath"\n "HostsPath"\n "Id"\n "Image"\n "MountLabel"\n "Name"\n "NetworkSettings"\n "Path"\n "ProcessLabel"\n "ResolvConfPath"\n "State"\n "Volumes"\n "VolumesRW"\n"""
# Generated list with: sudo docker inspect test_jenkins | grep -Po '^ {4}"\w+"'
kill -INT $$
else
CONTAINER="$1"
fi;
if [ -z "$2" ] ; then
INSPECT='.';
else
INSPECT="$2";
fi;
sudo docker inspect -f "{{ json $INSPECT }}" $CONTAINER | python -mjson.tool
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment