There a many ways to find the ip of a container. Some of the methods i am listing down.
[root@localhost ~]# docker run -d –name mylinux rhel7
9f7213f3c373b06a6a5d8d762bd05c2282db9e1ecb0da421b8280e07291c0535
docker inspect
"NetworkSettings": { "Bridge": "", "SandboxID": "f8b8d1847392e520fc79cff3c3637fdfbd28aaded2290ad851aaab3adce23c6f", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": null, "SandboxKey": "/var/run/docker/netns/f8b8d1847392", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "", "Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "", "IPPrefixLen": 0, "IPv6Gateway": "", "MacAddress": "", "Networks": { "bridge": { "IPAMConfig": null, "Links": null, "Aliases": null, "NetworkID": "fd99db2fc2a78f959b1e3b691d4a38125f5e5a2422267c08136d2ad0746e8e35", "EndpointID": "", "Gateway": "", "IPAddress": "172.17.0.2", "IPPrefixLen": 0, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "" }
docker inspect --format '{{.NetworkSettings.IPAddress}}' mylinux 172.17.0.2
docker exec command and check the ip address that executes within the container
docker exec -ti mylinux ip add |grep global