Skip to content

Instantly share code, notes, and snippets.

@colinnewell
Last active April 26, 2019 10:34
Show Gist options
  • Save colinnewell/e595b5efef858a03a716 to your computer and use it in GitHub Desktop.
Save colinnewell/e595b5efef858a03a716 to your computer and use it in GitHub Desktop.
#!/bin/bash
EXTRA_FILTER=
if [ ! -z "$1" ]
then
EXTRA_FILTER="--filter name=$1"
fi
for id in `docker ps $EXTRA_FILTER --filter 'status=running' -a -q`
do
RUNNING=`docker inspect --format '{{ .State.Running }}' $id`
if [[ $RUNNING == "true" ]]
then
docker inspect --format '{{ .Name }} {{ range .NetworkSettings.Networks}}{{ .IPAddress }} {{end}} [{{ .Config.Image }}] with pid {{ .State.Pid }}' $id
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment