DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • How to Integrate a Distributed Database With Event Streaming
  • Deploy an Application for Azure Container Registry
  • Create an Oracle Database Docker Image
  • Custom Model Context Protocol (MCP) for NL2SQL: A Rigorous Evaluation Framework on Oracle Database

Trending

  • Why Kotlin or Java Is the Wrong Question For Enterprises
  • When RabbitMQ Accepts a Message but Does Not Route It to a Queue
  • Why Role-Based Access Control Fails for AI Agents — and How to Fix It With Memory Lineage Engines
  • Designing Frontend Applications for Failure, Not Just Success

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Data Engineering
  3. Databases
  4. Create an Oracle Database Docker Image

Create an Oracle Database Docker Image

In this article, I will explain how to download Oracle 12c image in Docker and how to start working on the Oracle database.

By 
Sathvik Vutukuri
·
Jul. 24, 18 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
63.6K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

In this article, I will explain how to download Oracle 12c image in Docker and how to start working on the Oracle database.

As part of Integration testing, I have created a dummy database in Docker, which will help me store the tested data.

Before starting the installation, install the Docker on your PC. Refer to this article for how to install Docker on Windows. You need to create an account in Docker to download and start working.

After successful installation of Docker in Windows, please check to see whether Docker is up and running or not. You can see whether it is up in the taskbar as shown in the image below.

Image title

After Confirming Docker is up and running, open Windows PowerShell to start working on Docker.

After starting windows PowerShell, login to Docker with your Docker account information with the below command: 

docker login

Now, Docker will ask for your username and password details.

Image title

We can now start pulling the images and pushing our own created images to Docker Hub.

Oracle has 12c images in Docker Hub. Now, we will install 12c lighter image in Docker. Use the below command to install Oracle 12c image from Docker Hub.

docker run -d -p 8080:8080 -p 1521:1521 --name OracleDB store/oracle/database-enterprise:12.2.0.1-slim

In the above command, we are asking Docker to run oracle image on port number 1521 with the name "OracleDB". This command will first check whether the image is there in our local Docker or not, otherwise, it will download the image and start running the Oracle image.Image title

I already have Oracle image in my local Docker, and after the execution of the above command, Docker started running Oracle image and has given us an ID for reference.

We can see the running status of all the images or containers in Docker using the below command.

docker ps

I have only Oracle image running in my local Docker, where we can see the output of the command:Image title

The above image shows the status of running containers in Docker. Only one container (Oracle image) is running in Docker. We can see the container ID, created time, and port numbers of Oracle image.

Now execute the below command to start and mount the database.

 docker exec -it OracleDB bash -c "source /home/oracle/.bashrc; sqlplus /nolog"

After execution of the command:

Image title

Now, we can start working on the Oracle database. Follow the execution of the below commands to create a sample table in the database.

connect sys as sysdba;
-- Here enter the password as 'Oradoc_db1'
alter session set "_ORACLE_SCRIPT"=true;
create user dummy identified by dummy;
GRANT CONNECT, RESOURCE, DBA TO dummy;
--Now create a sample table.
create table Docker (id int,name varchar2(20));
--Start inserting values in to the table.

Now we have successfully installed the Oracle 12c database in Docker and created a table to start working. We can access this database in any SQL editor.

Below are the details of the database we installed:

  1. HostName: localhost (hostname will be System IP address if you installed in any Linux VM)

  2. Port: 1521

  3. UserName and Password: dummy

  4. Service Name: ORCLCDB.localdomain 

Use the below command to get the Service Name of the DB installed.

select value from v$parameter where name='service_names';

I have created a new connection in SQL developer with the above details and I can successfully access tables created in the Docker database from SQL developer.

Image title

Follow the above steps to install Oracle 12c in Docker and start working!

Docker (software) Database Oracle Database Command (computing)

Opinions expressed by DZone contributors are their own.

Related

  • How to Integrate a Distributed Database With Event Streaming
  • Deploy an Application for Azure Container Registry
  • Create an Oracle Database Docker Image
  • Custom Model Context Protocol (MCP) for NL2SQL: A Rigorous Evaluation Framework on Oracle Database

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook