Optimizing the Optimized Docker Image for Oracle XE 18c (18.4.0) including Archivelog

Posted by Dirk Nachbar on Friday, May 03, 2019
On 1st May 2019 I was publishing a solution on how to optimize the Docker image for Oracle XE 18c from 8.7 GB down to 5.41 GB (https://dirknachbar.blogspot.com/2019/05/optimized-docker-image-for-oracle-xe.html).

In the last 2 days I was playing a bit more with my optimized Docker image for Oracle XE 18c and I was able to downsize the Docker image once again to a current size of 4.02 GB. So its more than 50% of savings from the original Docker image size.

$ docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
oracle/database      18.4.0-xe           2018ad58d2f3        16 hours ago        4.02GB
$

I mainly removed unnecessary directories from the $ORACLE_HOME and several binaries, which are not required in my opinion and I strip some of the big binaries to remove the comments from them.

You can find the optimized optimized Docker Image for Oracle XE 18c (18.4) in my GitHub Repository https://github.com/DirkNachbar/Docker/tree/master/OracleXE

Here is the list of directories and binaries which I removed from the image in order to come down to 4.02 GB:

# Snippet from Dockerfile.xe
RUN cd $INSTALL_DIR && \
    yum -y install $INSTALL_FILE_1 && \
    rm -rf /var/cache/yum && \
    rm -f $INSTALL_FILE_1 && \
    rm -rf $ORACLE_HOME/demo && \
    rm -rf $ORACLE_HOME/dmu && \
    rm -rf $ORACLE_HOME/javavm && \
    rm -rf $ORACLE_HOME/md && \
    rm -rf $ORACLE_HOME/nls/demo && \
    rm -rf $ORACLE_HOME/odbc && \
    rm -rf $ORACLE_HOME/rdbms/demo && \
    rm -rf $ORACLE_HOME/R && \
    rm -rf $ORACLE_HOME/instantclient && \
    rm -rf $ORACLE_HOME/inventory && \
    rm -rf $ORACLE_HOME/deinstall && \
    rm -r  $ORACLE_HOME/lib/ra_aix_ppc64.zip && \
    rm -r  $ORACLE_HOME/lib/ra_hpux_ia64.zip && \
    rm -r  $ORACLE_HOME/lib/ra_solaris*.zip && \
    rm -f  $ORACLE_HOME/lib/ra_windows64.zip && \
    rm -f  $ORACLE_HOME/lib/ra_zlinux64.zip && \
    rm -rf $ORACLE_HOME/crs && \
    rm -f  $ORACLE_HOME/bin/asmcmd && \
    rm -f  $ORACLE_HOME/bin/asmcmdcore && \
    rm -f  $ORACLE_HOME/bin/bdschecksw && \
    rm -f  £ORACLE_HOME/bin/dbv && \
    rm -f  $ORACLE_HOME/bin/ldap* && \
    rm -f  $ORACLE_HOME/bin/dbfs_client && \
    rm -f  $ORACLE_HOME/bin/afdboot && \
    rm -f  $ORACLE_HOME/bin/exp && \
    rm -f  $ORACLE_HOME/bin/imp && \
    rm -f  $ORACLE_HOME/bin/*.exe && \
    rm -f  $ORACLE_HOME/bin/lcsscan && \
    rm -f  $ORACLE_HOME/bin/dgmgrl && \
    rm -f  $ORACLE_HOME/bin/nid && \
    rm -f  $ORACLE_HOME/bin/orion && \
    rm -f  $ORACLE_HOME/bin/procob && \
    rm -f  $ORACLE_HOME/bin/setasmgid && \
    rm -f  $ORACLE_HOME/bin/wrap && \
    rm -f  $ORACLE_HOME/bin/*0 && \
    rm -f  $ORACLE_HOME/bin/tnsping && \
    rm -f  $ORACLE_HOME/bin/tkprof && \
    rm -f  $ORACLE_HOME/bin/srvctl && \
    rm -f  $ORCALE_HOME/bin/wrc && \
    rm -rf $ORACLE_HOME/sdk && \
    strip --remove-section=.comment $ORACLE_HOME/bin/oracle && \
    strip --remove-section=.comment $ORACLE_HOME/bin/rman && \
    strip --remove-section=.comment $ORACLE_HOME/bin/tnslsnr

I will continue to try to downsize the Docker image for Oracle XE 18c a bit more within the next days and will post updates on these topic.