0

i have a problem, i have two services in docker compose, one with oracle database and second with springboot application. Java app needs to wait for database to be created and wait for scripts to be initialized. Otherwise its throwing connection error. I tried with health check and depends on but doenst work well My docker-compose file:

version: '2.1'
services:
  oracle-xe:
    image: gvenzl/oracle-xe:latest
    container_name: oracle
    ports:
      - "1521:1521"
    environment:
      - ORACLE_PASSWORD=oracle
    volumes:
      - ../database/scripts:/docker-entrypoint-initdb.d

  app:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "8080:8080"
    depends_on:
      - oracle-xe

Healthcheck, bash commands, depends on

4
  • Does this answer your question? docker compose problem while using spring boot mysql docker Commented Jul 9, 2023 at 15:46
  • No, i need something that waits for the database to initialize .sql scripts Commented Jul 9, 2023 at 15:56
  • Sure. You can define your own script to decide if the database initializing is done. In the linked answer you will see an example configuration. With a different healtcheck condition. Be creative :) Commented Jul 9, 2023 at 16:08
  • Yea, idk it doesnt work well for me :( Commented Jul 9, 2023 at 17:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.