Skip to Content
Technical Articles

Setting up HANA Express using Docker on Windows Subsystem for Linux 2

Recently I had to switch my development machines. While in the process of migrating all my virtual machines, I noticed my new PC was already running on Windows 10 2004 release. As you might know Windows 10 2004 release includes Windows Subsystem Linux 2. Which made me think of moving away from separate virtual machines (I was using Hyper-V) and going for Docker images as much as possible.

In this blog I’m going to explain the steps I had to take to get a HANA Express (without XSA) instance up and running using Docker and Windows Subsystem Linux 2 and how to connect to the newly created system using the HANA tools for Eclipse.

Prerequisites

In order to be able to complete this tutorial you’ll have to make sure to have prerequisites in place:

  • Windows 10 Version 2004
  • Windows Subsystem for Linux Enabled
  • Linux distribution downloaded from the Microsoft Store and configured (I used Ubuntu 20.04 LTS)
  • Linux kernel updated to latest version (documentation available here)

I’m not going to dive into setting up Windows Subsystem for Linux and Docker for Windows, since there are plenty of guides available online. A good guide on setting up Windows Subsystem For Linux 2 on Windows 10 and installing Docker can be found here.

Docker configuration

Double check your docker configuration and make sure following setting is enabled.

Setting up HANA Express using Docker

Choose a folder where all the HANA Express files should be stored and create a file called settings.json with following contents (replace password with your own):

{
   "master_password": "<enteryourownpasswordhere>"
}

Example:

Open a Windows terminal or Powershell terminal and run following command (replace ‘<enteryourownpathhere>’ with path chosen in step 1):

docker run -p 39013:39013 -p 39017:39017 -p 39041-39045:39041-39045 -p 1128-1129:1128-1129 -p 59013-59014:59013-59014 -d -v <enteryourownpathhere>:/hana/mounts --ulimit nofile=1048576:1048576 --sysctl kernel.shmmax=1073741824 --sysctl net.ipv4.ip_local_port_range='40000 60999' --sysctl kernel.shmmni=524288 --sysctl kernel.shmall=8388608 --name "HANA-Express" store/saplabs/hanaexpress:2.00.045.00.20200121.1 --passwords-url file:///hana/mounts/settings.json --agree-to-sap-license

Example:

docker run -p 39013:39013 -p 39017:39017 -p 39041-39045:39041-39045 -p 1128-1129:1128-1129 -p 59013-59014:59013-59014 -d -v C:\Users\Geert-JanKlaps\Documents\Docker\HANA:/hana/mounts --ulimit nofile=1048576:1048576 --sysctl kernel.shmmax=1073741824 --sysctl net.ipv4.ip_local_port_range='40000 60999' --sysctl kernel.shmmni=524288 --sysctl kernel.shmall=8388608 --name "HANA-Express" store/saplabs/hanaexpress:2.00.045.00.20200121.1 --passwords-url file:///hana/mounts/settings.json --agree-to-sap-license

Wait for the command to complete (downloading the docker image can take some time):

Once the command is finished the container is created and will take some time to get up and running. You can check the progress by opening the Docker dashboard and clicking on the newly created container:

You can check the progress by opening the logs of the container:

Once following message is displayed in the logs, the container is fully up and running:

Note: In this tutorial I’m using the HANA Express database without application services. These instructions might work 

Update Windows hosts file (optional)

In order to easily access your HANA Express system you can update your Windows hosts file with following entry (or update any existing entry for 127.0.0.1 with an additional hostname hxehost):

127.0.0.1 hxehost

Note: if you don’t update your hosts file with this entry you’ll have to replace hxehost in the next steps with localhost.

Configure HANA Express in Eclipse

If you don’t have Eclipse or the HANA Eclipse Plugins installed yet, please refer to this tutorial before continuing with this part of the blog.

In Eclipse, open up the “SAP HANA Administration Console” perspective:

 

In the right sidebar, right click the white space and choose “Add System”:

Enter the connection details for the SYSTEM database:

Enter the credentials for the SYSTEM user (password is the one you chose in the JSON file):

Open the administration console by double clicking the newly added system:

Repeat these steps for the actual tenant database (HXE) and enter following connection details:

That’s looking great, we’ve got our HANA Express database up and running! Happy developing!

Conclusion

While this setup is not officially supported (yet?) it seems to be working absolutely great. I was a little afraid of the installation process, but it went surprisingly well. The whole process only took me about 40 minutes and I now have a HANA database which I can literally turn on and off with the push of a single button at my disposal.

My next steps? Hooking my new HANA Express database up to my local Cloud Application Programming Model projects!

References

Materials I used to get this up and running:

Be the first to leave a comment
You must be Logged on to comment or reply to a post.