docker swarm access service

How to access swarm services on a multi-host docker swarm.

For a docker swarm, lets say that the services are named: abc, pqr, xyz

  • sharing of OS image resources across multiple docker containers
  • How to build a docker container with nix?
  • Kubernetes multinode setup cannot remove docker0 interface
  • bluemix “docker images” results in “json: cannot unmarshal string into Go value of type int”
  • kubernetes set list of all physical nodes
  • Unable to connect to cassandra from Docker container using spring-data-cassandra: NoHostAvailableException: All host(s) tried for query failed
  • If the services are placed in the same host, they are able to access by http://pqr/a or http://xyz/a

    but if they are on different host they are not able to access by http://pqr/a or http://xyz/a. Even ping to the other service names are not working.

    docker service create --constraint 'node.labels.momachinename == t4301' --name abc --network=ni_default mo-vo:7.10.0s node /a/src/start.js
    docker service create --constraint 'node.labels.momachinename == t4302' --name pqr --network=ni_default mo-vo:7.10.0s node /a/src/start.js
    docker network ls
    NETWORK ID          NAME                DRIVER              SCOPE
    d7478273de19        bridge              bridge              local
    485112e08c0f        docker_gwbridge     bridge              local
    c8a75eb27f1f        host                host                local
    5rmqgswur2lp        ingress             overlay             swarm
    q26p8tdr0xw6        networld            overlay             swarm
    d2kf3bfdbmol        ni_default          overlay             swarm
    64094b86b804        none                null                local

  • Changing /proc/sys/kernel/core_pattern file inside docker container
  • How to run Linux and Windows docker containers at single windows machine?
  • How to Mount Hugepages inside Docker
  • How can I detect if docker for mac is installed?
  • Dockerized Riak cluster - dynamic container IP
  • How to insert dockerised cron process in a docker-compose built LEMP stack?
  • One Solution collect form web for “docker swarm access service”

    From your symptoms, it sounds like you have the containers running on the same overlay network and can communicate using DNS resolution on the same host, but you’re just having problems between hosts. For overlay networking between hosts, you need the following firewall rules:

    iptables -A INPUT -p tcp -m tcp --dport 7946 -j ACCEPT
    iptables -A INPUT -p tcp -m udp --dport 7946 -j ACCEPT
    iptables -A INPUT -p tcp -m tcp --dport 4789 -j ACCEPT
    iptables -A INPUT -p 50 -j ACCEPT

    That’s port 7946 for tcp/udp (this is the control port), port 4789 for tcp (this is the data port), and protocol 50 (needed for secure networks using IPSEC).

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.