Skip to main content

Some Docker commands

 

This will take all running containers, and show you the ports and container names.

docker ps --format "{{.Names}} {{.Ports}}" | awk '{name=$1; for(i=2;i<=NF;i++) if($i~/0\.0\.0\.0:/) {split($i,a,":"); split(a[2],b,"->"); print b[1], name}}' | sort -n