This blog post is about quickly setting up an Oracle 12c Enterprise Edition database on Oracle Linux 7 operating system in Docker.
Please note that this Docker container provided by Oracle is not persistent image, in other words it is not persistent storage for the database. That means if you drop the container the database is lost too.
Setup:
- OS Platform : Oracle Linux Server 7.4
- Database version : Oracle 12.2.0.1 Enterprise Edition
- Docker version : 17.03.1-ce, build 276fd32
If you are on Windows host, install Virtual Box and then install Oracle Linux 7 as guest OS in virtual box. Remember, Docker commands will run under root user, else use sudo or add another user to the “docker” group to enable the user to use docker commands with sudo.
Let’s start:
1. Install docker:
yum install docker-engine
Let’s check the Docker version:
2. Install Git:
yum install git
3. Clone the Oracle docker images from GitHub:
git clone https://github.com/oracle/docker-images.git
4. Copy the Oracle Linux 12c database zip to docker-images/OracleDatabase/12.2.0.1
5. Go to this directory:
cd docker-images/OracleDatabase
6. Execute the buildDockerImage.sh script:
./buildDockerImage.sh -v 12.2.0.1 -e
It will create the required docker images for oracle and do complete database software installation.
7. Database creation:
sudo docker run --name orclcdb \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_SID=ORCLCDB \
-e ORACLE_PDB=ORCLPDB1 \
-e ORACLE_PWD=oracle \
oracle/database:12.2.0.1-ee
8. Start the Docker container:
docker start orclcdb
Clean start looks like this:
8. Start a Bash Shell to Connect to Docker Container:
docker exec –it orclcdb bash
Bash prompt inside container looks like this:
Let’s check the Listener status:
9. Check the container logs:
docker logs orclcdb
Log looks like this:
There it is, in the end of log – “DATABASE IS READY TO USE!” Less than 10 steps.. Awesome! Isn’t it?
Hope it helps!