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 ❤️

Комментарии • 21

  • @toobprojects
    @toobprojects Месяц назад

    Brilliant stuff. Loving the Java 21 String Templates as well. Thanks for this tip! Awesome stuff indeed.

  • @WaldoRochow
    @WaldoRochow 11 месяцев назад +1

    Wow! That must have been a frustrating learning experience. Thanks for saving us the grief.

  • @bart.kotula
    @bart.kotula 6 месяцев назад

    Awesome video! Thank you, Dan :)

  • @praveens2272
    @praveens2272 11 месяцев назад +3

    I was doing it just blindly 5432:5432, now i know the reason

  • @kaly7dev4873
    @kaly7dev4873 11 месяцев назад

    Thank you for your sharing Dan !

  • @elliothuntington8980
    @elliothuntington8980 11 месяцев назад +3

    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.

  • @gasparcalix2095
    @gasparcalix2095 11 месяцев назад

    that was grate, didnt know sprint has docker support, i would try it on my next projeet!

  • @xCaleb
    @xCaleb 11 месяцев назад +2

    Adding the ":5432" part to the ports section in my docker-compose file actually breaks my app...

    • @DanVega
      @DanVega  11 месяцев назад

      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

  • @odilhonislomov8954
    @odilhonislomov8954 5 месяцев назад +1

    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.

    • @DanVega
      @DanVega  5 месяцев назад +1

      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

  • @avalagum7957
    @avalagum7957 11 месяцев назад +1

    Ah, that's the issue. `docker container ls` will show you what port on the host is mapped to the port in the container.

  • @pedro_alonso
    @pedro_alonso 11 месяцев назад

    Awesome!

  • @ayed-al-nator
    @ayed-al-nator 11 месяцев назад

    I love your content ❤

  • @kensaitakeso
    @kensaitakeso 11 месяцев назад

    thanks Dan. it is curious that Gradle still doesn't support all features of JAva 21 so maven is best option for experiments

  • @ylioo
    @ylioo 11 месяцев назад

    is there any way we can use this for testing as well, because I think the spring boot team had disabled it for testing

  • @lukasleuenberger7821
    @lukasleuenberger7821 11 месяцев назад

    Shouldn't the database be 'spring-blog' at 4:45?

  • @idouxda
    @idouxda 11 месяцев назад

    In my Docker Compose for Postgress that I'm using for Keycloak to secure my Microservices, I have this:
    ports:
    - "5432:5432"

  • @ajinkyakhete1151
    @ajinkyakhete1151 11 месяцев назад

    Can Anyone explain what happened ?

  • @agusp1951
    @agusp1951 11 месяцев назад +3

    Thanks sir. Don't use dark mode in youtube, please!

    • @lorathbane
      @lorathbane 11 месяцев назад +3

      sure, go light, who doesn't like getting flashbanged, I guess we could just watch in sunglasses😎