Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
5 views
in DevOps and Agile by (29.3k points)
edited by

I am trying to ping one container to another using the same overlay network with below command but getting below error and not able to ping. Please help

 Command : 

docker exec -it 178f55186def ping b3a5a166f309

Error Received

Error response from daemon: endpoint with name 

apache2ex.2.m64gyrzwtgfx3250259impf9o already exists in network mynw

root@ip-172-31-43-191:~# docker exec -it 178f55186def ping b3a5a166f309

OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"ping\": executable file not found in $PATH": unknown

1 Answer

0 votes
by (50.2k points)

For pinging the containers and creating containers on overlay network kindly refer to the below commands:

Master
 

sudo apt-get update
sudo apt-get install docker.io
sudo docker swarm init
sudo docker network ls
sudo docker network create --driver=overlay --attachable test
sudo docker network ls
sudo docker run -it --name ubuntu1 --network test ubuntu
 

Node

sudo apt-get update

sudo apt-get install docker.io

sudo docker swarm join --token SWMTKN-1-3f2a1cuc6omfjsdp5x0ybqodrvy4dvk7tz0gb3xtsr5ajxa88p-dxdlmo4hzuu4hv0kvddjpwh6u 172.31.86.175:2377

sudo docker run -it -d --name ubuntu1 --network test ubuntu

sudo docker network ls

Then on master inside the container run the below commands:
 

apt-get update
apt-get install iputils-ping
ping ubuntu2

Here, we are not creating replicas of the container we are creating  2 containers among master and node for pinging them above commands are helpful. 

For more information, check out this Docker Tutorial.

Related questions

0 votes
1 answer
asked Mar 27, 2020 in DevOps and Agile by chandra (29.3k points)
0 votes
1 answer
asked Mar 20, 2020 in DevOps and Agile by chandra (29.3k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...