-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script to create Oracle slim images for all versions #1666
base: main
Are you sure you want to change the base?
Conversation
Co-Authored-By: marcelo-ochoa <[email protected]>
Yes #1534 is included in this new PR. |
@gvenzl please go ahead and review this PR. @marcelo-ochoa has signed an OCA. |
@yunus-qureshi, @rishabh20, @latakannan, can you please look at this PR and see whether it's feasible to add to the scripts? |
@gvenzl @Djelibeybi - Any updates as to whether this may be merged at some point in the future? |
I gave a shot to this approach and ran into a couple of snags particularly around the permissions on the directory, might be related to mac/docker or not setting To re-iterate the steps for anyone else following, they're something like this: PreRequisite
Build your RMAN base
Build your Container with SLIM
I first read the 'slim' name and thought I could just use this for everything, but there's some steps needed prior to that (didn't read due to excitement) 🤦 |
@marcelo-ochoa can we please resolve conflicts and repush |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename build script
find $ORACLE_HOME -name '*.zip' -type f -delete | ||
find $ORACLE_HOME -name '*.txt' -type f -delete | ||
find $ORACLE_HOME -name '*O' -type f -delete | ||
find $ORACLE_HOME -path '*/install/*' -delete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why I'm seeing this when no one else is, but I tried borrowing this cleanup script for a different 19.3 EE container build and the DB failed to start after applying it. The error was ORA-12777, and MOS doc id 2741007.1 seems to have correctly identified that this missing install
directory was the culprit. With this line and next removed, everything appears to be fine now.
I am not fully convinced with this 2 step manual process. @marcelo-ochoa @gvenzl how about converting this into an extension called slimming. Along with this new pre-create-database extension when the base image is extended with both we would get a slimmed down image with a pre-created DB for use in CI/CD pipelines. |
I can't wait to put my hands on a slimmed + pre-started Oracle image. :-) |
Any progress on this? Ive been building this PR manually for quite some time now and it would be great to get this merged to have a better CI/CD experience :) |
@yunus-qureshi @gvenzl @rishabh20 @latakannan are you going to merge it? |
@marcelo-ochoa please resolve conflicts |
The pull request doesn't need to be closed for the conflicts to be resolved. Once they are, this PR can be merged. |
@Djelibeybi thanks for reopening. Was closed by mistake |
This PR is a super-set of #1534
The idea is to provide an slim version of Oracle Docker image image only with binaries and the ability to recreate a fresh Oracle instance from golden images in RMAN compressed full backup format.
Once of mainly motivation of smaller image size and faster creation time is to have a Docker image ready to be used in CI/CD pipelines which requires a fresh RDBMS for unit testing, also an slim image will reduce the network traffic between the CI/CD testing server and the private/public registry hosting the slim image.
Comparison results using this new image:
Image size around 30% of the original:
DB Creation time, 3x faster, sample using XE version:
Docker image creation process uses multi-stage build and a modified script shared by Gerald Venzl and Jacek Gebal to cleanup non necessary stuff.
To get a golden image file either in format tar, tar.gz an RMAN directory with a setup script could be used in conjunction with oracle:18.4.0 image as:
$ docker run -ti --rm --name freshdb -v /tmp/setup:/opt/oracle/scripts/setup -v /run/shm:/dev/shm oracle/database:18.4.0-xe
directory /tmp/setup having:
once a log output shows DATABASE IS READY TO USE! setup directory will have a golden image DB as RMAN format which will be passed as setup directory for oracle/database:18.4.0-xe-slim image or packaged as .tar or .tar.gz file format, here the content of full backup directory:
Make sure that /tmp/setup is owned by Oracle (54321:54321) in order to get RMAN working.
To pack RMAN content as init-db.tar.gz just use:
To start a new container using a golden RDBMS image use:
$ docker run -ti --rm --name testdb -v /tmp/setup:/opt/oracle/scripts/setup -v /run/shm:/dev/shm oracle/database:18.4.0-xe-slim
Each slim images requires a full Docker image built with tags -e or -x, for example:
Note that .zip file with install binaries are not required to build slim images, it uses ee image to extract the layer of binary files only, also I added a flag -l into buildImages.sh script to facilitate build process.