You probably know that there’s an official github repository storing Dockerfiles and samples to build Docker images for Oracle products and Open Source projects. Now Oracle takes one more step to support Docker. Oracle Brings Oracle’s Flagship Databases and Developer Tools to the Docker Store (you can read the official announcement). Oracle Linux was already on the Docker Store. Oracle Database 184.108.40.206 Enterprise Edition, Oracle client tools, Oracle Weblogic, Oracle Coherence, Java 8 SE are also released on the Docker Store. Now you don’t need to build the image, you can download and use the image from the Docker Store.
To be able to use them, first you need to login to the Docker Store, select the Docker Image you want and click “get content” button. Then the Docker store will ask you enter your contact information (name, phone, company etc), and you have to accept “the Oracle license agreement”.
When we complete the form, we see the instructions (and a sample environment file) to use it. The environment file sets the required parameters such as database SID, password. So now we’re ready to get the image.
I login to the docker (using command line) and pull the image:
gatil:~ gokhan.atil$ docker login Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username: gokhanatil Password: Login Succeeded gatil:~ gokhan.atil$ docker pull store/oracle/database-enterprise:220.127.116.11 18.104.22.168: Pulling from store/oracle/database-enterprise abf7e4428604: Pull complete 00dfe33d8ca6: Pull complete bd2b2e675457: Pull complete 599b3db5a3e4: Pull complete 0e47b3ce0d30: Pull complete Digest: sha256:a5ce72142f33e667b330b2dba186f3554bcf88fd2f3c3853cf76873b08e56a89 Status: Downloaded newer image for store/oracle/database-enterprise:22.214.171.124
Then, I copied the sample environment file, modified the password, SID and domain, and run the docker image (my environment file name is testere.dat and my image name is testere):
docker run -d --env-file testere.dat -p 1521:1521 -p 5500:5500 -it --name testere --shm-size="4g" store/oracle/database-enterprise:126.96.36.199
Be careful that the shm-size must be 4g or higher.
One of the good thing is, we do not need to provide Oracle Database installation files for these images. Oracle put the all required files into the repository images. You may need to increase the memory resources of Docker. When I run the above command, I see that container created instantly but infact it requires to unzip the database software and create the database during on the first run. I waited for a while and followed the logs:
gatil:Desktop gokhan.atil$ docker logs -f testere User check : root. Setup Oracle Database Oracle Database 188.8.131.52 Setup Thu Apr 20 07:56:42 UTC 2017 Check parameters ...... log file is : /home/oracle/setup/log/paramChk.log paramChk.sh is done at 0 sec untar DB bits ...... log file is : /home/oracle/setup/log/untarDB.log untarDB.sh is done at 130 sec config DB ...... log file is : /home/oracle/setup/log/configDB.log configDB.sh is done at 409 sec Done ! The database is ready for use . Thu Apr 20 07:56:42 UTC 2017 User check : root. Setup Oracle Database
It’s done. I examined these logs and see that the scripts had some “ignorable” errors about patching. I also see that the database is a container database and it comes with a pluggable database named “PDB1”.
I connected my test database running on Docker, using my favorite SQL client (Oracle SQL Developer) and checked the status. Everything looks OK.