Точно уверен ?
Allowing Containers to Talk to Each Other Internally
Containers on the same network can talk to each other over their exposed ports without having to publish ports back to the Docker host with -p.
This is useful for services like Postgres or Redis. These are things you typically wouldn’t want accessible from the internet, but you would want them accessible to your web application containers running on the same Docker network.
If that’s the case you’ll need to use EXPOSE or --expose, but…
If you check out the official Docker images for Postgres and Redis, you’ll notice they set up EXPOSE 5432 (Postgres) and EXPOSE 6379 (Redis) in their Dockerfile already.