I have some containers that communicate via their IP from the network docker.
I can use the option -h or --hostname when running a new cont
One way is to create network and add different container in this network.
When adding container in the network, you can use the --alias option of docker network. Like this:
Create a network:
docker network create
Add containers in the network:
docker network connect --alias
docker network connect --alias
docker network connect --alias
Enjoy.
So each container can see other container by the alias (the alias is used as hostname).