Docker-images: OracleDatabase - not enough swap space on Linux build machine

Created on 12 Jul 2017  路  10Comments  路  Source: oracle/docker-images

I have the same issue as https://github.com/oracle/docker-images/issues/230, but on a build machine using Linux, Linux version 3.10.0-514.10.2.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Fri Mar 3 00:04:05 UTC 2017

Express Edition requires 2048 MB of swap space. This system has 0 MB
of swap space.  Configure more swap space on the system and retry the 
installation.
error: %pre(oracle-xe-11.2.0-1.0.x86_64) scriptlet failed, exit status 1
error: oracle-xe-11.2.0-1.0.x86_64: install failed
Removing intermediate container 07b9541d2e9e
Running cleanup...
Removing tagged image 'docker.prod.walmart.com/oracle:11.2.0.2-xe'.
Tagged image doesn't exist.

Why is the swap space checked at build time? The image may be run on a different machine containing enough swap space.

database help wanted question

Most helpful comment

Managed to use rpmrebuild to get rid of the check:

rpmrebuild --change-spec-pre 'sed -e "s/requiredswapspace=.*\$/requiredswapspace=0/"' -v -p ${extractedOracleDbZipName}/Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm && cp /root/rpmbuild/RPMS/x86_64/oracle-xe-11.2.0-1.0.x86_64.rpm ${copiedExtractedOracleDbZipName}/Disk1/

All 10 comments

The swap space is tested by the RPM pre-install script which is triggered by the install of the RPM regardless of platform. We can't modify how the RPM works, we just have to handle it inside the build process which is where the RPM is installed.

@Djelibeybi Okay, thanks. I figured it was something like that. Any other way to trick Docker that it has more swap space available?

I don't believe so. I know you can modify /dev/shm but not swap itself. However, let's ping @gvenzl in case he knows.

A workaround/hack that may work is to create a swapfile and turn it on within the build process prior to installing the RPM. I've not tested this, though. :)

There is several discussions on Docker and swap space like this thread on their Discussion Forum.

I could never figure out what good way exists to emulate sufficient swap inside the container without artificially blowing up the image size, etc. As of today I'm only aware that on Linux the swap is inherited (I think):

[root@localhost oradata]# df -h
Filesystem           Size  Used Avail Use% Mounted on
devtmpfs             3.9G     0  3.9G   0% /dev
tmpfs                3.9G  128K  3.9G   1% /dev/shm
tmpfs                3.9G  8.9M  3.9G   1% /run
tmpfs                3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/ol-root   50G  4.9G   46G  10% /
/dev/sdb             100G   26G   73G  26% /var/lib/docker
/dev/sda1            497M  278M  219M  56% /boot
/dev/mapper/ol-home   92G  4.9G   87G   6% /home
tmpfs                799M   16K  799M   1% /run/user/42
tmpfs                799M     0  799M   0% /run/user/1000
docker               465G  339G  127G  73% /mnt
shm                  1.0G  610M  415M  60% /var/lib/docker/containers/1996193a17290473b62843146350b87d8a67bc942e5f14572379db9938c49d42/shm
[root@localhost oradata]# cat /proc/swaps
Filename                Type        Size    Used    Priority
/dev/dm-1                               partition   8257532 564 -1

[root@localhost oradata]# docker exec -ti oracle-xe /bin/bash
bash-4.2# cat /proc/swaps
Filename                Type        Size    Used    Priority
/dev/dm-1                               partition   8257532 564 -1
bash-4.2#

There would be a way to ignore all the rpm checks on install but that would defeat the purpose, i.e. it's an all or nothing approach which could lead to many more "wrong" issues in the future.
Any ideas would be highly appreciated. Other than that I can just recommend to add 1 GB of swap to your Linux machine running Docker.

You can't add additional swap space inside a container without running the container in --privileged mode so I don't think there's an acceptable (to Oracle Product Security) workaround for requiring at least 2GB of swap space on the build server.

Alright, thanks for your time. I will have to get permissions to push my local image to our image repository.

And there is no chance to deactivate/ignore that specific check during the rpm install either?

Not without rebuilding the RPM. You can disable ALL the scripts, but that is probably not a good idea, as who knows what else the RPM does during pre/post install script execution.

Does anyone happen to know which exact check runs this in the rpm?

Managed to use rpmrebuild to get rid of the check:

rpmrebuild --change-spec-pre 'sed -e "s/requiredswapspace=.*\$/requiredswapspace=0/"' -v -p ${extractedOracleDbZipName}/Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm && cp /root/rpmbuild/RPMS/x86_64/oracle-xe-11.2.0-1.0.x86_64.rpm ${copiedExtractedOracleDbZipName}/Disk1/
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Djelibeybi picture Djelibeybi  路  4Comments

nfornag picture nfornag  路  3Comments

montge picture montge  路  3Comments

rajeshpasupathy picture rajeshpasupathy  路  5Comments

ramonPires picture ramonPires  路  5Comments