# using sed
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}} %tab% {{.Name}}' $(docker ps -aq
) | sed 's#%tab%# #g' | sed 's#/##g' | sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n
#Also as a bash alias:
docker-ips() { docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}} %tab% {{.Name}}' $(docker ps -aq) | sed 's#%tab%# #g' | sed 's#/##g' | sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n }
#Output is sorted by IP address, and tab delimited:
# docker-ips
172.18.0.2 memcached
172.18.0.3 nginx
172.18.0.4 fpm-backup
172.18.0.5 dns
172.18.0.6 fpm-beta
172.18.0.7 exim
172.18.0.8 fpm-delta
172.18.0.9 mariadb
172.18.0.10 fpm-alpha
172.19.0.2 nextcloud-redis
172.19.0.3 nextcloud-db
172.19.0.4 nextcloud