Springboot container cant connect with elasticsearch container

I created springboot application with elasticsearch run in docker, at first when i run the application at the ide it run good, however, after i created springboot container and run in docker with docker-compose, this container cant connect to elasticsearch container anymore…

one impotant information is that 2 container can connect if i set network_mode:host (but i dont want to use that)

Here is my related code :

application.properties
server.port=5454

spring.application.name=Online Food Ordering System
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://${MYSQL_HOST:******.****.ap-southeast-1.rds.amazonaws.com}:3306/online_food_ordering_service
spring.datasource.username=*****
spring.datasource.password=*******
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

spring.data.elasticsearch.client.reactive.endpoints=elasticsearch:9200



stripe.api.key=sk_test_*****************************************************

docker-compose:

THANKS FOR HELPING MEEEEEEE

You are using an external network. That means you should create your network externally. Are you sure that network exists ?

docker network ls

yes sir, i created it before

What is the driver of your network can you share the output of

docker network ls

please

Here you are,

8c51be46b949 food-ease-network bridge local

I will provide you with the GitHub link of the project before it creates and connects the two images. I hope you can try to create the necessary Docker files and connect them.

GitHub link: DuongEoKay/FoodEase (github.com)

For any further information, you can contact me through: vanduongg1711@gmail.com

Thank you very much.

@vanduongg1711 Can you also provide the screenshot or log of the error you’ve encountered

Share your full docker-compose.yml, not as image. It seems not included in the repo.

1 Like

i updated the repo sir