Let's say that we have a Docker container running on our system with a container ID e350390fd549 I would like to obtain its internal IP address. First, and recommended method is do use docker inspect command. The following linux command will print detailed information about your Docker container including its internal IP address:
# docker inspect e350390fd549
    "NetworkSettings": {
        "Bridge": "docker0",
        "Gateway": "",
        "GlobalIPv6Address": "",
        "GlobalIPv6PrefixLen": 0,
        "IPAddress": "",
        "IPPrefixLen": 16,
        "IPv6Gateway": "",
        "LinkLocalIPv6Address": "fe80::42:acff:fe11:2",
        "LinkLocalIPv6PrefixLen": 64,
        "MacAddress": "02:42:ac:11:00:02",
        "PortMapping": null,
        "Ports": {}
It is also possible to trip the default docker inspect docker command's output to get the IP address value only:
# docker inspect -f '{{ .NetworkSettings.IPAddress }}' e350390fd549
Depending on the operating system running within your docker container you can also attempt to execute ifconfig command internally and thus retrieve its IP address:
docker exec -it e350390fd549 /sbin/ifconfig eth0
docker exec -it e350390fd549 ip add show eth0
An another last resort alternative is to retrieve container's IP address directly from its config.json file located in /var/lib/docker/containers/CONTAINER-ID. For example:
#  grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" config.json
The first IP address is the actual containers IP address and the second IP address is its gateway.
Please refer all article related questions to:

You may also be interested in: