0
votes

I am a beginner to docker.Please correct me if anything wrong.

As shown in this docker swarm tutorial https://www.youtube.com/watch?v=nGSNULpHHZc , i am trying to setup multhost setup for my hyperledger fabric application.

I am using two oracle linux servers namely server 1 and server 2. I connected both the servers using the docker swarm as managers and created overlay network called my-net.

I followed the same syntax given in the above mentioned tutorial and created the service using the beolw mentioned syntax.

docker service create --name myservice --network my-net --replicas 2 alpine sleep 1d

As expected it created one conatianer in each the server. Say for example server 1 coantainer IP is 10.0.0.4 and server 2 container IP 10.0.0.5. Now, i am trying to ping from the second servers container to first server's container as shown below and it is pinging.

# docker exec -it ContainerID sh
/ # ping 10.0.0.4
PING 10.0.0.4 (10.0.0.4): 56 data bytes
64 bytes from 10.0.0.4: seq=0 ttl=64 time=0.082 ms
64 bytes from 10.0.0.4: seq=1 ttl=64 time=0.062 ms
64 bytes from 10.0.0.4: seq=2 ttl=64 time=0.067 ms
^C
--- 10.0.0.4 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.062/0.070/0.082 ms

Now, I am trying to create my service(1) using the beolw mentioned syntax.

docker service create --name myservice1 --network my-net --replicas 2 hyperledger/fabric-peer sleep 1d

As expected this also created one conatianer in each the server. Say for example server 1 coantainer IP is 10.0.0.6 and server 2 container IP 10.0.0.7. Now, I am trying to ping from the second servers container to first server's container as shown below. This time i am getting ping not found error,
# docker exec -it ContainerID sh
# ping 10.0.0.6
sh: 1: ping: not found

Can anyone please help what is the problem with the second myservice1.

2

2 Answers

1
votes

The Fabric Docker images are based on a bare bones base Ubuntu image and do not include utilities like ping. Once you "exec" into the peer containers, you use "apt" to install ping:

apt-get update
apt-get install inetutils-ping

Added -ping at the end

0
votes

Expanding on Gari Singh's answer, on a Fabric network I've spun this week, the inetutils has been split in different packages:

# apt-cache search inetutils
inetutils-ftp - File Transfer Protocol client
inetutils-ftpd - File Transfer Protocol server
inetutils-inetd - internet super server
inetutils-ping - ICMP echo tool
inetutils-syslogd - system logging daemon
inetutils-talk - talk to another user
inetutils-talkd - remote user communication server
inetutils-telnet - telnet client
inetutils-telnetd - telnet server
inetutils-tools - base networking utilities (experimental pac

so to install e.g. ping the correct command has become:

# apt-get install inetutils-ping

The Ubuntu version of the peer is:

# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.5 LTS"