Server root unable to connect to rabbitmq

I am following intellij guide to set up my dev env locally, when i run server boot and webRestApiApplication, it show logs error that its unable to connect to rabbitmq, despite i provided the correct host and port, and i am runnig the rabbitmq in docker container like in the guide by infrastracture docker-compose.
first i had this error : ''java.net.UnknownHostException: rabbitmq: Temporary failure in name resolution",
so i added rabbitmq to ‘etc/hosts’ with my local ip address
then another error showed, connection refused.
can you guys explain to me how to set up correcly my dev env and how provide the correct configs with metasfresh.properties and application.properties files