1 min readOct 12, 2020
Good question. The "hostname" in the "rabbitmq" service is a configuration for RabbitMQ, which sets the hostname in a cluster or set the hostname as a full qualified domain name. The hostname "my-rabbit" is not required in my demo.
On the other hand, within the docker-compose default network, the actual "machine name" is the "service name" which represents the container. So I have to use "rabbitmq" to talk to the service in that container. This is sort of convention in docker compose.