How To Dockerize Spring Boot Application & PostgreSQL Database

preview_player
Показать описание
Click here to stay tuned with all the upcoming videos:
- - - -
Learn how to run spring boot application and PostgreSQL database in two different docker containers and perform CRUD operation through Swagger3.

NOTE: We're not using docker-compose to create separate containers for running Spring Boot and PostgreSQL locally.
- - - -
Previous Videos:
- - - - - - - - - - - - - - -
- - - -
Development Frameworks & Tools:
#docker
#spring
#springboot
#swagger

Thank you so much for going through the detailed description. Feel free to add comments with your suggestions.

Don't forget to subscribe
Рекомендации по теме
Комментарии
Автор

Problem: You cannot create a .jar after you change localhost to different value.


Solution 2: You can activate Toggle 'Skip Tests' mode in Maven Tab before creating jar. (looks like circle, like this (/))


Solution 1: You should clean your maven project in common way, after that you should go to the terminal in intelliJ(i hope you use intelliJ, cause idk if it works in other IDE's).
In terminal you should write next:
mvn install -DskipTests=true
and press CTRL+ENTER, if you press only enter it will not work.
If this comment helped you just press the like button.
P.S. IDK why the author avoid answer to this question, i read all his answers down below and that is just "ahh, yeah, you can't do this" without solution :/
P.P.S. If you try to use this command in terminal but it's not work and you just skipped the section above use ctrl+enter, it's might be a little bit confusing like it was for me)

wrk
Автор

The only video that helped me out :) Thank You very much! Good explanation

TheGruwy
Автор

5 🌟 for this very well detailed explaination. I got the connection up and running thanks to your video. Much appreciated pal

Louyark
Автор

Thanks! Look forward to the docker compose tutorial!

shashankrana
Автор

the problem in this approch is tha the IP address of a container can change when the container is stopped and started again, or if the host machine is restarted. so you should change the properties file everytime the ip is changed. i think using docker compse is the better approch

hamdiaminehkh
Автор

When i change localhost to ip adress, i cannot generate a jar file. how i can fix it please

diraneserges
Автор

I am facing problem while making the jar file after change the host name with the container ip.I am not been able to create jar through maven clean and maven install or through the mvn package or through the build path and package .I have tried a lot.Please do help me.

mbjqxne
Автор

I am having Spring-boot in my local machine and need to connect it to container which has database can i follow these steps for that ?

SAGARMN-homd
Автор

i only ran Postgres container, in your video you only using dockerfile not docker-compose, but my spring boot application didn't connect to postgres

voluantran
Автор

I am facing error while running the docker container, i found that in logs. The error is I am unable to connect to postgres.
" Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connection"

vishalch
Автор

You didn't re-install maven for target folder, why does it still work?

tranquythuong
Автор

Why don't you use docker compose file, i need it

hieutranhuu
Автор

Awesome, thanks!

But I'm facing a problem after deploying the postgres database and creating its container.
In the spring boot app, when I try to replace localhost by the IP of the container and run the the app, I see there's no connection happens to the db.

AbanoubAsaad-YT
Автор

Hello, when i entered the details on pgAdmin and click save, Error occurs and error says "unable to connect to server : connection timeout expired".Can you help me with this, I am struggling with this error and can't seem to find the solution.

bsal
Автор

Hi I have one question can't we pack postgres and my application in the same container and expose endpoints for both

ayushjaiswal
Автор

Hi, don't we need to paste the PostgreSql dependencies in order to compile the project?

TheRagreis
Автор

Nice content brother. What do you say about new UI in the IntelliJ idea?

Doisgiga
Автор

How have you create jar file with container ip. It will generate errors

luckytheracer
Автор

After changing localhost to IpAddress in spring.datasource.url, I can't start the application directly from Intellij. Therefore, I can't run "mvn clean install" properly. Is that ok or am I doing something wrong? Is the whole point of Dockerfile not to run application from Intellij interface, rather running it everytime using the Dockerfile?

checkmate
Автор

Thank you, is the code available on github?

basheeral-momani