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

Failed to create GoldenGate docker image : Checking swap space: 0 MB available, 150 MB required. Failed

Open askintuit opened this issue 1 year ago • 1 comments

Issue: Following instructions of GoldenGate is failing with the swap space issues leading to pre-requisite installations failure. https://github.com/oracle/docker-images/tree/main/OracleGoldenGate/21c GoldenGate Zip: Oracle GoldenGate 21.3.0.0.0 for Oracle on Linux x86-64

Docker Command:

docker build --tag local/gg:21 --build-arg BASE_IMAGE="ghcr.io/oracle/oraclelinux:8" --build-arg INSTALLER=213000_fbo_ggs_Linux_x64_Oracle_shiphome.zip .

Failure Log:


[root@ip-10-0-0-0 21c]# docker build --tag local/gg:21 --build-arg BASE_IMAGE="ghcr.io/oracle/oraclelinux:8" --build-arg INSTALLER=213000_fbo_ggs_Linux_x64_Oracle_shiphome.zip .
[+] Building 138.8s (10/11)                                                                                                                                                                                                                                                docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                 0.0s
 => => transferring dockerfile: 1.23kB                                                                                                                                                                                                                                               0.0s
 => [internal] load metadata for ghcr.io/oracle/oraclelinux:8                                                                                                                                                                                                                        0.3s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                    0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                      0.0s
 => [1/7] FROM ghcr.io/oracle/oraclelinux:8@sha256:5f2cd2ccf69c8bd91d1d234066050f106e4a03135968ace4110359e3e5028d90                                                                                                                                                                  0.0s
 => [internal] load build context                                                                                                                                                                                                                                                    0.0s
 => => transferring context: 3.78kB                                                                                                                                                                                                                                                  0.0s
 => CACHED [2/7] RUN           : 213000_fbo_ggs_Linux_x64_Oracle_shiphome.zip                                                                                                                                                                                                        0.0s
 => CACHED [3/7] COPY          install-*.sh      /tmp/                                                                                                                                                                                                                               0.0s
 => CACHED [4/7] COPY          213000_fbo_ggs_Linux_x64_Oracle_shiphome.zip      /tmp/installer.zip                                                                                                                                                                                  0.0s
 => CACHED [5/7] COPY          bin/              /usr/local/bin/                                                                                                                                                                                                                     0.0s
 => ERROR [6/7] RUN           bash -c  /tmp/install-prerequisites.sh &&               bash -c  /tmp/install-deployment.sh    &&               rm   -fr /tmp/*   /etc/nginx   

92.83 Packages installed after 1 attempts
101.9 Starting Oracle Universal Installer...
101.9
101.9 Checking Temp space: must be greater than 120 MB.   Actual 2054 MB    Passed
101.9 Checking swap space: 0 MB available, 150 MB required.    Failed <<<<
101.9
101.9 >>> Ignoring required pre-requisite failures. Continuing...
101.9
102.0 Preparing to launch Oracle Universal Installer from /tmp/OraInstall2024-05-22_06-03-04AM. Please wait ...library initialization failed - unable to allocate file descriptor table - out of memory/tmp/install-deployment.sh: line 81: /u01/app/oraInventory/orainstRoot.sh: No suchfile or directory
------
Dockerfile:20
--------------------
  19 |
  20 | >>> RUN           bash -c  /tmp/install-prerequisites.sh && \
  21 | >>>               bash -c  /tmp/install-deployment.sh    && \
  22 | >>>               rm   -fr /tmp/*   /etc/nginx
  23 |
--------------------
ERROR: failed to solve: process "/bin/sh -c bash -c  /tmp/install-prerequisites.sh &&               bash -c  /tmp/install-deployment.sh    &&               rm   -fr /tmp/*   /etc/nginx" did not complete successfully: exit code: 127

It appears to be failing with the swap-space issues, & similar behavior has been observed with the 23ai for simplicity I tried with 21c GoldenGate.

Hence I took one step further & tried adding swap space by changing the Dockerfile, however turning on swap space isn't allowed

Modified Dockerfile:

## Copyright (c) 2021, Oracle and/or its affiliates.
ARG           BASE_IMAGE=oraclelinux:8
#  hadolint ignore=DL3006
FROM        ${BASE_IMAGE}
LABEL         maintainer="Stephen Balousek<[email protected]>"

ARG           INSTALLER
RUN           : ${INSTALLER:?}

ENV           OGG_HOME               "/u01/ogg"
ENV           OGG_DEPLOYMENT_HOME    "/u02"
ENV           OGG_TEMPORARY_FILES    "/u03"
ENV           OGG_DEPLOYMENT_SCRIPTS "/u01/ogg/scripts"
ENV           PATH                   "${OGG_HOME}/bin:${PATH}"

RUN dd if=/dev/zero of=/tmp/swap count=4096 bs=1M
RUN chmod 600 /tmp/swap
RUN mkswap /tmp/swap
RUN swapon --show
RUN swapon /tmp/swap

COPY          install-*.sh      /opt/tmp/
COPY          ${INSTALLER}      /opt/tmp/installer.zip
COPY          bin/              /usr/local/bin/

RUN           bash -c  /opt/tmp/install-prerequisites.sh && \
              bash -c  /opt/tmp/install-deployment.sh    && \
              rm   -fr /opt/tmp/*   /etc/nginx

COPY          nginx/            /etc/nginx/

EXPOSE        80 443
VOLUME      [ "${OGG_DEPLOYMENT_HOME}", "${OGG_TEMPORARY_FILES}", "${OGG_DEPLOYMENT_SCRIPTS}" ]
HEALTHCHECK   --start-period=90s --retries=1 \
        CMD [ "/usr/local/bin/healthcheck" ]

Result:

[root@ip-10-0-0-0 21c]# docker build --tag local/gg:21 --build-arg BASE_IMAGE="ghcr.io/oracle/oraclelinux:8" --build-arg INSTALLER=213000_fbo_ggs_Linux_x64_Oracle_shiphome.zip .
[+] Building 0.8s (11/16)                                                                                                                                                                                                                                                  docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                 0.0s
 => => transferring dockerfile: 1.38kB                                                                                                                                                                                                                                               0.0s
 => [internal] load metadata for ghcr.io/oracle/oraclelinux:8                                                                                                                                                                                                                        0.4s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                    0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                      0.0s
 => [ 1/12] FROM ghcr.io/oracle/oraclelinux:8@sha256:5f2cd2ccf69c8bd91d1d234066050f106e4a03135968ace4110359e3e5028d90                                                                                                                                                                0.0s
 => [internal] load build context                                                                                                                                                                                                                                                    0.0s
 => => transferring context: 3.82kB                                                                                                                                                                                                                                                  0.0s
 => CACHED [ 2/12] RUN           : 213000_fbo_ggs_Linux_x64_Oracle_shiphome.zip                                                                                                                                                                                                      0.0s
 => CACHED [ 3/12] RUN dd if=/dev/zero of=/tmp/swap count=4096 bs=1M                                                                                                                                                                                                                 0.0s
 => CACHED [ 4/12] RUN chmod 600 /tmp/swap                                                                                                                                                                                                                                           0.0s
 => CACHED [ 5/12] RUN mkswap /tmp/swap                                                                                                                                                                                                                                              0.0s
 => CACHED [ 6/12] RUN swapon --show                                                                                                                                                                                                                                                 0.0s
 => ERROR [ 7/12] RUN swapon /tmp/swap                                                                                                                                                                                                                                               0.3s
------
 > [ 7/12] RUN swapon /tmp/swap:
0.299 swapon: /tmp/swap: swapon failed: Operation not permitted
------
Dockerfile:20
--------------------
  18 |     RUN mkswap /tmp/swap
  19 |     RUN swapon --show
  20 | >>> RUN swapon /tmp/swap
  21 |
  22 |     COPY          install-*.sh      /opt/tmp/
--------------------
ERROR: failed to solve: process "/bin/sh -c swapon /tmp/swap" did not complete successfully: exit code: 255

To me none of the combinations are working with the goldengate even with the 12c-19c & the documentation does not mention how the architecture ensures the High Availability of the GoldenGate when deployed onto Container solutions/Serverless solutions & what would happen when the pod goes down when deployed on a multi-pod environment.

PS: I tried adding Root permissions as well to the Dockerfile, and it has the same behaviour USER root

askintuit avatar May 22 '24 06:05 askintuit

Hi there, to the best of my knowledge it is by default forbidden to use swap on kubernetes and some other container environments. Kubernetes Versions >1.26 have experimental swap support which needs activation first. But there is some good news: I tested with the latest GoldenGate 23ai (the new long term release), and that version works without hazzle! GG just throws a message that it is running on a no-swap system on startup, and replicats and extracts will startup properly even without any swap. But beware, GG can consume all Your servers memory if it needs to, unless You specify CACHEMGR parameters to limit that.

Does that help You a bit ?

ilfur avatar Sep 06 '24 09:09 ilfur