Deploy Oracle Database container on Docker

By | December 31, 2020

Overview

  • Follow the instruction to install Docker CE here if not yet.
  • Use official image from Oracle Container Registry
  • Run as Oracle Database Enterprise edition
  • Run as a standalone server

Prerequisites

  • You need to have the login account to Oracle Container Registry
  • After sign up and sign in, browse container to “Database”
  • You must agree to and accept the Oracle Standard Terms and Restrictions prior to downloading from the Oracle Container Registry. i.e you select “enterprise” Repository -> click “Continue” on the right side -> Read the Oracle Standard Terms and Restrictions, then click on “Accept”
  • Docker login to Oracle Container Registry
docker login container-registry.oracle.com
--> your account email
--> your password
  • Docker pull Oracle Database image “enterprise” with tag “19.3.0.0” or “latest”
docker pull container-registry.oracle.com/database/enterprise:19.3.0.0

Create docker-compose file

  • Create a directory to keep docker compose file
mkdir /srv/oracledb
  • Create docker-compose.yml file to run and manage Oracle Database
cd /srv/oracledb/
cat > docker-compose.yml <<'EOF'
version: '3.1'
services:
  oracledb:
    image: container-registry.oracle.com/database/enterprise:19.3.0.0
    restart: unless-stopped
    ports:
      - 1521:1521
      - 5500:5500
    environment:
      ORACLE_PWD: password#1
      ORACLE_EDITION: enterprise
    volumes:
      - ./oradata:/opt/oracle/oradata
EOF

Startup Oracle Database with docker-compose

  • Due to Oracle running as non-root user, we need to create a system user and group with ID “54321” as the following:
groupadd --system --gid 54321 oracle
adduser --system --shell /bin/nologin --gid 54321 --uid 54321 oracle
  • Create Oracle DB directory named as in volume mapping “./oradata” and owner
cd /srv/oracledb/
mkdir ./oradata
chown oracle:oracle ./oradata
  • To bring Oracle Database container service up, run:
docker-compose up -d
  • To shutdown the container service, run:
docker-compose down
  • To check Oracle Database running ports:
docker-compose ps
docker ps
  • Finally to allow connection to Oracle DB, we also need to open database port “1521” for Oracle DB and “5500” for Oracle Enterprise Manager Database Express in local firewall
firewall-cmd --permanent --add-port=1521/tcp
firewall-cmd --permanent --add-port=5500/tcp
firewall-cmd --reload
  • To view or debug output logs, run:
docker-compose logs -ft

Reference Oracle Database.

4 thoughts on “Deploy Oracle Database container on Docker

  1. CBD oil for sale

    What’s up to every body, it’s my first go to see of this webpage; this website carries remarkable and genuinely excellent stuff designed for readers.

    Reply
  2. CBD oil for sale

    At this time it appears like BlogEngine is the top blogging platform available right now.
    (from what I’ve read) Is that what you are
    using on your blog?

    Reply
  3. CBD oil for sale

    Hello There. I discovered your weblog using msn. This
    is a very well written article. I will be sure to bookmark
    it and come back to learn more of your helpful information. Thanks
    for the post. I’ll certainly return.

    Reply

Leave a Reply

Your email address will not be published.