docker network ls helps you partially in this, by listing all Docker networks:
$ docker network ls NETWORK ID NAME DRIVER SCOPE 3eb73575a250 bridge bridge local 6ce0e4a8be79 centre_isp_services_default bridge local abe7381d0bfd elasticsearchhq_default bridge local bb4387bdfac2 host host local cc3e69407994 metrics_default bridge local 55f1c6914497 none null local 26f3247f27cc postgres-112_default bridge local
docker network inspect bridge hints that the information is available under IPAM.Config.Subnet:
$ docker network inspect bridge [ { "Name": "bridge", "Id": "3eb73575a2503d6758f8baed97ec478ebaed3e75df21b4269bd170edd94337de", "Created": "2019-11-08T11:33:49.489800945+02:00", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "172.31.0.0/24" } ] }, "Internal": false, "Attachable": false, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": {}, "Options": { "com.docker.network.bridge.default_bridge": "true", "com.docker.network.bridge.enable_icc": "true", "com.docker.network.bridge.enable_ip_masquerade": "true", "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", "com.docker.network.bridge.name": "docker0", "com.docker.network.driver.mtu": "1500" }, "Labels": {} } ]
One would have hoped that docker network ls --format '{{.Name}} {{.IPAM.Config.Subnet}}' would be able to give us this information, but regretfully, this is not the case. Only a few fields are available using that command.
The solution
So, we have to jump through a few hoops to get it done. This does the trick:
$ for e in $(docker network ls --format '{{.Name}}') ; do docker network inspect $e --format '{{ printf "%-40s" .Name}} {{.IPAM.Config}}'; done bridge [{172.31.0.0/24 map[]}] centre_isp_services_default [{172.24.0.0/16 172.24.0.1 map[]}] elasticsearchhq_default [{172.23.0.0/16 172.23.0.1 map[]}] host [] metrics_default [{172.22.0.0/16 172.22.0.1 map[]}] none [] postgres-112_default [{192.168.0.0/20 192.168.0.1 map[]}]
docker inspect $(docker ps -q) | jq .[].NetworkSettings.IPAddressdocker-compose, with a dedicated network for each folder in which I have adocker-compose.ymlfile.