查看所有容器ip

# 宿主主机查看
$ docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' \
$(docker ps -aq)
/mysql-slave - 172.17.0.3
/mysql-master - 172.17.0.2

查看容器ip

# 进入容器后查看
$ cat /etc/hosts

127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2 7c5390f1dba0

参考
​如何获取 docker 容器(container)的 ip 地址​​