
Oracle database as Docker container
In this article, we will look at how to quickly configure the Oracle 21C database for programming purposes using Docker.
What are Docker containers? It is a packaging format that accumulates code and apprenticeships in a form that allows quick and reliable operation in all computing environments. Using containerization, we can quickly start the platform with a working application. This technology is not the same as virtualization, so it does not emulate the entire hardware layer – thanks to it we get a full -fledged operating system, but using smaller hardware resources.
The installation and launch of the containerization environment in Linux Mint and Windows will be discussed below.
Oracle docker
Installation
To install Docker in a Linux environment based on Ubuntu/Debian distribution, follow the following commands:
sudo apt update
sudo apt install docker.io

However, to do the same in Windows, download and run the installer using the address below: https://docs.docker.com/desktop/install/windows-install
After installing and restarting the computer/server, we get a ready containerization environment. At the time of writing this article (September 2023), the official, stable version was the release 24.


Docker’s image
Using the Docker Pull command, we have the option of downloading the latest version of the free Oracle Database Express Edition database, from the official Register of Oracle containers.
docker pull container-registry.oracle.com/database/express:latest


Oracle in the Express Edition is a free database release, which due to considerable restrictions (12 GB of data and 2 GB of instance memory) is only suitable for development applications. However, it is a good starting point when creating a light software development platform.
Let’s return to further configuration. Based on the downloaded image, we can now go to the creation of a container. For this purpose, let’s use the following command:
docker container create -it --name oracle_db_dev -p 1521:1521 -e ORACLE_PWD=D7bf3KSp46BM container-registry.oracle.com/database/express:latest
Where:
--name - to nazwa kontenera
-p 1521:1521 - oznacza port (standardowo 1521)
-e ORACLE_PWD=D7bf3KSp46BM - hasło użytkownika "SYSTEM"
container-registry.oracle.com/database/express:latest - odnośnik do obrazu
We can start the created container, which will automatically start the database in its interior.


Let’s connect to the base using the following certificates, using e.g. the Oracle SQL Developer program,
host: localhost
port: 1521
username: system
password: D7bf3KSp46BM
sid: xe

And let’s send any queries to the server:

As you can see, the server returned the answer, it results from the fact that the whole configuration was carried out correctly.
Using the following command, you can display a list of running containers:
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
11182e6074b5 container-registry.oracle.com/database/express:latest "/bin/bash -c $ORACL…" 8 minutes ago Up 7 minutes (healthy) 0.0.0.0:1521->1521/tcp oracle_db_dev
However, in the following way, by providing as a parameter of the container ID, you can establish an interactive session with the server:
docker container exec -it 11182e6074b5 bash

This is an interesting approach when we use switches such as PS or Ls., Which are reflected in Linux commands. Their purpose is thanks to this quite intuitive.
In this article, we discussed the process of starting Oracle databases in Docker containers and explored the benefits of this solution.
Database containerization is a relatively new trend, which is still gaining popularity, and knowledge on this subject can be the key to success in the IT industry. It is worth experimenting, learning and adapting solutions to your needs to maximally use the potential that Docker and Oracle database carry with them.