Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save InsulaVentus/ec19d07f79444a20632ef0de72398b5c to your computer and use it in GitHub Desktop.
Save InsulaVentus/ec19d07f79444a20632ef0de72398b5c to your computer and use it in GitHub Desktop.

Determine which ip is assgined to a given container:

$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container-name>
172.23.0.2

The network inteface gateway follows the syntax; xxx.xxx.xxx.1, so in this case it will be: 172.23.0.1

Determine which interface the gateway ip is assigned to:

$ ip addr | grep 172.23.0.1
inet 172.23.0.1/16 brd 172.23.255.255 scope global br-616a87cde948

In this case the inteface is br-616a87cde948

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment