How Containers Communicate
Docker networks provide virtual connectivity between containers. Containers attached to the same user-defined network can communicate using container or service names rather than hard-coded IP addresses.
Do not assume a container's IP address is stable. Service discovery by name is the normal pattern for multi-container applications.