about summary refs log tree commit diff
path: root/docker-ip
blob: e4da3692481057c672a95eae2bd80cceb9b343d6 (plain) (blame)
1
2
3
4
5
6
7
8
#!/bin/sh

for i in $(docker ps -q | awk '{print $1}'); do
    ip=$(docker inspect --format="{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" "${i}")
    name=$(docker ps | awk -v i="${i}" '/i/ {print $NF}')

    printf "%s\t%s\n" "${ip}" "${name}"
done

Consider giving Nix/NixOS a try! <3