Using MLE with Docker

This beta release of Oracle Database MLE comes as pre-built Docker image.

The docker image is based on the Docker build files as contained in this GitHub repository.

Running the Image

The Docker image is available for download as a tar.gz file from the Oracle Technology Network.

After downloading the image, it needs to be loaded into docker using the docker load command.

$ docker load --input mle-docker-0.2.7.tar.gz

Once loaded, it can be run using the docker run command.

$ docker run --name <container name> \
  -p <host port>:1521 -p <host port>:5500 \
  -e ORACLE_SID=<your SID> \
  -e ORACLE_PWD=<your database passwords> \
  -v [<host mount point>:]/opt/oracle/oradata \
  -v [<host mount point>:]/home/oracle/myproject \
  mle-docker-0.2.7
Parameters:
   --name:        The name of the container (default: auto generated)
   -p:            The port mapping of the host port to the container port. 
                  Two ports are exposed: 1521 (Oracle Listener), 5500 (OEM Express)
   -e ORACLE_SID: The Oracle Database SID that should be used (default: ORCLCDB)
   -e ORACLE_PWD: The Oracle Database SYS, SYSTEM and PDB_ADMIN password (default: auto generated)
   -v /opt/oracle/oradata
                  The data volume to use for the database.
                  Has to be owned by the Unix user "oracle" or set appropriately.
                  If omitted the database will not be persisted over container recreation.
   -v /home/oracle/myproject
                  A volume containing the projects (e.g. JavaScript) that
                  should be deployed into the database.

Once the container has been started and the database created you can connect to it just like to any other database:

sqlplus sys/<your password>@//localhost:1521/<your SID> as sysdba
sqlplus system/<your password>@//localhost:1521/<your SID>

The Oracle Database inside the container also has Oracle Enterprise Manager Express configured. To access OEM Express, start your browser and follow the URL:

https://localhost:5500/em/

Please note that the run command will not return, i.e. it will block your shell.

Starting and Stopping a Container

You can start and stop a container:

$ docker start <container name>

Starting an Interactive Shell

In order to deploy stored procedures and user-defined functions, it is necessary to create an interactive shell. The project that contains the files that should be deployed into the database are typically mounted using a volume at /home/oracle/myproject (s.a.).

An interactive shell also allows you run SQL*Plus.

$ docker exec -ti <container name> bash -li

Changing the admin accounts passwords

On the first startup of the container a random password will be generated for the database if not provided. You can find this password in the output line:

ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN:

The password for those accounts can be changed via the docker exec command. Note, the container has to be running:

$ docker exec <container name> ./setPassword.sh <your password>