Well Colm Divilly (@cdivilly) has cleared it up for me. His Gist on on Github had me up and running. Very little work on my part here, following Colm's detailed instructions, (barring time for downloads) I had docker up on mac in about 30 mins.
Take a look.....
Download Database Binaries from Oracle Technology Network
Check out the Oracle Docker Images from Github
cd ~/work/docker
unzip ~/Downloads/docker-images-master.zip
Move the Database Binaries to the correct location
buildDockerImage.sh
, for this script to work the Oracle Database binaries need to be placed in the correct location, for example:cd ~/work/docker/docker-images-master/OracleDatabase/
mv ~/Downloads/linuxx64_12201_database.zip ./12.2.0.1
12.2.0.1
sub-folderConfigure the Proxy if necessary
http_proxy
and https_proxy
environment variables are set, so the proxy configuration can be propagated to the created Docker Container. If this is not done correctly then yum
will not be able to reach any repositories.export http_proxy=http://someproxy.corpdomain.com:80
export https_proxy=http://someproxy.corpdomain.com:80
Build the Docker Image
buildDockerImage.sh
script, it's usage is described in the README. First let's ensure the script is executable:cd ~/work/docker/docker-images-master/OracleDatabase/
chmod +x ./buildDockerImage.sh
cd ~/work/docker/docker-images-master/OracleDatabase/
./buildDockerImage.sh -v 12.2.0.1 -e
Run the Docker Image
- set the name of the PDB created to
ORCL
- Store the database data on the host machine, this enables me to blow away the docker container at any time and re-create it without losing any data. In effect I'm separating the database 'engine' (the docker container) from the database storage (the volume on the host where the database storage is persisted).
- Configure the Database to use Extended Data Types (increase max VARCHAR2 to 32767 bytes).
Prepare the storage volume
cd ~/work/docker
mkdir oradata
oracle
. On my Mac OS host, I found I didn't need to create an oracle
user or give it ownership of this folder.Extended Data Types
docker run
command which will cause those scripts to be executed.cd ~/work/docker
mkdir db_setup_scripts
cd db_setup_scripts
unzip -j ~/Downloads/8082bece*.zip
- We use the
-j
option to tell unzip not to bother recreating the directory structure of the archive
cd ~/work/docker/db_setup_scripts
chmod +x *.sh
rm *.md
Run the container
docker run --name oracle -p 1521:1521 -e ORACLE_PDB=ORCL \
-v ~/work/docker/oradata:/opt/oracle/oradata \
-v ~/work/docker/db_setup_scripts:/opt/oracle/scripts/setup \
oracle/database:12.2.0.1-ee
- The
-name
argument names the container - The
-e
arguments passed an environment variable that renames the created PDB toORCL
(the default isORCLPDB1
) - The first
-v
argument mounts the folder to store the database data - The second
-v
argument mounts the folder containing the scripts to convert the database to use extended data types
Managing the Container
docker stop oracle
docker start oracle
docker restart oracle
Deleting the Container
docker stop oracle
docker rm oracle
Connecting to the Database
sqlplus
as described in the docker images documentation but it's a bit hard to use because it can only read from the filesystem within the container. Much better to use it's more modern relative, SQLcl, which will run anywhere you can run Java, and doesn't require an Oracle Client install, so it's super easy to get working, and especially handy for Mac users.sqlcl
to connect to the database as follows:Connect to the CDB
sql system
SQLcl: Release 4.2.0.16.043.0306 RC on Fri Sep 08 18:10:52 2017
Copyright (c) 1982, 2017, Oracle. All rights reserved.
Password? (**********?) ******
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>
Connect to the PDB
sql system@//localhost:1521/orcl
SQLcl: Release 4.2.0.16.043.0306 RC on Fri Sep 08 18:12:29 2017
Copyright (c) 1982, 2017, Oracle. All rights reserved.
Password? (**********?) ******
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>
View comments