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