Skip to content

Instantly share code, notes, and snippets.

@rmueller
Created April 11, 2018 11:45
Show Gist options
  • Save rmueller/d4beb4a3fe6d2138210e0664b078e600 to your computer and use it in GitHub Desktop.
Save rmueller/d4beb4a3fe6d2138210e0664b078e600 to your computer and use it in GitHub Desktop.
function docker-ips() {
(
echo 'CONTAINER ID|NAME|IP|PORTS';
docker ps --quiet "$@" | xargs --no-run-if-empty docker inspect --format='{{printf "%.12s" .Id}}|{{.Name}}|{{range $net, $conf := .Netw
orkSettings.Networks}}{{$net}}:{{$conf.IPAddress}} {{end}}|{{.NetworkSettings.Ports}}'
) | column -t -s '|'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment