# Written by The Suhu (2021).
# Tested on Ubuntu Server 20.04
# Make sure you have enough disk space
Clone Official source for Docker configurations, images, and examples of Dockerfiles etc.
git clone https://github.com/oracle/docker-images.git
Create user:
sudo useradd -d /home/oracle -m --uid 54321 oracle
sudo su - oracle
mkdir oradata
Change directory
cd docker-images/OracleDatabase/SingleInstance/dockerfiles
Build image and wait for it to finish
./buildContainerImage.sh -v 18.4.0 -x
Done, there should be oracle/database:18.4.0-xe
image from the build
docker images
This Oracle installer is very large in size. And this version of Oracle XE requires a direct download from the internet. So, failed to download when build image may happen. I've tried to use Oracle installer from local file during image build, but failed. To solve this problem can be done with the following steps:
- Download Oracle 18 XE at https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-18c-1.0-1.x86_64.rpm
- Create your own web server and and put the installer on your web server
- Edit
docker-images/OracleDatabase/SingleInstance/dockerfiles/18.4.0/Dockerfile.xe
. ReplaceINSTALL_FILE_1="https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-18c-1.0-1.x86_64.rpm"
withINSTALL_FILE_1="http://yourlocalwebserver/oracle-database-xe-18c-1.0-1.x86_64.rpm"
Another problem that may occur is when pull oraclelinux:7-slim
. To solve this problem, you can pull the image before build.
docker pull oraclelinux:7-slim
docker run --name <container name> \
-p <host port>:1521 -p <host port>:5500 \
-e ORACLE_PWD=<your database passwords> \
-e ORACLE_CHARACTERSET=<your character set> \
-v <host mount point>:/opt/oracle/oradata \
oracle/database:18.4.0-xe
Example:
docker run -d --name oracle18xe \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_PWD=yourpassword \
-v /home/oracle/oradata:/opt/oracle/oradata \
oracle/database:18.4.0-xe
if logged in container and can't login as SYS, the error message that appears is ORA-12547: TNS:lost contact
. Do the following steps to solve the problem:
- Type
id
and then press Enter to check user level - Type
ps -ef
then press Enter to check which Oracle process is running on what user - If it's running on oracle user, type
su oracle
then press Enter - Finally, re-login SYS as SYSDBA and it should work
That's all and if you find it useful please star (:star:) & share.
I'm using Oracle 19c. But error
Command:
Any suggestion?