Skip to content

Instantly share code, notes, and snippets.

@IAmStoxe
Last active September 15, 2020 22:15
Show Gist options
  • Save IAmStoxe/fd3d917dcbd9a36aff37c18c1e788719 to your computer and use it in GitHub Desktop.
Save IAmStoxe/fd3d917dcbd9a36aff37c18c1e788719 to your computer and use it in GitHub Desktop.
docker-ips() {
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}} %tab% {{.Name}}' $(docker ps -aq) |
sed 's#%tab%#\t#g' |
sed 's#/##g' |
sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n
}
## docker-ips output
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment