In DockerCon2017 Oracle announced the availability of Oracle containers in the docker hub. This was a great step forward. I have been thinking of trying Oracle in docker from quite a while for some personal projects, but was not finding time to experiment. The availability of docker build files on github made this task easier. You would still need to download the Oracle Database files from OTN and place them in the prespecified directory.
I tried 11g R2 XE and it was successful. The instructions provided are quite decent so I am not going to explain everything here again.
I am running Docker 17.04.0-ce on OpenSuSe Leap 42.2. While building both 12c and 11gR2 containers I was getting “HEALTHCHECK Unknown flag error”. This is because HEALTHCHECK option was made available in Docker 17.06 onwards. As suggested in this issue, I simply removed the following line from the Dockerfile.xe and then the image built flawlessly.
HEALTHCHECK --interval=1m --start-period=5m \ CMD [ "su", "-p", "oracle", "-c", "$ORACLE_BASE/$CHECK_DB_FILE > /dev/null || exit 1" ]
Following is the quick sequence of steps I followed to build the image and to test the connectivity using sqlplus from the container itself.
user01@mylaptop > ./buildDockerImage.sh -v 188.8.131.52 -x user01@mylaptop > docker run --name oracle --shm-size=1g -p 1521:1521 -p 8080:8080 -e ORACLE_PWD=Passw0rd123 -v /home/user01/Documents/oradata:/u01/app/oracle/oradata oracle/database:184.108.40.206-xe user01@mylaptop > docker stop oracle user01@mylaptop > docker start oracle user01@mylaptop > docker exec -it --user oracle oracle bash bash-4.2$ sqlplus / as sysdba SQL*Plus: Release 220.127.116.11.0 Production on Fri Feb 9 01:02:42 2018 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Express Edition Release 18.104.22.168.0 - 64bit Production SQL> select sysdate from dual; SYSDATE --------- 09-FEB-18 SQL>
Next I am planning to get a container running tomcat with ORDS on it. Stay tuned.