How to Install Oracle on Docker

In this Oracle tutorial, we will learn how to install oracle on docker. The entire tutorial is divided into the following two parts:

  • Install docker on windows
  • Install Oracle on docker

How to Install Oracle on Docker

Docker is a containerization tool used to install a light version of any application. Docker is a part of DevOps (Development & Operations) which facilitates the installation of light images of software and operating systems.

With this developers are relieved from installing heavy software that they require for a few tasks only. Apart from that, docker keeps all the applications under one umbrella.

So whether you are a new programmer or professional, you can install docker which will further allow you to use other software & operating systems in less time & resource utilization.

Moving forward, we will learn how to install docker on windows. We highly recommend following each step carefully and in case of unexpected errors please write to us.

Install docker on windows

Docker is the need for today’s time as this allows you to install light images of software and operating systems that are easy to install and remove. The large community provides support to almost all the popular software of today’s time.

The steps shared in this section will take you to the installation and setting up of WSL2 and Linux-based OS (Ubuntu) followed by docker on Windows operating system.

Steps to install docker:

Step 1) Make sure the window is up to date

Step 2) Start PowerShell as Administrator

Step 3) type wsl --install on Powershell

Step 4) Reboot the system, after reboot, it will take some time to fully complete the installation process once done provide the username and password.

Step 5) Next step is to enable the virtual machine platform. type the below-mentioned command in the PowerShell.

"dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart"

Step 6) Download and install the WSL2 Linux Kernel update package

Step 7) Reboot windows, after reboot, you will see some activity happening on the Ubuntu terminal. Please wait for it to finish.

Step 8) Start PowerShell as administrator and run wsl --set-default-version 2

Step 9) Download the docker from the Official Website.

Step 10) Run the installer and once the installation is complete reboot the device again.

Step 11) At first Docker may consume a lot of resources of your computer and it will take a few minutes. Open the tasks tray at the bottom right and wait for the docker icon to settle.

Once the docker ship logo stopped moving and it’s in white color that means docker is successfully installed and is in a working state.

Install docker on windows
Install docker on windows

In the next section of this tutorial, we will learn how to set up the image of oracle on the docker container.

Moving forward, we will learn to set up the oldest and most powerful database – Oracle on the docker container.

Read: Oracle how to copy a table

Set up Oracle image on docker

Oracle is the oldest and most powerful database software in today’s time. Due to its security features, it is used by most organizations to store and manage their data.

In this section, we will learn how to set up an oracle image on a docker container. The docker supports oracle database 12c as if now.

Steps to setup oracle image

Step 1) Click on the following link for Oracle Database Enterprise Edition and you will be redirected to the docker hub page as shown in the below image.

Set up Oracle enterprise image on docker
Set up Oracle enterprise image on docker

Step 2) Click on the “Proceed to Checkout” button and fill in the required details. You may have to log in to the docker hub to proceed.

oracle database on docker for windows
oracle database on docker for windows

Step 3) Next step is all about oracle, here you will get the repository link that you can pull to install the oracle image in docker.

docker pull store/oracle/database-enterprise:12.2.0.1

Step 4) So far, version 12.2.0.1 is available for oracle. Once you pulled the image use the below command to run the image.

docker run -d -p 1521:1521 --name oracle store/oracle/database-enterprise:12.2.0.1
  • -d is used to run the image in the background.
  • -p is the port number
  • –name is to assign a name for this connection. This name can be used later to refer this connection.

Additional information:

To stop the oracle in the docker container use docker stop with the name assigned to the connection. In our case, we have provided the name ‘Oracle’:

docker stop oracle

To start the oracle again in the docker container using the name provided assigned while running it for the first time. In our case, we have provided an oracle.

docker start oracle

If you are getting the below-mentioned error:

Error response from daemon: Ports are not available: listen tcp 0.0.0.0:1521: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
Error: failed to start containers: oracle

Then go to services and stop these two oracle services:

  • OracleOraDB19Home1MTSRecoveryService
  • OracleOraDB19Home1TNSListener.
Connect to oracle database from Docker container Error response from daemon Ports are not available
Oracle database services

Learn to Connect Database from Docker Container

With this, we have learned how to install oracle on the docker container. The entire tutorial was divided into the following two parts:

  • Install docker on windows
  • Install oracle on docker

Also, take a look at some tutorials on Oracle.