Oracle Linux Container Registry

You may have read one of my previous posts Oracle 12c on Docker where I described  how you can get hold of official Oracle images from the Docker Store.

In this post I will share how you can now use the Oracle Container Registry to obtain Docker images for all licensable Oracle products.

To access the Oracle Registry Server you must have an Oracle Single Sign-On (SSO) account, this is the same account you use for support.oracle.com and opn.oracle.com etc..

Navigate to https://container-registry.oracle.com/ and login using your SSO credentials, once authenticated you will be presented with the ‘Explore’ webpage.
Oracle_Container_Registry

You can then need to select the required Business Area e.g. ‘Database’ and click the red ‘Continue’ button, you will then be presented with the ‘Oracle Standard Terms and Restrictions’ agreement, review and if acceptable click ‘Accept’ and the bottom of the page.

You will then be returned to the ‘Explorer’ and notice that the Oracle Standard Terms and Restrictions shows you acceptance, this is valid for 8 hours only.

Standard_Terms

Note: you will not be able to pull and image until you have accepted Oracle Standard Terms and Restrictions.

You are now ready to pull the required image by clicking the repository  e.g. ‘enterprise’ and copying & pasting the provided pull command e.g.

pull_command
The Repository Detail page provides set-up and usage information for the selected image.

Ok, now I have outlined the process let me walk you through it.

1) Login to Registry

ronsmac:~ ronekins$ docker login container-registry.oracle.com
Username: ron.ekins@icloud.com
Password:
Login Succeeded

2a) Pull Oracle Linux

Select ‘OS’ from the ‘Explore Official Business Areas’  and click the red ‘Continue’ button for oraclelinux. As before, accept Oracle Terms.

Repo_Linux

Now copy the docker pull command and paste in in your Mac or Linux shell.

OC_Reg

ronsmac:~ ronekins$ docker pull container-registry.oracle.com/os/oraclelinux
Using default tag: latest
latest: Pulling from os/oraclelinux
80d2e45a33d8: Pull complete
Digest: sha256:d31c2987a6c427eeca70fb28ccefd6e788e96b3202dc715aa3c80bcb23673f6d
Status: Downloaded newer image for container-registry.oracle.com/os/oraclelinux:latest

2b) Pull Oracle Database 12c Enterprise Edition

Register_Database

ronsmac:~ ronekins$ docker pull container-registry.oracle.com/database/enterprise
Using default tag: latest
latest: Pulling from database/enterprise
cbb9821ba51c: Pull complete
9bd4d110366e: Pull complete
af8b29651e27: Pull complete
4c242ab1add4: Pull complete
7bda1e55bd08: Pull complete
Digest: sha256:42809e491491d7f07a2aa76903bb5feabe3a0d23abcb7e680264074f043a604c
Status: Downloaded newer image for container-registry.oracle.com/database/enterprise:latest

3) Check Image size

Your Oracle two images are now available for use locally, you can check this with the docker image ls command. e.g.
ronsmac:~ ronekins$ docker image ls

REPOSITORY TAG IMAGE ID CREATED SIZE
container-registry.oracle.com/os/oraclelinux latest 6c33a25f4a29 5 weeks ago 229MB
container-registry.oracle.com/database/enterprise latest 12a359cd0528 2 months ago 3.44GB

Follow-up ‘Registry’ teaser

Within the ‘OS’ area Oracle provides a registry image which you can use to deploy a local registry so you can pull images and customise as required, the local registry also avoids the need the to authenticate every 8 hours, I will detail all of this in a follow-up post.

ronsmac:~ ronekins$ docker pull container-registry.oracle.com/os/registry
Using default tag: latest
latest: Pulling from os/registry
a3ed95caeb02: Pull complete
89937cfc6593: Pull complete
bd07ebf08156: Pull complete
Digest: sha256:13d190c8838ebeb1e9cbf87b3edcc1fc6b6948d1b5d2200ec4dc64c638a56402
Status: Downloaded newer image for container-registry.oracle.com/os/registry:latest

 

Advertisements

Docker, Oracle 12c and Persistent Storage

Introduction

If you have read my previous posts on Docker you may have already installed Docker and have an Oracle 12c database running in a Docker container, if not you may want to read my first post on Docker – Running Oracle 12.2.01 on Docker

However, since I wrote the above post Oracle have published Docker images for many of their products, these can be found at the Docker Store. The Oracle images on the Docker Store are not just a great resource and help accelerate adoption, but are also certified and supported by Oracle.

Before continuing with this post you need to check-out my posts on using the new Oracle 12c Docker images and the Pure Storage Docker plugin as this post can be considered the ‘Return of the Jedi’  in the series.

Oracle 12c with Persistent Storage

In this post I will create a Docker container running an Oracle 12c database called PSTG using 4 mount points /u01, /u02, /u03 & /u04 mounted from a Pure Storage FlashArray.

Database environment Layout

/u01 – OraInventory and Oracle 12c product directories
/u02 – Oracle Datafile
/u03 – Fast Recovery Area
/u04 – RedoLog files.

The 4 mount points will all be using persistent All Flash Storage providing low latency performance, space efficient crash consistent snapshots and requiring no local storage.

First, confirm that you have installed the Oracle 12c image using the the following:

$ docker images list

docker_imagesYou should be able see the store/oracle/database-enterprise 12.1.0.2 Docker Image, if missing you need to read my previous post.

Ok, copy the db_env.dat file created in the previous post to a new environment file $ORACLE_SID_env.dat and update database name and password e.g.

####################################################################
## Copyright(c) Oracle Corporation 1998,2016. All rights reserved.##
##                                                                ##
##                   Docker OL7 db12c dat file                    ##
##                                                                ##
####################################################################
##------------------------------------------------------------------
## Specify the basic DB parameters
##------------------------------------------------------------------
## db sid (name)
## default : ORCL
## cannot be longer than 8 characters
DB_SID=PSTG
## db passwd
## default : Oracle
DB_PASSWD=Oracle
## db domain
## default : localdomain
DB_DOMAIN=localdomain
## db bundle
## default : basic
## valid : basic / high / extreme 
## (high and extreme are only available for enterprise edition)
DB_BUNDLE=basic
## end

We will now create the 4 volumes using the docker volume create command and Pure Storage Docker plug-in providing name, size and label.

 docker volume create --driver=pure --opt size=20GB --name=PSTG-u01 --label=product
 docker volume create --driver=pure --opt size=100GB --name=PSTG-u02 --label=oradata
 docker volume create --driver=pure --opt size=200GB --name=PSTG-u03 --label=fast_recovery_area
 docker volume create --driver=pure --opt size=10GB --name=PSTG-u04 --label=redo

We can use the docker volume ls command with a filter to list the 4 database volumes we are interested in using the following syntax

$ docker volume ls -f name=environment

docker_vols

The Pure Storage Docker Plugin also supports docker volume inspect, from here we can see the labels which we defined earlier, great way to see where and what the mount is being used for.

$ docker volume inspect volume name

docker_inspect.png

Now that we have installed the Oracle 12c Docker image and created the 4 volumes we are ready to create our Oracle 12c container using the docker run command with -v to present our newly volumes to our container.

docker run -d –env-file ./PSTG_env.dat -p 1527:1521 -p 5507:5500 -it –name PSTG -v PSTG-u01:/u01 -v PSTG-u02:/u02 -v PSTG-u03:/u03 -v PSTG-u04:/u04 –shm-size=”8g” store/oracle/database-enterprise:12.1.0.2

Progress can be monitored using the docker logs command.

docker logs -f PSTG

Once the container has started we can now connect to it and check out our Oracle 12c environment using the docker exec command and container name

docker exec -it PSTG /bin/bash

From within our Oracle 12c ‘PSTG’ container we can see our Pure Storage volumes (/u01, /u02, /u03 & /u04) and the sizes we specified.

df.png

Now we are in our Docker container we can use SQLPlus to see data file locations, instance name, docker assigned hostname etc…

sqlplus

instance

Docker Volume plugin for Pure Storage

You may have noticed that you can now download a Docker Volume Plugin for Pure Storage from the Docker Store. The Pure Storage Docker Volume plugin provides seamless integration with Docker containers, enabling persistent storage which is a must for many enterprise and database applications

Installation of the Docker Volume is extremely simple and is well documented at the Docker Store.

Once installed the first thing you must do is to let the Volume plugin know about your Pure FlashArray, update /etc/pure-docker-plugin/pure.json to use your FlashArray’s management (not iSCSI) IP address and API Token.

Starting pure-docker-plugin

You can now start the pure-docker-plugin using systemctl start e.g.

[root@z-oracle ~]#  systemctl start pure-docker-plugin

You can also check the log file using systemctl status e.g.

[root@z-oracle ~]#  systemctl status pure-docker-plugin -l

Create a Volume

You can create a Pure Storage FlashArray volume from your Linux server using the docker volume create command.

[root@z-oracle ~]# docker volume create –driver=pure -o size=100GB –name=ron101 –label=ron
ron101

You should now be able to see the newly created volume within the Pure Storage FlashArray.docke_FA

List a Volume

You can also use the docker volume ls command and filters to show available volumes.

[root@z-oracle ~]# docker volume ls -f name=ron
DRIVER              VOLUME NAME
pure                ron100
pure                ron101

Inspect a Volume

You can use the docker volume inspect command to get a bit more info and to also see where it’s being used.

[root@z-oracle ~]# docker volume inspect ron101
[
{
“Name”: “ron101”,
“Driver”: “pure”,
“Mountpoint”: “”,
“Labels”: {
“ron”: “”
},
“Scope”: “global”
}
]

When the Docker Volume is used the Mountpoint will be visible e.g.

[root@z-oracle ~]# docker volume inspect ron100
[
{
“Name”: “ron100”,
“Driver”: “pure”,
“Mountpoint”: “/pure-docker-mounts/z-oracle/ron100”,
“Labels”: {
“ron”: “”
},
“Scope”: “global”
}
]

Delete a Volume

The Pure Storage Volume plugin also supports volume delete.

[root@z-oracle ~]# docker volume rm ron101
ron101
[root@z-oracle ~]# docker volume ls -f name=ron
DRIVER              VOLUME NAME

In this Blog I have shared how we can create, inspect and delete Docker Volumes using the Pure Storage Docker Volume plug-in, in my next post I will share you you can use these volumes for persistent database storage.

Check-out the Pure Storage Developer Community for more examples.

Oracle 12c on Docker

Getting the Image

Great news, during DockerCon 2017 Oracle announced support for Oracle 12.1 Database Docker images. Press release: Oracle Brings Oracle’s Flagship Databases and Developer Tools to the Docker Store

Previously to run an Oracle Database in a Docker container you needed to create your own Docker image, I actually Blogged on this earlier in the year, if you interested you can read about it here.

However, you can now obtain an official Oracle 12.1 Database Docker images from the Docker Store

Before you can ‘pull’ the new Docker image you will need to login to the Docker Store and click on the ‘Get Content’ button and then complete the form, providing your name, company, phone number and then accepting the Oracle license agreement.

Docker_Store

The ‘Setup’ button provides details on how ‘pull’ the image and also how to set-up the your Oracle database within Docker.

docker pull store/oracle/database-enterprise:12.1.0.2

pull
The Docker image includes all the required Oracle files so is pretty large coming in at ~4.87GB, so it may take a while to download.

Running the Container

The environment file allows for customisation of the Database name, password, domain and feature bundle.

The command for creating a database container is:

$ docker run -d –env-file -p :1521 -p :5500 -it –name –shm-size=”4g”

Parameters:
<path_to_env_file> is the path to the environment file you created using above example.
<listener_port> is the port on host machine to map the container’s 1521 port (listener port).
<http_port> is the port on host machine to map the container’s 5500 port (http service port).
<container_name> is the container name you want to create.
<shared_memory_size> is the memory size for the container to run. The minimum requirement is 4GB (–shm-size=”4g”).
<image_name> is the image that you use to create a container.

In this example our environment file is called db_env.dat and our container is going to be called dockerDB

docker run -d –env-file ./db_env.dat -p 1527:1521 -p 5507:5500 -it –name dockerDB –shm-size=”8g” store/oracle/database-enterprise:12.1.0.2

We should now be able to see our new Oracle 12.1 image and running container using:

docker image ls
docker container ls

images

From my MacBook Pro we check the progress of the build using the Docker logs option e.g.

docker logs -f dockerDB

ready

We can also connect to the running container using the Docker exec command e.g.

docker exec -it dockerDB /bin/bash

oracle.png
From here we can see the Oracle Docker is using Oracle Linux 7.3 and the database is called ‘OraDoc’ as per our environment file.

As you can see from the above we are connected as root, if you want to use the oracle account then type ‘su – oracle’ and from there try out sqlplus inside your container.

database

Oracle 12c on an MBP Done!