How to programmatically get a Docker network address
[mihamina@ATS ~]$ docker network inspect
[
{
"Name": "",
"Id": "41d400c7e989ff6eadc051d71b6bd9f2b29a6b4549d6abec",
"Created": "2021-01-19T12:39:01.579234574+03:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {},
"Labels": {}
}
]
[mihamina ~]$ docker network inspect --format='{{range .IPAM.Config}}{{.Gateway}}{{end}}'
172.18.0.1