Every container is accessible through its own IP address. For instance, we can find the IP address of our elasticsearch-oss container by running docker inspect, and looking under NetworkSettings.IPAddress:
$ docker inspect a415f4b646e3[ { "Id": "a415f4b646e3a71...81b9b7f6dcaf76b", "Created": "2018-05-10T19:37:55.565685206Z", "Image": "sha256:3822ba554fe9...adf11f6a59bde0139", "Name": "/elasticsearch", "Driver": "overlay2", "NetworkSettings": { "Ports": { "9200/tcp": [{ "HostIp": "0.0.0.0", "HostPort": "9200" }], "9300/tcp": [{ "HostIp": "0.0.0.0", "HostPort": "9300" }] }, "Gateway": "172.17.0.1", "IPAddress": "172.17.0.2", ... } ... }]
You can also use the --format or -f flag to retrieve only the field you are interested ...