How To Create Multi Containers Using Docker Compose | For SpringBoot & Postgresql

How To Create Multi Containers Using Docker Compose | For SpringBoot & Postgresql

CodeVice

1 год назад

9,171 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@VitaliiSmahlenko
@VitaliiSmahlenko - 02.11.2023 22:35

Could you share a link to the github repository of this project?

Ответить
@chrisogwuche9645
@chrisogwuche9645 - 12.10.2023 01:01

Thank you

Ответить
@dattasawant12
@dattasawant12 - 30.07.2023 20:15

Hi thank you for giving the information. i am facing issue with dataSource

-----------

app propertes file : -
spring.datasource.url=jdbc:postgresql://localhost:5432/student-db
spring.datasource.username=postgres
spring.datasource.password=admin
spring.jpa.show-sql=true

## Hibernate Properties
# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect

# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto=create

spring.application.name=student-service
server.port=8086

-------------------------
dockerfile

FROM openjdk:17
WORKDIR /app
COPY target/student-service-1.0.0.jar .
EXPOSE 8085
ENTRYPOINT ["java","-jar","student-service-1.0.0.jar"]
-------------------------------------------

docker compose :

version: "2"
services:
db:
ports:
- 5433:5432
container_name: postgresql_container
image: postgres:14.1-alpine
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=admin
- POSTGRES_DB=student-db
volumes:
- D:\postgres_datapart:/var/lib/postgresql@14/data:rw
restart: always
backend:
build: .
container_name: studentservice_container
ports:
- 8085:8085
environment:
db-url: jdbc:postgresql://db:5432/student-db
db-username: postgres
db-password: admin
depends_on:
- db
restart: always

--------------------------

suggest here to overcome the data source issue

Ответить
@anmoldodwad2125
@anmoldodwad2125 - 28.06.2023 22:40

When i add the dynamic variables ${db-url} etc and try to build my springboot application there is a error for connectivity with postgresql server. I think its because there is not container for postgres yet and therefore no DB , when should I build the springboot application with those changes or without them ??

Ответить
@mrpipiskin4
@mrpipiskin4 - 04.05.2023 13:50

Thank you very much for help. It would be much cooler if you do git repo for every video.

Ответить
@Akshay-wp1rg
@Akshay-wp1rg - 23.04.2023 16:37

I'm getting communication link failure I have given all properties and creditentails correctly. But I don't know and I have tried many way them too I'm facing this issue, can proved me with any solutions?

Ответить