Docker Swarm Overlay Network Communication

0 votes

I'm trying to setup a Docker Swarm where containers comunicate using Overlay Network.

I'm simulating the infrastructure using 4 Raspberry Pi 3 Boards using HypriotOS 1.0.0 Linux distribution which include Docker Engine 1.12.1

After Swarm initialization ssh into manger node

# create one overlay network
$ docker network create --driver overlay swarm_network
# create first service (foo)
$ docker service create --replicas 1 --name foo --network swarm_network resin/rpi-raspbian tail -F -n0 /etc/hosts
# create second service (bar)
$ docker service create --replicas 1 --name bar --network swarm_network resin/rpi-raspbian tail -F -n0 /etc/hosts
# list services
$ docker service ls
ID            NAME  REPLICAS  IMAGE               COMMAND
aqhcndcdoaf4  bar   1/1       resin/rpi-raspbian  tail -F -n0 /etc/hosts
cylg7ws3egx7  foo   1/1       resin/rpi-raspbian  tail -F -n0 /etc/hosts
# find docker host running foo service
$ docker service ps foo
ID                         NAME   IMAGE               NODE     DESIRED  STATE  CURRENT STATE              ERROR
ed6z74ncz1zf0dqc7wph5huvk  foo.1  resin/rpi-raspbian  swarm-2  Running  Running about an hour ago

ssh into swarm-2 node

$docker ps
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS               NAMES
78b0e421efcd        resin/rpi-raspbian:latest   "/usr/bin/ ta"   48 seconds ago      Up 45 seconds                           foo.1.ed6z74ncz1zf0dqc7wph5huvk
# exec into the running container 
$ docker exec -it foo.1.ed6z74ncz1zf0dqc7wph5huvk /bin/bash
# try dns resolution (OK)
root@78b0e421efcd:/# nslookup bar                                                                   
Non-authoritative answer:
Name:   bar
# ping bar service (FAIL) 
root@314b0ef6c82c:/# ping -c 1 bar
PING bar ( 56(84) bytes of data.
From 314b0ef6c82c ( icmp_seq=1 Destination Host Unreachable
--- bar ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

I'm unable to ping my services what I'm doing wrong?

Aug 22, 2018 in Docker by lina
• 8,220 points

1 answer to this question.

0 votes

Try to recreate network like this : docker network create -d overlay --attachable ${NAme}

answered Aug 22, 2018 by Nilesh
• 7,040 points

Related Questions In Docker

0 votes
1 answer

How to create an overlay network in Docker swarm?

Hi@akhtar, To create an overlay network for use ...READ MORE

answered Dec 28, 2020 in Docker by MD
• 95,300 points
0 votes
1 answer

How do I scale in Docker Swarm Mode W/Terraform Digital Ocean Load Balancing

The solution you could build for Digital ...READ MORE

answered Jun 19, 2018 in Docker by shubham
• 7,320 points
0 votes
1 answer
0 votes
1 answer

Unable to switch filesystem to overlay in Docker in Ubuntu.

From the official docs: To configure Docker ...READ MORE

answered Jul 18, 2018 in Docker by ajs3033
• 7,280 points
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,140 points
+1 vote
4 answers

Communication between multiple docker-compose projects

You just need to make sure that ...READ MORE

answered Jul 30, 2018 in Docker by Kalgi
• 52,370 points
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria