Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
With the new evolving modern methodologies around many SAP applications and database technology, i am trying to contribute with some idea that can be helpful or spark a new idea for others.

The thought is ...

What if we can create HANA docker container with database filesystems mounted to the container using NFS filesystems from an external source?

This will allow us to create HANA containers instantly with existing data and no dependency on container build process, we can even use native Linux Container images directly without modifying. This will reduce the HANA container build time, keep a persistent layer for data, less image space required for the container, reuse/redeploy the container instantly, etc..

Docker Container with NFS mounts

Docker containers have the capability to mount NFS filesystems from an external source and HANA database supports keeping data files in NFS filesystems. This helps us to achieve the above-mentioned scenario and repetition of docker build during each time when you spin up new image for the container is avoided.

Also, in the deployment method, instead of building the container image with HANA database, we can deploy using conventional installation method with full automation.

So, i have created an All in One script to automatically generate docker compose, HANA installation configuration file and some script to execute inside container and the script can deploy or Run the container as per the need.

All you have to do is follow the below steps

Pre-requisites: -

  1. Prepare a NFS server with export mounts for /hana/shared, /hana/data, /hana/log, /usr/sap, /var/lib/hdb

  2. Prepare and install any Linux operating system with 8 cores and 32GB RAM minimum which supports docker engine (in this example i am using Ubuntu).

  3. Install Docker (link here) community edition & Docker compose (link here) in the Linux operating system.

  4. Make sure you have enough space in filesystems to accommodate docker container and HANA installation packages.

  5. Download latest HANA installation SAR file and extract into any folder.

  6. Create an empty directory for the AIO script to execute.

  7. Download the AIO script ( from the github and copy to the empty directory that was created before.

Deployment: -

Note: - The script must be executed with elevated privileges either by root or execute the script with sudo prefix. Both script location & HANA package location need not be in separate directories, we can even keep them in same directory.

The AIO script will automatically generate the required HANA installation cfg file, docker compose files, input variables and required scripts to execute inside docker container inside the working directory.

Start executing the commands from the empty working directory.
>git clone
>cd hdb-docker-aio
>chmod +x

Generally, we need to select the Option 1 which is the deployment of HANA for the first-time execution.

Provide all the required inputs asked by the script.

Note: - There is no validation for the input values we provide, so carefully provide the inputs.

There will be a prompt to update kernel parameters on the host, if you do not wish to modify you can skip this step. However, make sure the required kernel parameters are updated as per the requirement to run HANA database. If you say yes to modify, the script will take care of updating relevant kernel parameters.

After all files generated the script will stop before starting deployment. This screen pause is to enable consultant to modify any required HANA parameters in the generated cfg file "hana_install.cfg" before deployment apart from the input parameters provided.

Note: - Do not modify the hostname for HANA in cfg file, this value has reference to the input parameters, so don't change it after finishing input screen.

After confirmation docker compose execution is started in background, we can check the docker logs using the below command.
docker container logs -f sap-hana

There could be errors during deployment due to internet issue or repository access failure from Opensuse, in such cases Please restart the container the deployment will automatically start if not started.

Monitor the docker log for successful completion of deployment, the setup will take a while depending on your hardware.

For this docker container deployment, I have kept the network mode as host_mode. Which means all the ports in container will be bind to host network ports directly.

We can now access the HANA database from Studio or connect to an application via the host IP/hostname of the docker host.

The HANA-Docker deployment is complete, if you want to check the status of NFS mounted filesystems inside the docker please attach the docker container to your session and can navigate inside the container Linux.
docker attach sap-hana

We can see that the NFS filesystems are mounted, and HANA database is running using the NFS mounts.

To detach from container, press the detach buttons.
Ctrl+p and Ctrl+q

We can stop the HANA DB anytime by attaching to the container console, However, if we stop the container and try to start again, the container's pre-defined execution steps will try to re-deploy the HANA database. But there is an existing HANA instance so the deployment will fail, and the container will be in stopped state.

Then, how to start the container & Database again ...?

For that we need to execute the HANA-Docker run option from the AIO script.


HANA-Docker Run: -

Run the AIO script again from the working directory without modifying any files or data. After accepting the pre-requisites, select option 2 for running the existing container with HANA already installed.

The HANA-docker container start is executed, we can check the logs using the docker log view command.

The docker container Linux system will be initialized, all required packages will be installed, NFS filesystems mount and HANA database will be started. The docker log will stop at the below screen, after that we can access the HANA database and start working on it.


What is the advantage here?

We can even delete the existing HANA-Docker container and run the AIO script again with option 2, the HANA database will be brought up in minutes with new container deployment without any change to the HANA data, HANA user and other contents. This is because we have mounted the HANA relevant filesystems via NFS, so no change to the HANA data. Also, we can delete the container any number of times and re-create the container to start HANA in minutes without losing data.

This method can be very useful for small data storages and can also be expanded to install in a container on cloud as well using EFS (in aws) or file share (in Azure).


Hope you have liked my work, please do provide your comments if this has impressed you.

Also, I can test and add more different flavours of Linux container images for the HANA to run on request based, please let me know for any changes by raising an issue in my github page.


! Thank you !

! Kudos !






Labels in this area