docker-oracle-xe-11g
docker-oracle-xe-11g copied to clipboard
How to execute init sql scripts?
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 ~
You don't need to run scripts under /docker-entrypoint-initdb.d manually, they will be executed automatically.
I created an example https://github.com/burakince/docker-oracle-xe-11g-custom-db-Initialization-example