Spring Docker Compose Module - Connecting to the Container Database
HTML-код
- Опубликовано: 9 сен 2024
- In this tutorial you will learn how to connect to the database that is running inside of the container when using the Spring Boot Docker Compose Module. This will be helpful if you want to use your database tools to connect to the running database.
🔗Resources & Links mentioned in this video:
Docker Compose Introduction: • 🔥 New in Spring Boot 3...
👋🏻Connect with me:
Website: www.danvega.dev
Twitter: / therealdanvega
Github: github.com/dan...
LinkedIn: / danvega
Newsletter: www.danvega.de...
SUBSCRIBE TO MY CHANNEL: bit.ly/2re4GH0 ❤️
Brilliant stuff. Loving the Java 21 String Templates as well. Thanks for this tip! Awesome stuff indeed.
Wow! That must have been a frustrating learning experience. Thanks for saving us the grief.
Awesome video! Thank you, Dan :)
I was doing it just blindly 5432:5432, now i know the reason
Thank you for your sharing Dan !
I would love to see you make a video on configuring a reactive CRUD application using Java 21, HashiCorp Vault, Liquibase, and R2DBC, all services configured and running inside a docker compose.
that was grate, didnt know sprint has docker support, i would try it on my next projeet!
Adding the ":5432" part to the ports section in my docker-compose file actually breaks my app...
Try docker ps -a to get the container id and then running docker inspect on it and inspecting the port bindings. Maybe try deleting the container all together and starting over
Thanks a lot. Nice info. So does this mean: "when server is restarts containers will automatic restart"? It'll be wonderful if you give real working server example with docker-compose file.
There is a property that will manage the lifecycle and the default is to start and stop the container when the spring application restarts. If you only wanted Spring to start the container and not shut it down each time you can change this behavior
spring.docker.compose.lifecycle-management=start_and_stop
Ah, that's the issue. `docker container ls` will show you what port on the host is mapped to the port in the container.
Awesome!
I love your content ❤
thanks Dan. it is curious that Gradle still doesn't support all features of JAva 21 so maven is best option for experiments
is there any way we can use this for testing as well, because I think the spring boot team had disabled it for testing
Shouldn't the database be 'spring-blog' at 4:45?
In my Docker Compose for Postgress that I'm using for Keycloak to secure my Microservices, I have this:
ports:
- "5432:5432"
Can Anyone explain what happened ?
Thanks sir. Don't use dark mode in youtube, please!
sure, go light, who doesn't like getting flashbanged, I guess we could just watch in sunglasses😎