I can ping InfluxDB
running inside a docker container, with a port exposed in the host, from the host:
» curl -k -L -I https://localhost:8086/ping
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: 2bb1059b-360e-11e7-8001-000000000000
X-Influxdb-Version: 1.2.0
Date: Thu, 11 May 2017 05:53:34 GMT
I run an Ubuntu 16.04
docker container (with curl installed), connected to the same network as the InfluxDB
container, and I was not able to ping localhost:8086
. Finally I found out that I need to ping using the IP address of the InfluxDB
container:
root@4a5457a5e297:/# curl -k -sL -I https://172.18.0.1:8086/ping
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: d8ab4282-360e-11e7-8002-000000000000
X-Influxdb-Version: 1.2.0
Date: Thu, 11 May 2017 05:58:25 GMT
Which means that first I need to find out the IP address of the InfluxDB
container. I just guessed, since I was not able to do ifconfig
in the InfluxDB
container, and I have no idea how to list the IPs of all running containers: docker ps
does not show it.
So, the port of InfluxDB
is exposed in the the host as localhost:8086
, but it is not exposed to the other containers. Some questions:
- Is it possible to address containers by name? Does docker automatically assign DNS entries to the containers, and can those be resolved from withing the containers? From within the host? What is the naming scheme?
- Is it possible to expose ports from one container not only to the host, but to all other containers (running in the same network), so that I can ping
localhost:8086
from any container? - How do I get a list of IPs for all running containers?