Oracle 18c xe docker image doesn't start

4.7k views Asked by At

I have tried to build the docker image for Oracle 18c xe using these links below:
Build Oracle docker image 1
Oracle blog for docker image
Then, I tried to use the command below to solve the issue from this link Oracle Github issue page and also added a comment at the bottom of the same page: docker run --name mydb --cpuset-cpus="0-7" -p 51521:1521 -p 55500:5500 -e ORACLE_PWD=mysecurepassword -e ORACLE_CHARACTERSET=AL32UTF8 oracle/database:18.4.0-xe and, it still doesn't work! It throws the exact same error as below:

docker logs 701720e132af
ORACLE PASSWORD FOR SYS AND SYSTEM: Password1_One
Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts:
Confirm the password:
Configuring Oracle Listener.
Listener configuration succeeded.
Configuring Oracle Database XE.
Enter SYS user password: 
***************
Enter SYSTEM user password: 
************
Enter PDBADMIN User Password: 
**************
Prepare for db operation
7% complete
Copying database files
8% complete
[WARNING] ORA-00821: Specified value of sga_target 600M is too small, needs to be at least 632M
ORA-01078: failure in processing system parameters

9% complete
[FATAL] ORA-01034: ORACLE not available

29% complete
100% complete
[FATAL] ORA-01034: ORACLE not available

7% complete
0% complete
Look at the log file "/opt/oracle/cfgtoollogs/dbca/XE/XE.log" for further details.

Database configuration failed. Check logs under '/opt/oracle/cfgtoollogs/dbca'.
mv: cannot stat '/opt/oracle/product/18c/dbhomeXE/dbs/spfileXE.ora': No such file or directory
The Oracle base remains unchanged with value /opt/oracle
#####################################
########### E R R O R ###############
DATABASE SETUP WAS NOT SUCCESSFUL!
Please check output for further info!
########### E R R O R ###############
#####################################
The following output is now a tail of the alert.log:
tail: cannot open '/opt/oracle/diag/rdbms/*/*/trace/alert*.log' for reading: No such file or directory
tail: no files remaining

Building the images succeeds when I use the below command:

docker build --force-rm=true \
             --no-cache=true \
             --shm-size=1G \
             --build-arg DB_EDITION=xe \
             -t oracle/database:18.4.0-xe \
             -f Dockerfile.xe .

Then I see the image as below:

docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
oracle/database     18.4.0-xe           fe0fe8a16d63        17 minutes ago      5.89GB

Specifying the number of CPU's to use worked before but, I had to format my MacBook Pro 16" (2019) which now uses the latest version of Catalina 10.15.7, Intel i9 2.4GHz 8-core and 64GB RAM. Please help as I REALLY need this for testing and practice. Thanks!

P.S: even when I used the provided build script in the GitHub project, I still get the same error!

2

There are 2 answers

3
Benoit Courty On

I find a, hugly, solution by adding this line in Dockerfile :

RUN sed -i 's/$MEMORY_CONSTRUCT/-initParams sga_target=1968M,pga_aggregate_target=80M/' /etc/init.d/oracle-xe-18c

Before

RUN /etc/init.d/oracle-xe-18c configure

So it override the computed MEMORY_CONSTRUCT variable in the configure_perform() function of the Oracle starting script.

2
Morten Berg On

I got the same problem on Mac OS X with Catalina with Docker Desktop and docker-compose. Container fails on initial startup.

But I got it to work if I reduced the number of CPUs allocated to Docker Desktop to 1: Docker desktop resources

With only 1 CPU available, I was able to start the container, and the database was initialized correctly. After initial startup, I could stop Docker Desktop, increase CPU count back to original value (8), and restart the previously initialized container. A bit cumbersome, but it works. I