Run Oracle Database in Docker using prebaked image from Oracle Container Registry–a two minute guide

Lucas Jellema 11
0 0
Read Time:4 Minute, 30 Second

imageThis article will show how to run an Oracle Database on a Docker host using the prebaked images on Oracle Continer Registry. It is my expectation that it takes me very little manual effort to run the full Oracle Enterprise Database – just pull and run the Docker image. Once it is running, I get the usual Docker benefits such as clean environment management, linking from other containers, quick stop and start, running scripts inside the container etc.

The minimum requirements for the container is 8GB of disk space and 2GB of memory. There is a slim alternative that requires less resources: The slim ( version of EE does not have support for Analytics, Oracle R, Oracle Label Security, Oracle Text, Oracle Application Express and Oracle DataVault. I am not sure yet how much that shaves of the resource requirements.

My recent article Quick introduction to Oracle Container Registry–running one of Oracle’s prebaked images explained the first steps for getting started with Oracle Container Registry, including how to sign up and accept terms and conditions for individual images.

Once that is out of the way, we can get going with running the database.

The steps are:

  1. start docker
  2. login to Oracle Container Registry
  3. pull image for Oracle Database – I will use the enterprise edition database image in this article
  4. run a docker container based on that image
  5. start interacting with the database, for example from SQLcl or SQL Developer.

In terms of work, it will take less than two minutes of your time. The time before the database is running is mainly determined by the time it takes to download the image. After that, running the container takes just a few dozens of seconds.

The Oracle Database images are published on the website for the Container Registry:




Copy the docker pull command in the upper right hand corner to the clipboard. It is also worth remembering the docker run command for running the database image.

Note that this webpage contains more useful information:

  • how to run SQL scripts from within the container
  • how to expose the database [port] outside the container
  • how to specify SID (default ORCLCDB), PDB (default is ORCLPDB1), DOMAIN (default is localdomain) and allocated MEMORY (default is 2 GB)
  • how to change SYS password (default is Oradoc_db1)
  • how to make use of a volume external to the database container for storing data files, redo logs, audit logs, alert logs and trace files
  • how to run a database server image against an existing set of database files

Let’s run a database

After starting Docker (on my laptop I am using the Docker Quick Start Terminal in the Docker Toolbox), login to the container registry using your Oracle account.



Then pull the database image, using the command

docker pull


07:09 Start Pull

10:28 Start Extracting


10.30 Image is available, ready run containers off


The download took over three and a half hours. I was doing stuff over that time – so no time lost.

Once the pull was finished, the image was added to the local cache of Docker images. I can now run the database.

docker run -d -it –-name ORA12201_1 –P

The value ORA12201_1 is the self-picked name for the container.


Here -P indicates that the ports can be chosen by docker. The mapped port can be discovered by executing

docker port ORA12201_1


In a few minutes – I am not sure exactly how long it took – the container status is healthy:


The Database server can be connected to – when the container status is Healthy – by executing sqlplus from within the container as

docker exec -it ORA12201_1 bash -c “source /home/oracle/.bashrc; sqlplus /nolog”


imageIn addition to connecting to the database from within the container – we can also just consider the container running the database as a back  box that exposes the database’s internal port 1521 at port 32769. And using any tool capable of communicating to a database can be used in a regular way – provided we also have the IP address for the Docker Host if the connect is not made from that machine itself:


Creating a database connection in SQL Developer is done like this:


Using SYS/Oradoc_db1 as the credentials, the Docker Host IP address for the hostname and the port mapped by Docker to port 1521 in the container, 32769 in this case. The Service Name is composed of the PDB name and the domain name:  ORCLPDB1.localdomain.

A sample query:imageConnecting with SQLcl is similar:

sql sys/Oradoc_db1@ as sysdba


To stop the container – and the database:

docker stop 62eb

It takes a few seconds to stop cleanly.


Restarting takes about 1 minute before the database is up and running:



Note: with this basic approach, all database files are created in the container’s file system. And are not available elsewhere nor will they survive the removal of the container. A better way of handling these files is through the mounting of a host folder for storing files or through a Docker Volume.

Note: when running on Windows using Docker Toolbox, this may be convenient for increasing the size of memory and disk of the default VM:

About Post Author

Lucas Jellema

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director and Oracle Developer Champion. Solution architect and developer on diverse areas including SQL, JavaScript, Kubernetes & Docker, Machine Learning, Java, SOA and microservices, events in various shapes and forms and many other things. Author of the Oracle Press book Oracle SOA Suite 12c Handbook. Frequent presenter on user groups and community events and conferences such as JavaOne, Oracle Code, CodeOne, NLJUG JFall and Oracle OpenWorld.
0 %
0 %
0 %
0 %
0 %
0 %

Average Rating

5 Star
4 Star
3 Star
2 Star
1 Star

11 thoughts on “Run Oracle Database in Docker using prebaked image from Oracle Container Registry–a two minute guide

  1. Great article. I had a question about defaults from the oracle image. How did you know where is the default SID, DOMAIN and SYS password specified? I couldn’t find it anywhere in the documentation.

    1. Hi Rahul,

      To be honest – I do not remember how I found out about that. Perhaps lucky searching, GitHub scrolling,… I have forgotten.

      Good luck,


  2. Just a follow up from my last one, this is another error when trying to connect internally

    PS C:\Users\Administrator> docker exec -it lxoracledb bash -c “source /home/oracle/.bashrc; sqlplus /nolog”

    SQL*Plus: Release Production on Sun May 12 21:40:10 2019

    Copyright (c) 1982, 2016, Oracle. All rights reserved.

    SQL> connect sys / as sysdba
    Enter password:
    ORA-12546: TNS:permission denied

    Password: Oradoc_db1, as per instructions


    Really struggling, any given help will be very much appreciated

    1. Try “docker exec -it lxoracledb bash -c “source /home/oracle/.bashrc; sqlplus”
      Then oracle will ask you to provide the user and the password.

  3. I am having the same issue with both images the docker hub and Oracle Registry

    The pull is done without issues, but any time I try to connect I have always the same respond

    PS E:\docker\dockerfiles> docker exec -it lxoracledb bash -c “source /home/oracle/.bashrc; sqlplus /nolog”

    SQL*Plus: Release Production on Sun May 12 21:23:57 2019

    Copyright (c) 1982, 2016, Oracle. All rights reserved.

    SQL> connect sys/Oradoc_db1@ORCLCDB as sysdba
    ORA-12541: TNS:no listener

    Any thoughts?

  4. I know this article is over a year old now, but I just wanted to say thanks for posting the default password for the container’s database!

  5. Sorry when i did according to your guide why still reported error?

    [root@dipc k8s]# docker login -u -p xxxxxxxxxxx
    Login Succeeded
    [root@dipc k8s]# docker pull
    Using default tag: latest
    Trying to pull repository …
    unauthorized: authentication required

    BTW, i had logined the website
    and accept Oracle Standard Terms and Restrictions. (You last accepted the Oracle Standard Terms and Restrictions on 10/18/2018 at 02:03 AM Coordinated Universal Time (UTC).)


  6. If I connect using Oracle SQL Developer, I get a message when entering ‘sys’ as the user name that:
    Status: Failure – Test failed: ORA28009: connection as SYS should be as SYSDBA or SYSOPER

  7. How do I “login to the Oracle registry”? When I try the pull command I get an unauthorized response?

Comments are closed.

Next Post

Online Videos with Lucas Jellema–Live recording of Talks, Interviews and Stuff

Oracle Code Rome 2019 –  Business and IT Agility Through DevOps and Microservice Architecture Powered by Containers and Cloud: Turn Data into Business Value – Starting with Data Analytics on Oracle Cloud – Oracle Groudbreakers Podcast: Database Golden Rules: When (and Why) to Break Them (January 2019): Oracle […]
%d bloggers like this: