docker-images icon indicating copy to clipboard operation
docker-images copied to clipboard

Reduce image size for a patched OracleDB

Open beegee1 opened this issue 3 years ago • 1 comments

Hello everyone,

the image size of a patched Oracle DB is about twice that of an unpatched OracleDB. This is because nearly each file of the original DB installation will be replaced by installing a release update (for example 19.03 to 19.11). Original 19.03 installation: around 7 GB image size Patched 19.11 installation: around 15 GB image size

I'm using this image extension: https://github.com/oracle/docker-images/tree/main/OracleDatabase/SingleInstance/extensions/patching

Could the image size be reduced for example by using the oraclelinux base image and copy everything of the patched Oracle installation to the new image? Moreover, after patching these files could be removed: https://github.com/oracle/docker-images/blob/main/OracleDatabase/SingleInstance/dockerfiles/19.3.0/installDBBinaries.sh#L59

Furthermore for installing 19.11 an update of OPatch was necessary, could the update/replacement of OPatch be included in the Dockerfile script? OPatch zip must be provided on your own of course.

beegee1 avatar Jun 23 '21 09:06 beegee1

@beegee1 We have a provision to update OPatch. Download the OPatch zip i.e. Patch 6880880 and place it to /extensions/patching/patches/one_offs directory along with other patches if any. Then after extending the image, Opatch will be updated to latest version and all the remaining patches will be applied.

Additionally, I will be working on reducing the size of patched image by using oracle-linux base image. Will let you know once I reach a conclusion. Thanks.

abhisbyk avatar Jun 24 '21 10:06 abhisbyk

@abhisbyk is there any update on reducing the patched image size? I need to apply patch sets 34133642 and 34086870. These need to be applied as separate docker build executions, so the resulting image size is an astronomical 22GB.

thelateperseus avatar Oct 17 '22 01:10 thelateperseus

@thelateperseus You can build these patch sets in one execution itself. You should put 34133642 in /extensions/patching/patches/release_update folder and 34086870 in /extensions/patching/patches/one_offs folder, and build these patches in one go. It should reduce the size of the image.

Please let me know how it goes.

abhisbyk avatar Oct 26 '22 06:10 abhisbyk

@abhisbyk sorry for the late reply, I've just gotten back to working on this. Thanks for the tip about applying the patches in a single execution.

I've had a go at reducing the size of the patched images. Rather than applying the patches as a separate docker build step, I've altered the main Dockerfile to apply the patches in the same layer as the DB binaries are installed. The resulting patched image size for 19.16 is 7GB, which is the same as the original 19.03 image. See below for the changes I made to achieve this.

https://github.com/oracle/docker-images/compare/main...thelateperseus:docker-images:main

What do you think of this approach of incorporating patching in to the main Dockerfile? Should I open a pull request with these changes?

thelateperseus avatar Mar 20 '23 06:03 thelateperseus

cool @thelateperseus, yes please open a PR for the same

yunus-qureshi avatar Mar 20 '23 11:03 yunus-qureshi

@yunus-qureshi I have created pull request https://github.com/oracle/docker-images/pull/2594

As a side note, we use the "prebuiltdb" extension to create separate images for each of our schemas. Using 19.3, the runOracle.sh step adds 4.75GB for the data files. However, with 19.16, this jumps to 7.39GB. Is this expected? Has anyone else observed something similar?

thelateperseus avatar Mar 21 '23 01:03 thelateperseus