Saturday, May 18, 2019

Docker- Setup Oracle Database in Docker Container


In this post, I will show you how to setup and run Oracle database in Docker container. 

Before you proceed further in this blog post, there are 2 prerequisites as mentioned below.

1. You need to have docker installed in your system. Click here to read more about it.
2. You need to have docker hub account. Click here to read about it.

No I assume that you have docker installed in your system and created account on docker hub. Follow below steps to install Oracle DB.

Step 1: Very first step is to open the Docker terminal by clicking on "Docker Quick start" desktop icon.

Once you open that terminal, you need to login to your docker hub account from that terminal. For that, run below command.

docker login

Then enter your username and password as shown below.



Step 2: In this step, you need to go to docker hub site and get the command to download Oracle Database docker image.

For that go to https://hub.docker.com/

Then in search box, enter Oracle Database and then choose very first option as shown below.


 Now click on "Proceed to Checkout" option button at right side.



It asks you to enter your details, enter the details and click on Get Content.



It takes you to next screen where you see one command at right side.


Copy that command and past in your docker terminal as shown below.



It download the required files for Oracle Database image. This may takes some time as it download the files that have size in gb's.

with this step, you have successfully downloaded Oracle database image from docker hub.

To validate that, you can run below command, that shows you all the images present in your docker.

docker images

once you run that command, you should see something like below.


Steps 3: In this step, you will see how to create docker container from the image that we downloaded in above step.

For that run below command in docker terminal. 

$ docker run -d -it --name <oracle-db> store/oracle/database-enterprise:12.2.0.1

where <oracle-db> can be replaced with your container name.



You can validate this by running below command.

$ docker ps

This list all the containers and you will see recently created database container.


As you can see this database is running on port 1521.

You can connect to this database by using below details.

user: sys
password: Oradoc_db1
port: 1521




Docker Hub Introduction

In last post, I have shown you how to install docker on windows machine. In this post, I will discuss about Docker hub.

Docker hub in docker images repository on cloud where you can get any type of image to create required docker container.

You can use below URL to access that.

https://hub.docker.com/

Before we move to setting up Fusion Middleware on docker, we need to have account on docker hub and for that go to above URL and click on "Get Started".




Then enter all required details as shown below.


Click on continue and confirmation email will come to your inbox.

Now login to Docker hub using your account and you will see something like below. Here you see all types of Docker images.


Docker Installation on Windows

In this post, I will show you how to install Docker on Windows 7 machine and then later will show you how to setup Fusion middleware on Docker.

To install Docker on Windows, you need to download Docker toolbox and for that you need to go to below link.

https://docs.docker.com/toolbox/overview/

Once you open that link, you see option to download that docker toolbox as shown below.




Download the file and then run that file.

When you run that file, choose the default options and you may notice that this setup install other things as well as shown below.




Click on next and then you also notice that this setup also install Virtual box as docker will run on that virtual box instead of Windows OS.

Once the installation is complete. You notice 3 icons added to your desktop as shown below.


This complete your setup.

Now to run the docker, you can click on "Docker Quickstart" icon and that starts your docker.