0

I'm trying to fix service-2-service dns inside my swarm.

I'm instantiating 3 docker swarm services using the docker remote api. They startup fine, and i can access their content from inside the container:

$ docker ps
0c8bf8da5254        scuba/as-model-runner:latest         "/bin/sh -c 'python …"   35 minutes ago      Up 35 minutes model_runner2.3.tx9jka07amgabzzsgmhyg2c02
7938c295a378        scuba/as-model-runner:latest         "/bin/sh -c 'python …"   35 minutes ago      Up 35 minutes model_runner1.3.h7hveywzsvqbkeks7l6xb4h9w
3e9aea7bc5f1        scuba/as-model-runner:latest         "/bin/sh -c 'python …"   35 minutes ago      Up 35 minutes model_runner0.3.ehx8cpyafdnrf3kf717l2mvoe

$ docker exec -it model_runner0.3.ehx8cpyafdnrf3kf717l2mvoe sh
# curl http://0.0.0.0
Hello, World!# 

However, i am unable to ping between services

$ ping model_runner2.1.cvgzi1g1c7m2lvptx9qgm2m5k
ping: model_runner2.1.cvgzi1g1c7m2lvptx9qgm2m5k: Name or service not known
$ ping model_runner2.1                          
ping: model_runner2.1: Name or service not known
$ ping model_runner2                            
ping: model_runner2: Name or service not know

This is the default network inspection for the container:

$ docker inspect --format '{{json .NetworkSettings}}' model_runner0.3.ehx8cpyafdnrf3kf717l2mvoe | jq
{
  "Bridge": "",
  "SandboxID": "b31061f07c12fe8993d8c1ca23376d439ea0baa6ecb0c4056bea52e473b984b8",
  "HairpinMode": false,
  "LinkLocalIPv6Address": "",
  "LinkLocalIPv6PrefixLen": 0,
  "Ports": {},
  "SandboxKey": "/var/run/docker/netns/b31061f07c12",
  "SecondaryIPAddresses": null,
  "SecondaryIPv6Addresses": null,
  "EndpointID": "",
  "Gateway": "",
  "GlobalIPv6Address": "",
  "GlobalIPv6PrefixLen": 0,
  "IPAddress": "",
  "IPPrefixLen": 0,
  "IPv6Gateway": "",
  "MacAddress": "",
  "Networks": {
    "ingress": {
      "IPAMConfig": {
        "IPv4Address": "10.255.1.116"
      },
      "Links": null,
      "Aliases": [
        "3e9aea7bc5f1"
      ],
      "NetworkID": "o8bwqup67xdbvfd2i3503b3db",
      "EndpointID": "8dbea9a07fc9b146a49bd08d17dec226d17bfff00eaa004dfb82aaf45dc39218",
      "Gateway": "",
      "IPAddress": "10.255.1.116",
      "IPPrefixLen": 16,
      "IPv6Gateway": "",
      "GlobalIPv6Address": "",
      "GlobalIPv6PrefixLen": 0,
      "MacAddress": "02:42:0a:ff:01:74",
      "DriverOpts": null
    }
  }
}

Do i need to add the services to a specific network? What do i need to modify to get them to be available via dns?

  • can you ping their ip? – Efrat Levitan May 25 at 23:15
  • @EfratLevitan - yes i can – Jack Murphy May 31 at 17:02
  • try using their original names (from the compose file) – Efrat Levitan Jun 1 at 17:52
  • These are all programmatically generated use the docker http api – Jack Murphy Jun 2 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.