Map port of container to another container

Hi, I’m new to docker and and created three containers (web,db,solr) with cocker-compose.
These containers are linked to each other. E.g. web can connect to solr.
Although I have a port mapping, that the host can reach container “web” on port 80.

Now I want the web container to be able to reach the solr container on localhost:8080.
I need something like the port mapping from container to host between containers.

Is this possible?

I’d recommend to use Compose V2 format: https://docs.docker.com/compose/networking/ and put the containers on the same network.

Then, when you need to access one container from another, you can simply make a request to the DNS entry of the container’s name, e.g. if the container is called solr and you want to hit its port 8080, you simply call solr:8080 from within the client container.