Created
June 11, 2021 20:55
-
-
Save roldan/32014a6d4ddd884e42e7643f4b883d66 to your computer and use it in GitHub Desktop.
`docker ps` with custom format to show containers names with their ip addresses and ports
This file contains hidden or 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
$ docker ps -q | xargs -n 1 docker inspect --format '{{.Name}}\TAB{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}\TAB{{range $p, $conf := .NetworkSettings.Ports}}{{$p}} {{end}}' | sed 's/\///' | column -t -s '\TAB' | |
postgres11-main 172.18.0.4 5432/tcp | |
mysql-main 172.18.0.2 3306/tcp 33060/tcp | |
postgres9.6-main 172.18.0.3 5432/tcp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment