I am completely new to Docker and don't really understand how "link" works between containers. I wrote a little java-program with some packages and I want each package to run on a different container. I would like the packages to find each other through the link and communicate with each other. The goal is, that when I execute the main class in my main container, that this class finds all the other packages in the other containers and can use them. It works without a problem when I use volumes but I would like to know if I can do it just with links and ports and without having to use volumes.
I imagine this being a very stupid question but I read everything here: https://docs.docker.com/userguide/dockerlinks/ but still don't understand how it really works.
Could someone help me with it?