Container comunication

Hey I read everywhere that to comunicate 2 containers have to be in the same network, and it give me a problem.
I have a docker on a server and I want to make it comunicate with an other server where are some apis in container or out so my question is is it possible to make them comunicate ?
In a practical way I have kong inside a container and I want to add api from other servers so is it possible in the case of non-dockerized api and in the case of dokerized one ?
My issue is if 2 container have to be part of the same docker network to comunicate how can I make containers on different physical server to comunicate

Sure, configure your containerized service to point at the DNS name of the other server. This works fine.

On “the other server”, make sure you run your container with a -p option that exposes a port on the host. Now, from the point of view of the container on the first server, it’s indistinguishable whether the second server is running the process directly or in a container; configure it the same way as before.