docker-oracle-xe-11g icon indicating copy to clipboard operation
docker-oracle-xe-11g copied to clipboard

How to execute init sql scripts?

Open lvgao opened this issue 9 years ago • 2 comments

hi!I want my container to execute init.sql when container startup.I tried my ways,but it didn't work.Thanks for help!!!!!

dockerfile FROM wnameless/oracle-xe-11g:14.04.4 ADD init.sql /docker-entrypoint-initdb.d/ ADD init.sh /docker-entrypoint-initdb.d/ WORKDIR /docker-entrypoint-initdb.d/ RUN chmod +x init.sh CMD ["sh", "/docker-entrypoint-initdb.d/init.sh"]

init.sh #!/bin/bash /usr/sbin/startup.sh /usr/sbin/sshd -D

sqlplus -S /nolog >test.log <<EOF conn system/oracle @init.sql exit EOF ~

lvgao avatar Nov 13 '16 11:11 lvgao

You don't need to run scripts under /docker-entrypoint-initdb.d manually, they will be executed automatically.

wnameless avatar Nov 16 '16 10:11 wnameless

I created an example https://github.com/burakince/docker-oracle-xe-11g-custom-db-Initialization-example

burakince avatar Aug 20 '17 14:08 burakince