Saturday, October 28, 2017

Oracle Database Docker Image in Docker Cloud (Digital Ocean)

Red Samurai is using Docker for our internal development environment. We are running Oracle Database and WebLogic server (with ADF support) on Docker Cloud. It is much easier to manager Docker containers than to maintain our own server.

In this post I will describe how to setup Oracle Database in Docker Cloud. Of course you could run Docker container locally on your machine, but main power of Docker comes with the option to be able to run container in the Cloud.

If you are new to Docker and Docker Cloud, it is very easy to be lost - there are so many various blogs and articles, hard to understand from where to start. I would recommend to start from Get Started, Part 1: Orientation and setup tutorial. You will learn most of the important Docker commands and push Docker image to the registry. Next check this tutorial - Create your first service. It describes how to create Cloud Node through Docker Cloud interface. Keep in mind - Docker itself doesn't run Docker Container, it provides connectors to various Cloud providers for Docker - Azure, Amazon, Digital Ocean, etc. I did some research and it looks like Digital Ocean is the best option to run Docker container - pricing model is straightforward, registration and management processes are simple and clear.

First step should be to create Docker Node in Docker Cloud (you must be connected to Cloud provider). Here is the info for our Digital Ocean node instance:


Node creation process is straightforward. Once node is created, it becomes part of Node cluster:


Docker Cloud node creation process triggers droplet (Cloud instance) creation in Digital Ocean. This process takes around 5 minutes in total.

Digital Ocean provides very nice UI to manage and monitor droplet:


Graphs to monitor droplet performance:


Digital Ocean provides option to run administration console directly in the browser, without even using separate SSH connection (this is very convenient for quick administration).

I found it to be the easiest way to create Oracle DB docker image in Digital Cloud droplet by executing docker run command directly in droplet administration console. I'm using official Oracle Database Enterprise Edition Docker image.

With docker run command, i can pull and run Docker image (referencing official Oracle DB Docker registry). Where detach=true means container will run without blocking console:

docker run --detach=true --name RedSamuraiDB -p 1521:1521 -p 5500:5500 -e ORACLE_SID=RedSamuraiDB -e ORACLE_PDB=ORCLPDB1 store/oracle/database-enterprise:12.2.0.1

Command is executed from Digital Ocean droplet console:


Image is downloaded directly from Docker Store into Digital Ocean droplet:


With docker run command, image is not only downloaded, but also container is started. We can execute docker ps -l to see if container was started successfully:


Finally we need to reset default password (Oradoc_db1) set for Oracle DB Docker container. This can be done by logging into sqlplus from Digital Ocean droplet console. First we need to enter into Docker container prompt by executing (use Docker container name):

docker exec -it RedSamuraiDB bash

Execute:

ALTER USER SYS IDENTIFIED BY newpass
ALTER USER SYSTEM IDENTIFIED BY newpass


DB is accessible from outside:


This brings power of Docker - Oracle DB setup in few minutes.

No comments: