Hi all,
I want to be able to ping or basically access a running docker container from another container by simply using the docker name rather than an IP address. I’ve tried a few guides but I could not get it working. Has anyone been able to get this working?
Thanks a lot!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello,
Yes this now comes more or less out of the box with Docker Networks, so what you need to do is:
Important note: it is very important to explicitly specify a name with
--name
for your containers otherwise I’ve noticed that it would not work with the random names that Docker assigns to your containers.Then create a new network:
Again it is quite important to explicitly specify names for your containers otherwise this would not work. I figured this out after spending a few hours trying to figure it out.
Here’s a quick video demo on how to do the above:
Hope that this helps! Regards, Bobby
create a bridge network and attach the containers to it , then you can ping them by name.