docker rmi
, docker rm
, а еще лучше обратите внимание на команды композераversion: '3.8'
services:
# Database
app-db:
container_name: app-db
image: postgres
restart: unless-stopped
environment:
POSTGRES_DB: javacode
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGDATA: /data/postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 30s
timeout: 60s
retries: 5
start_period: 80s
expose:
- 5432
ports:
- "5434:5434"
networks:
db-net:
# custom Application
custom-app:
container_name: custom-app
build:
context: .
dockerfile: app.Dockerfile
ports:
- "8080:8080"
environment:
- spring.profiles.active=dev
- SPRING_DATASOURCE_URL=jdbc:postgresql://app-db/javacode
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=postgres
networks:
- db-net
depends_on:
app-db:
condition: service_healthy
networks:
db-net:
driver: bridge
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private UUID id;
CREATE TABLE users
(
id SERIAL PRIMARY KEY,
UUID VARCHAR(128) NOT NULL,
balance VARCHAR(128) NOT NULL
);
generate-ddl: true
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-04-19T05:47:00.685515505Z 2024-04-19T05:47:00.683Z ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed
2024-04-19T05:47:00.685535088Z
2024-04-19T05:47:00.685536505Z org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: UUID
version: '3.8'
services:
# Database
app-db:
container_name: app-db
image: postgres
restart: unless-stopped
environment:
POSTGRES_DB: javacode
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGDATA: /data/postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 30s
timeout: 60s
retries: 5
start_period: 80s
expose:
- 5432
ports:
- "5432:5432"
networks:
db-net:
# custom Application
custom-app:
container_name: custom-app
build:
context: .
dockerfile: app.Dockerfile
ports:
- "8080:8080"
environment:
- spring.profiles.active=dev
- SPRING_DATASOURCE_URL=jdbc:postgresql://app-db:5432/javacode
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=postgres
networks:
- db-net
depends_on:
app-db:
condition: service_healthy
networks:
db-net:
driver: bridge
Или даже при embedded tomcat вы засетили сontext-path и не учитываете его в урл и т.д.
Дайте больше кода