How To Install Oracle Database on Docker

Many people had difficulties installing Oracle database on docker. One of the reasons is the image is not available on Docker hub. There are some tutorials in the comment section but they don’t work anymore. In this post, I’m going to show you how to install Oracle database on docker (12c, 19c, 21c…).

Create an account on Oracle docker registry

As I mentioned at the beginning of this post, Oracle database images are not available on Docker hub anymore, even after you log in. Luckily, you can obtain the images from Oracle docker’s registry at

To be able to pull images from this registry, you need to:

  1. Register an account by going to
  2. After that, make sure you accept Oracle’s terms and conditions. Without this step, you will not be able to pull the images.

Get the name of the image you want to pull

Now you already have an account, log in to with your credentials and search for “database”

You should see a result page similar to this:

Install Oracle Database on Docker

Let’s click on enterprise (the line I underscore with the red line there). On the new page that appears, scroll to the bottom, you will see the list of images available for download:

List of oracle database images

As you can see, there are various database versions you can download. But, how can you download a specific image? Using docker pull, of course.

Pull the right version of Oracle database image

From the available images, you can choose the version you want to pull. FOr me, I will pull version To do that, I need first log in to Oracle container registry from the command line:

docker login

You will see prompts to input your username and password. If you enter the details correctly, you should see the login succeeded message:

login to oracle container registry

Now, you can pull the image from oracle container registry:

docker pull

You should be able to pull the image without issue.

If you see an error message mentioning the image does not exist or you don’t have the right, you probably haven’t accepted Oracle’s terms and conditions. Make sure you complete this before pulling the image.

Running the container

To create an Oracle database container, run the following command:

docker run -dit -p 1521:1521 --name oracle_db

It may take a few minutes for the container to complete boot. You may want to monitor the log by using this command:

docker logs -f oracle_db

If you choose a different name for your container, change oracle_db to your container’s name.

When you see this in the log, that means the container is ready to use:

Now you can exec into the container to do management tasks:

docker exec -it oracle_db bash -c "source /home/oracle/.bashrc; sqlplus /nolog"
exec into oracle database container

Now you are ready to execute commands.

Create a user in Oracle database

While you are in the container SQL command line, you can create a user so you can use that to connect to the database later from clients (such as sqldeveloper).

connect sys as sysdba;

There will be a prompt that asks for a password, enter Oradoc_db1

Now execute the following commands (one per line) to create an user.

alter session set "_ORACLE_SCRIPT"=true;
create user db_user identified by db_user_pass;

In the script above, I created a user called db_user with password db_user_pass

You can change such details to your liking.

create an user in oracle database 12c docker container

Connect to Oracle database using sqldeveloper

Now we have created a user. We can use the credentials to connect to the database as follow:

connect to oracle database 12c with sql developer

Now, click on the Test button, and you should see the success text appears at the bottom left:

Connect to oracle database 12c successfully from sqldeveloper
Connect to oracle database 12c successfully from sqldeveloper


As you can see, it may take some extra steps to install Oracle databases with docker since the images are not publicly available on Docker hub. You need to create an account with Oracle, and accept the terms and conditions. After that, you can create containers as usual.

Note that I used Oracle database 12c image in this example. However, in case you need other images (19c, 21c…) they are also available on Oracle image repository.

9 thoughts on “How To Install Oracle Database on Docker”

  1. Don’t forget to accept the licence or else you’ll be faced with “Error response from daemon: pull access denied for, repository does not exist or may require ‘docker login’: denied: requested access to the resource is denied”

    to accept the license goto the website database > enterprise > license (licenses is its own message div on the right)

  2. found error then run this command and logs

    docker run -dit -p 1521:1521 –name oracle_db

    ERROR : config DB failed, please check log /home/oracle/setup/log/configDB.log for details!

  3. No shot, where did you get that hostname ? So random.

    running: docker inspect –format='{{.NetworkSettings.IPAddress}}’ oracle_db

    whatever, still won’t work… not sure if it’s a docker bridge error on windows(11) or what
    “The Network Adapter could not establish the connection”

  4. Hello Đạt Trần,

    Thank you for your blog. Through this i can connect oracle db through docker. But I’ve issue… How can i connect it through my own machine dbeaver??

    I dont know what ( url_host , port, database , servicename ) it is running on.

    • Are they on the same machine (Your oracleDB docker & DBeaver)? If so, you need to map oracle DB port to your local machine port and connect using DBeaver using your machine’s IP and the mapped port


Leave a Comment