Hi everyone,
Now I want to configure docker file to run imdp command when container is created. This is my docker file based on a source from web by someone that I try to create. Anyone can help me to complete it. Thank you in advance.
# Base Image
FROM absolutapps/oracle-12c-ee:latest
# Create oracle_dump folder at / -location
RUN mkdir /var/lib/sharedata;
# Give permission
RUN chmod 777 '/var/lib/sharedata';
#VOLUME
MOUNT /home/huynn/Downloads/share:/var/lib/sharedata
# Give permission to user oracle on oracle folder to create tablespace
and related operations
RUN chown -R oracle /u01/app/oracle/oradata/orcl
# Alter datafiles
Alter tablespace USERS add datafile '/u01/app/oracle/oradata/orcl/users02.dbf' size 30G autoextend on;
Alter tablespace USERS add datafile '/u01/app/oracle/oradata/orcl/users03.dbf' size 30G autoextend on;
# RUN the database initial sql.(create tablespace, create user etc)
ADD init.sql /docker-entrypoint-initdb.d/
# Here is where I want to call the impdp command. when a container is
created from this image.
CMD /usr/sbin/startup.sh
&& bin/bash -c "/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/impdp
sys/oracle schemas = test DIRECTORY=ORACLE_DUMP DUMPFILE= mydumpfile exclude=index,constraint,statistics,grant PARALLEL=4 nologfle=y
"
&& /usr/sbin/sshd -D
# Add env variables for oracle_home and related
ENV ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1/bin \
ORACLE_SID=xe
#Export oracle_home and related
RUN echo 'export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1/bin' >> etc/bash.bashrc
RUN echo 'export PATH=$ORACLE_HOME/bin:$PATH' >> /etc/bash.bashrc
RUN echo 'export ORACLE_SID=xe' >> /etc/bash.bashrc
P/s: because I am new one to docker, so I am very happy if you can describe detail about the solution.