|
| 1 | +# Oracle REST Data Services on Docker |
| 2 | +Sample Docker build files to facilitate installation, configuration, and environment setup for DevOps users. |
| 3 | +For more information about Oracle REST Data Services (ORDS) please see the [ORDS Documentation](http://www.oracle.com/technetwork/developer-tools/rest-data-services/documentation/index.html). |
| 4 | + |
| 5 | +## How to build and run |
| 6 | +This project offers sample Dockerfiles for Oracle REST Data Services |
| 7 | + |
| 8 | +To assist in building the images, you can use the [buildDockerImage.sh](dockerfiles/buildDockerImage.sh) script. See below for instructions and usage. |
| 9 | + |
| 10 | +The `buildDockerImage.sh` script is just a utility shell script that performs MD5 checks and is an easy way for beginners to get started. Expert users are welcome to directly call `docker build` with their prefered set of parameters. |
| 11 | + |
| 12 | +### Building Oracle REST Data Services Install Images |
| 13 | +**IMPORTANT:** You will have to provide the installation binaries of ORDS and put them into the `dockerfiles` folder. You only need to provide the binaries for the version you are going to install. The binaries can be downloaded from the [Oracle Technology Network](http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html). Note that you must not uncompress the binaries. The script will handle that for you and fail if you uncompress them manually! |
| 14 | + |
| 15 | +The image builds on top of the `oracle/serverjre:8` image which is also provided in this repository, see [OracleJava](../OracleJava). You will first have to build the `oracle/serverjre:8` image before you can build this image! |
| 16 | + |
| 17 | +Before you build the image make sure that you have provided the installation binaries and put them into the right folder. Once you have done that go into the **dockerfiles** folder and run the **buildDockerImage.sh** script: |
| 18 | + |
| 19 | + [oracle@localhost dockerfiles]$ ./buildDockerImage.sh -h |
| 20 | + |
| 21 | + Usage: buildDockerImage.sh [-i] [-o] [Docker build option] |
| 22 | + Builds a Docker Image for Oracle Rest Data Services |
| 23 | + |
| 24 | + Parameters: |
| 25 | + -i: ignores the MD5 checksums |
| 26 | + -o: passes on Docker build option |
| 27 | + |
| 28 | + LICENSE UPL 1.0 |
| 29 | + |
| 30 | + Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved. |
| 31 | + |
| 32 | +**IMPORTANT:** The resulting images will be an image with the ORDS binaries installed. On first startup of the container ORDS will be setup. |
| 33 | + |
| 34 | +### Running Oracle REST Data Services in a Docker container |
| 35 | + |
| 36 | +Before you run your ORDS Docker container you will have to specify a network in wich ORDS will communicate with the database you would like it to expose via REST. |
| 37 | +In order to do so you need to create a [user-defined network](https://docs.docker.com/engine/userguide/networking/#user-defined-networks) first. |
| 38 | +This can be done via following command: |
| 39 | + |
| 40 | + docker network create <your network name> |
| 41 | + |
| 42 | +Once you have created the network you can double check by running: |
| 43 | + |
| 44 | + docker network ls |
| 45 | + |
| 46 | +You should see your network, amongst others, in the output. |
| 47 | + |
| 48 | +As a next step you will have to start your database container with the specified network. This can be done via the `docker run` `--network` option, for example: |
| 49 | + |
| 50 | + docker run --name oracledb --network=<your network name> oracle/database:12.2.0.1-ee |
| 51 | + |
| 52 | +The database container will be visible within the network by its name passed on with the `--name` option, in the example above **oracledb**. |
| 53 | +Once your database container is up and running and the database available, you can run a new ORDS container. |
| 54 | + |
| 55 | +To run your ORDS Docker image use the **docker run** command as follows: |
| 56 | + |
| 57 | + docker run --name <container name> \ |
| 58 | + --network=<name of your created network> \ |
| 59 | + -p <host port>:8888 \ |
| 60 | + -e ORACLE_HOST=<Your Oracle DB host (default: localhost)> \ |
| 61 | + -e ORACLE_PORT=<Your Oracle DB port (default: 1521)> \ |
| 62 | + -e ORACLE_SERVICE=<your Oracle DB Service name (default: ORCLPDB1)> \ |
| 63 | + -e ORACLE_PWD=<your database SYS password> \ |
| 64 | + -e ORDS_PWD=<your ORDS password> \ |
| 65 | + -v [<host mount point>:]/opt/oracle/ords/config/ords |
| 66 | + oracle/restdataservices:3.0.10 |
| 67 | + |
| 68 | + Parameters: |
| 69 | + --name: The name of the container (default: auto generated) |
| 70 | + --network: The network to use to communicate with databases. |
| 71 | + -p: The port mapping of the host port to the container port. |
| 72 | + One port is exposed: 8888 |
| 73 | + -e ORACLE_HOST: The Oracle Database hostname that ORDS should use (default: localhost) |
| 74 | + This should be the name that you gave your Oracle database Docker container, e.g. "oracledb" |
| 75 | + -e ORACLE_PORT: The Oracle Database port that ORSD should use (default: 1521) |
| 76 | + -e ORACLE_SERVICE: The Oracle Database Service name that ORDS should use (default: ORCLPDB1) |
| 77 | + -e ORACLE_PWD: The Oracle Database SYS password |
| 78 | + -e ORDS_PWD: The ORDS_PUBLIC_USER password |
| 79 | + -v /opt/oracle/ords/config/ords |
| 80 | + The data volume to use for the ORDS configuration files. |
| 81 | + Has to be writable by the Unix "oracle" (uid: 54321) user inside the container! |
| 82 | + If omitted the ORDS configuration files will not be persisted over container recreation. |
| 83 | + |
| 84 | +Once the container has been started and ORDS configured you can send REST calls to ORDS. |
| 85 | + |
| 86 | +## Known issues |
| 87 | +None |
| 88 | + |
| 89 | +## Support |
| 90 | + |
| 91 | +## License |
| 92 | +To download and run ORDS, regardless whether inside or outside a Docker container, you must download the binaries from the Oracle website and accept the license indicated at that page. |
| 93 | + |
| 94 | +All scripts and files hosted in this project and GitHub [docker-images/OracleRestDataServices](./) repository required to build the Docker images are, unless otherwise noted, released under the Universal Permissive License (UPL), Version 1.0. |
| 95 | + |
| 96 | +## Copyright |
| 97 | +Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved. |
0 commit comments