Search code examples
dockerdocker-composeweblogic12coracle19c

Why is my Docker-Compose getting stuck after initializing my oracle database and doesn't proceed to the next service?


I am trying to update the docker of my project using docker compose, using the Oracle Database 19c Enterprise edition, WebLogic Server 12.1.4 and the Java Server JRE for java 8. I have written a script that creates the base images for the DB and weblogic server and then proceeds to use the docker-compose up for the yaml that I have written.

The structure of the projects consists of the oracle base images, pulled from the official oracle images on github, and then I have created my own Dockerfiles to extend these images. My issue is on the Oracle DB Dockerfile, where I am not sure on how to proceed. At this point the installation gets stuck after completing the database and doesnt proceed to weblogic installation and not even creating a seperate container..


ENV ORACLE_PWD="password"

ENV ORACLE_SID=ORCLCDB
ENV ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
ADD db-assets /tmp/db-assets

COPY ./wait_db.sh $ORACLE_BASE/
COPY ./runDBscripts.sh $ORACLE_BASE/
COPY ./runOracle.sh $ORACLE_BASE/
COPY ./startDB.sh $ORACLE_BASE/

USER root
RUN chmod ug+x $ORACLE_BASE/*.sh      

USER oracle

RUN $ORACLE_BASE/runOracle.sh &&\
    $ORACLE_BASE/wait_db.sh && \
    $ORACLE_BASE/runDBscripts.sh
    
CMD $ORACLE_BASE/wait_db.sh

I have tried a bunch of combinations to get this working. Have I added any commands where there shouldn't have been? docker-compose.yml:

version: '2'
services:

  db:
    build:
      context: db/
      dockerfile: Dockerfile
    image: oracle/database
    ports:
      - "10000:1521"
      - "10001:22"
    shm_size: 1G

  app:
    build:
      context: app/
      dockerfile: Dockerfile
    image: oracle/weblogic:12.2.1.4
    ports:
      - 10003:7001
      - 10004:7002
    depends_on:
      - db
    command: >
      /bin/bash -c "
        echo sleeping while db is starting;
        sleep 90;
        #script for starting a managed server on weblogic@
      "

I have spent a lot of time trying to make this work and it really frustrates me that I can't get it right. Any help will be really appreciated


Solution

  • Found it! I was making things way more complicated, my solution is to make the Dockerfile as simple as possible, only copying the database scripts. and switching to user oracle. I also followed this post How do I check if Oracle is up in Docker? to setup the healthcheck and everything works perfectly.