How to install, build and run Oracle Database 18c Express Edition (XE) in Docker on Ubuntu 16.04

This is a summary of https://github.com/oracle/docker-images/blob/master/OracleDatabase/SingleInstance/README.md

It is an explanation of how to build the official docker images for Oracle Database. It seems you have to do this manually, no official images seem to exist in dockerhub.

This manual assumes you are running Ubuntu 16.04 and have docker and git installed and want to run Oracle Database 18c Express Edition. I have not tested this on other systems.

First, download oracle-database-xe-18c-1.0-1.x86_64.rpm from Oracle and put it under ~/oracle-database-xe-18c-1.0-1.x86_64.rpm. You need to accept their license terms and have an Oracle account.

Then do the following:

cd ~
git clone https://github.com/oracle/docker-images
cd ~/docker-images/OracleDatabase/SingleInstance/dockerfiles
cp ~/oracle-database-xe-18c-1.0-1.x86_64.rpm 18.4.0/
./buildDockerImage.sh -v 18.4.0 -x




# wait for:
# "Complete!"
# ... later:
# "Oracle Database Docker Image for 'xe' version 18.4.0 is ready to be extended:"
# "--> oracle/database:18.4.0-xe"
# "Build completed in 848 seconds."




# optional: cleanup
cd ~
rm database-xe-18c-1.0-1.x86_64.rpm
rm -rf docker-images

Then go grab a tea and do something different because this takes a long time.

This will finally produce the docker image called "oracle/database:18.4.0-xe" in your local system's docker image registry (or your default docker image registry?).

Then you can run it with

# important configuration, env var names are mine
# password for SYS, SYSTEM and PDB_ADMIN accounts
SYS__SYSTEM__PDB_ADMIN__password=mypassword
# ports under which services in the container are exposed
HOSTPORT=1521
HOSTAPEXPORT=5500


# where to put the data
cd

MYORACLEDATADIR=myoracledata
mkdir -p $MYORACLEDATADIR


# run!
# use -d to run in background


docker run --name my-oracle-database-18.4.0-xe \
-p $HOSTPORT:1521 -p $HOSTAPEXPORT:5500 \
-e ORACLE_PWD=$SYS__SYSTEM__PDB_ADMIN__password \
-v $MYORACLEDATADIR:/opt/oracle/oradata \
oracle/database:18.4.0-xe



# wait for:
# "DATABASE IS READY TO USE!
# then connect to it from another terminal, using
#     sqlplus
# if you have oracle instantclient installed, or sqlplus in a container:
#     docker run -e URL=localhost:$HOSTPORT -ti sflyr/sqlplus



# to stop
docker rm --force my-oracle-database-18.4.0-xe

Rant: If Oracle just put this on dockerhub or at least their own docker registry of course we would not have to come here. But it seems they want everyone downloading this stuff to accept their license terms explicity with a click on their checkbox and have an account with them.

Aside: Someone did (dare to) host an image for 11g xe (and was not sued yet): https://hub.docker.com/r/wnameless/oracle-xe-11g/

Keywords: oracle/database:18.4.0-xe oracle database 18c xe express edition oracle-database-xe-18c-1.0-1.x86_64.rpm Ubuntu 16.04

Other options: There are many ways to run a virtualized/as-a-service/blackbox oracle xe 18c without installation hassles of course:
  • I am sure there is a cloud offering somewhere
  • maybe have a look at https://github.com/oracle/vagrant-boxes/tree/master/OracleDatabase/18.4.0-XE 
  • people have written scripts to install oracle db

Comments

Popular posts from this blog

White