Last active
June 10, 2022 01:21
-
-
Save afriza/f857c2da90ab3133be4f5017f41622f9 to your computer and use it in GitHub Desktop.
List all IPs of all running docker containers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env -S sh | |
# Reference: https://stackoverflow.com/a/36883565/109747 | |
docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}' $(docker ps -aq) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env -S sh | |
# Reference: https://stackoverflow.com/a/63023383/109747 | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment