How to get docker0 ip address platform independently

Viewed 6039

I'm building application which needs to have ip address of docker0 without using commands like ip addr show dev docker0. Is there any way to get it from docker itself maybe using docker command or something else? At least the docker info doesn't seem to show it.

2 Answers

Get just the gateway ip with:

$ docker network inspect bridge --format='{{(index .IPAM.Config 0).Gateway}}'
172.17.0.1
Related