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.
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.
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:126.96.36.199
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.