I’ve spent Xebia’s Innovation Day last August experimenting with Docker in a team with two of my colleagues and a guest. We thought Docker sounds really cool, especially if your goal is to run software that doesn’t require lots of infrastructure and can be easily installed, e.g. because it runs from a jar file. We wondered however what would happen if we tried to run enterprise-software, like an Oracle database. Software that is notoriously difficult to install and choosy about the infrastructure it runs on. Hence our aim for the day: install an Oracle database on CoreOS and Docker. We chose CoreOS because of its small footprint and the fact that it is easily installed in a VM using Vagrant (see https://coreos.com/docs/running-coreos/platforms/vagrant/). We used default Vagrantfile and CoreOS files with one modification:
$vb_memory = 2024in config.rb which allows the Oracle’s pre installer to run. The config files we used can be found here: https://github.com/jvermeir/OraDocker/ Starting with a default CoreOS install we then implemented the steps described here: https://www.tecmint.com/oracle-database-11g-release-2-installation-in-linux/. Below is a snippet from the first version of our Dockerfile (tag: b0a7b56).
FROM centos:centos6 # Step 1: Setting Hostname ENV HOSTNAME oracle.docker.xebia.com # Step 2 RUN yum -y install wget RUN wget --no-check-certificate https://public-yum.oracle.com/public-yum-ol6.repo -O /etc/yum.repos.d/public-yum-ol6.repo RUN wget --no-check-certificate https://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle RUN yum -y install oracle-rdbms-server-11gR2-preinstallNote that this takes awhile because the pre installer downloads a number of CentOS packages that are missing in CoreOS. Execute this in a shell:
vagrant up vagrant ssh core-01 cd ~/share/docker docker build -t oradocker .This seemed like a good time to do a commit to save our work in Docker:
docker ps # note the container-id and substitute for the last parameter in the line below this one. docker commit -m "executed pre installer" 07f7389c811e janv/oradockerAt this point we studiously ignore some of the advice listed under ‘Step 2’ in Tecmint’s install manual, namely adding the HOSTNAME to /etc/syconfig/network, allowing access to the xhost (what would anyone want that for?) and mapping an IP address to a hostname in /etc/hosts (setting the hostname through ‘ENV HOSTNAME’ had no real effect as far as we could tell). We tried that but it didn’t seem to work. Denying reality and substituting our own we just ploughed on… Next we added Docker commands to the Dockerfile that creates the oracle user, copy the relevant installer files and unzip them. Docker starts by sending a build context to the Docker daemon. This takes quite some time because the Oracle installer files are large. There’s probably some way to avoid this, but we didn’t look into that. Unfortunately Docker copies the installer files each time you run docker -t … only to conclude later on that nothing changed. The next version of our Dockerfile sort of works in the sense that it starts up the installer. The installer then complains about missing swap space. We fixed this temporarily at the CoreOS level by running the following commands:
sudo su - swapfile=$(losetup -f) truncate -s 1G /swap losetup $swapfile /swap mkswap $swapfile swapon $swapfilefound here: https://www.spinics.net/lists/linux-btrfs/msg28533.html This works but it doesn’t survive a reboot. Now the installer continues only to conclude that networking is configured improperly (one of those IgnoreAndContinue decisions coming back to bite us):
[FATAL] PRVF-0002 : Could not retrieve local nodenameFor this to work you need to change /etc/hosts which our Docker version doesn’t allow us to do. Apparently this is fixed in a later version, but we didn’t get around to testing that. And maybe changing /etc/sysconfig/network is even enough, but we didn't try that either. The latest version of our work is on github (tag: d87c5e0). The repository does not include the Oracle installer files. If you want to try for yourself you can download the files here: ">https://www.oracle.com/technetwork/database/enterprise-edition/downloads/index-092322.html and adapt the docker file if necessary. Below is a list of ToDo’s:
- Avoid copying large installer files if they’re not gonna be used anyway.
- Find out what should happen if you call ‘ENV HOSTNAME oracle.docker.xebia.com’.
- Make swap file setting permanent on CoreOS.
- Upgrade Docker version so we can change /etc/hosts
by Jan VermeirDeveloping software and infrastructure in teams, doing whatever it takes to get stable, safe and efficient systems in production.