Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

Setup Via Docker Compose #39

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Dockerfile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ ENV \
SHUTDOWN_FILE=shutdownDb.sh \
EM_REMOTE_ACCESS=enableEmRemoteAccess.sh \
EM_RESTORE=reconfigureEm.sh \
ORACLE_XE_RPM=oracle-database-xe-18c-1.0-1.x86_64.rpm \
CHECK_DB_FILE=checkDBStatus.sh
COPY ./files/${ORACLE_XE_RPM} /tmp/

COPY ./files/ /tmp/

RUN yum install -y oracle-database-preinstall-18c && \
yum install -y /tmp/${ORACLE_XE_RPM} && \
rm -rf /tmp/${ORACLE_XE_RPM}
yum localinstall -y /tmp/oracle-database-xe-18c-*.rpm && \
rm -rf /tmp/oracle-*

COPY ./scripts/*.sh ${ORACLE_BASE}/scripts/

Expand Down
40 changes: 34 additions & 6 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
<!-- TOC depthFrom:2 -->

- [Prerequisites](#prerequisites)
- [Build Image](#build-image)
- [Run Container](#run-container)
- [Setup with Docker Compose](#setup-with-docker-compose)
- [Manual Setup](#manual-setup)
- [Build Image](#build-image)
- [Run Container](#run-container)
- [Container Commands](#container-commands)
- [Other](#other)
- [SQL](#sql)
Expand All @@ -20,13 +22,39 @@

## Prerequisites

1. [Download](https://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html) the RPM from Oracle Technology Network and save to folder. We will assume it is in `~/Downloads/oracle-database-xe-18c-1.0-1.x86_64.rpm`.
1. [Download](https://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html) the RPM from Oracle Technology Network and save to folder. We will assume it is in `~/Downloads/oracle-database-xe-VERSION.rpm`.

1. _Optional:_ Setup docker network: `docker network create oracle_network`. This is useful if you want other containers to connect to your database (ORDS for example). You can change `oracle_network` for any name you want, however this name will be used in all the code snippets below.
The following steps are not necessary if you use the [docker-compose setup method](#setup-with-docker-compose):

1. _Optional:_ Setup docker network: `docker network create oracle_network`. This is useful if you want other containers to connect to your database (ORDS for example). You can change `oracle_network` for any name you want, however this name will be used in all the code snippets below.

1. _Optional:_ Create a folder `mkdir ~/docker/oracle-xe` which will store your Oracle XE data to be preserved after the container is destroyed.

## Build Image
## Setup With Docker Compose

*Note*: Use this setup method or the [manual one](#manual-setup) not both.

```bash
-- Clone repo
git clone [email protected]:fuzziebrain/docker-oracle-xe.git

-- Set the working directory to the project folder
cd docker-oracle-xe

-- Copy the RPMs to docker-odb18c-xe/files
cp ~/Downloads/oracle-database-xe-*.rpm files/
-- Build Image
docker-compose build

-- Run Container
docker-compose up
```

## Manual Setup

*Note*: Use this setup method or the [Docker Compose one](#setup-with-docker-compose) not both.

### Build Image

```bash
-- Clone repo
Expand All @@ -42,7 +70,7 @@ cp ~/Downloads/oracle-database-xe-18c-1.0-1.x86_64.rpm files/
docker build -t oracle-xe:18c .
```

## Run Container
### Run Container

_Note first time will take a a while to run for as the `oracle-xe configure` script needs to complete_

Expand Down
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: "3.7"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: any specific reason for requiring composer file format 3.7? The compose file seems pretty simple a first sight, and I would rather specify the lowest supported version of the format as general guideline....

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats a good point, I did it out of habit. I'll check to see the lowest compatible version.

services:

oracle-xe:
build:
context: ./
image: oracle-xe:18c
ports:
- "32118:1521"
- "35518:5500"
volumes:
- oracle-xe-volume:/opt/oracle/oradata


networks:
default:
name: "oracle_network"

volumes:
oracle-xe-volume: {}