Wednesday, 22 January 2020

HANA 2.0 Running inside Docker

Intro


When I was searching for any SAP HANA 2.0 inside container, the only thing I was able to find was about SAP HANA Express edition, how to pull images from docker hub with express SAP HANA inside. Nothing about how to create your own image… So here is my try :).


SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

Below we will prepare Dockerfile with SAP HANA 2.0 inside. I will try to explain the concept, so it will be possible to enhance it with your custom configs, sql etc.

I know that SAP on-premise solutions are quite monolithic and not supposed to be executed as microservices inside containers and all this stuff… However, putting SAP HANA inside can be a nice step for building up a distributed development landscape that can be started any amount of times in 5 minutes and than will be clean after work is completed.

Technical overview


I will skip core things about Docker and how to get it in your system, as this you can find either through official docker guide: https://docs.docker.com/get-started/ or by using google.com :).

So, once you have your docker daemon installed and ready, we will start to create the Dockerfile.

To achieve our goal, we will combine several images:

1. Base OS images that you can get from suse registry for example.

2. Adjusted OS image – that will be a combination of SUSE base image + required packets and some pre-work for SAP HANA installation.

SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

Such aproach will give us some more flexibility, and also we will be able to spend less time on rebuild process.

Now several words about my environment:

◉ I recommend to use latest Docker packet so you can benefit from new features. Also try to use new linux kernel, since container executions are based on the kernel, means we can benefit from new features and hopefully will have less possible issues.

◉ For the Dockerfile creation I am using ATOM IDE with Docker and GiT plugins.

◉ On the host where we will run our docker daemon and containers we should allocate some space in the /var/lib/docker folder, since all images will be running from that place by default:

SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

◉ I am running host that is based on SLES 15 SP1 with 64GB of memory a 4 vCPU, this is plenty enough. You can try to run it also on the laptop with Linux installed and 16GB of RAM.

Step 1: Building base SAP OS image


Base SLES image that is available via SUSE registry is not enough to install SAP HANA. It is not containing required packets, so we have to identify what is missing. The most easy way to get all dependencies and to avoid spending time on rebuilding process is:

1. Run base SLES image
2. Install missing packets
3. Try to install SAP HANA inside container
4. Fail and identify missing packets
5. Install all packets
6. Install SAP HANA

Create Dockerfile

– Create base layer with FROM instruction

FROM registry.suse.com/suse/sle15:15.1

– Put some meaningful comments with LABEL instruction

# Extra metadata
LABEL version="1.0"
LABEL description="Base SLES 15 SP1 SAP image"

– Create some directories inside image with RUN instruction

RUN mkdir -p /etc/zypp \
 && mkdir -p /etc/zypp/repos.d \
 && mkdir -p /jail

– Add SLES repo URLs with another RUN layer. I am using my own repos, you should use yours :).

To identify URI that are assigned in your current SLES OS you can use the following command:

> zypper lr -u command

SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

– We will combine all repos in one layer by using && key:

RUN zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-SAP-Applications/15-SP1/x86_64/product/ SLE-Module-SAP-Applications_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-SAP-Applications/15-SP1/x86_64/update/ SLE-Module-SAP-Applications_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Basesystem/15-SP1/x86_64/product/ SLE-Module-Basesystem_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Basesystem/15-SP1/x86_64/update/ SLE-Module-Basesystem_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Containers/15-SP1/x86_64/product/ SLE-Module-Containers_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Containers/15-SP1/x86_64/update/ SLE-Module-Containers_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Development-Tools/15-SP1/x86_64/product/ SLE-Module-Development-Tools_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Development-Tools/15-SP1/x86_64/update/ SLE-Module-Development-Tools_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Legacy/15-SP1/x86_64/product/ SLE-Module-Legacy_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Legacy/15-SP1/x86_64/update/ SLE-Module-Legacy_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Packagehub-Subpackages/15-SP1/x86_64/product/ SLE-Module-Packagehub-Subpackages_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Packagehub-Subpackages/15-SP1/x86_64/update/ SLE-Module-Packagehub-Subpackages_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Server-Applications/15-SP1/x86_64/product/ SLE-Module-Server-Applications_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Server-Applications/15-SP1/x86_64/update/ SLE-Module-Server-Applications_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Product-SLES/15-SP1/x86_64/product/ SLE-Product-SLES-15-SP1_product \  
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Product-SLES/15-SP1/x86_64/update/ SLE-Product-SLES-15-SP1_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Product-SLES_SAP/15-SP1/x86_64/product/ SLE-Product-SLES_SAP_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Product-SLES_SAP/15-SP1/x86_64/update/ SLE-Product-SLES_SAP_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Public-Cloud/15-SP1/x86_64/product/ SLE-Module-Public-Cloud_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Public-Cloud/15-SP1/x86_64/update/ SLE-Module-Public-Cloud_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Web-Scripting/15-SP1/x86_64/product/ SLE-Module-Web-Scripting_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Web-Scripting/15-SP1/x86_64/update/ SLE-Module-Web-Scripting_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Product-HA/15-SP1/x86_64/product/ SLE-Product-HA_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Product-HA/15-SP1/x86_64/update/ SLE-Product-HA_update

– And this is how final Dockerfile can looks like:

FROM registry.suse.com/suse/sle15:15.1

# Extra metadata
LABEL version="1.0"
LABEL description="Base SLES 15 SP1 SAP image"

# Create zypper repos and empty folder
RUN mkdir -p /etc/zypp \
 && mkdir -p /etc/zypp/repos.d \
 && mkdir -p /jail

# Add repsystem from my repo server
RUN zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-SAP-Applications/15-SP1/x86_64/product/ SLE-Module-SAP-Applications_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-SAP-Applications/15-SP1/x86_64/update/ SLE-Module-SAP-Applications_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Basesystem/15-SP1/x86_64/product/ SLE-Module-Basesystem_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Basesystem/15-SP1/x86_64/update/ SLE-Module-Basesystem_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Containers/15-SP1/x86_64/product/ SLE-Module-Containers_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Containers/15-SP1/x86_64/update/ SLE-Module-Containers_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Development-Tools/15-SP1/x86_64/product/ SLE-Module-Development-Tools_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Development-Tools/15-SP1/x86_64/update/ SLE-Module-Development-Tools_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Legacy/15-SP1/x86_64/product/ SLE-Module-Legacy_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Legacy/15-SP1/x86_64/update/ SLE-Module-Legacy_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Packagehub-Subpackages/15-SP1/x86_64/product/ SLE-Module-Packagehub-Subpackages_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Packagehub-Subpackages/15-SP1/x86_64/update/ SLE-Module-Packagehub-Subpackages_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Server-Applications/15-SP1/x86_64/product/ SLE-Module-Server-Applications_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Server-Applications/15-SP1/x86_64/update/ SLE-Module-Server-Applications_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Product-SLES/15-SP1/x86_64/product/ SLE-Product-SLES-15-SP1_product \  
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Product-SLES/15-SP1/x86_64/update/ SLE-Product-SLES-15-SP1_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Product-SLES_SAP/15-SP1/x86_64/product/ SLE-Product-SLES_SAP_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Product-SLES_SAP/15-SP1/x86_64/update/ SLE-Product-SLES_SAP_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Public-Cloud/15-SP1/x86_64/product/ SLE-Module-Public-Cloud_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Public-Cloud/15-SP1/x86_64/update/ SLE-Module-Public-Cloud_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Web-Scripting/15-SP1/x86_64/product/ SLE-Module-Web-Scripting_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Web-Scripting/15-SP1/x86_64/update/ SLE-Module-Web-Scripting_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Product-HA/15-SP1/x86_64/product/ SLE-Product-HA_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Product-HA/15-SP1/x86_64/update/ SLE-Product-HA_update

# Update repos and install missing packages: 
RUN update-ca-certificates && zypper ref -s && zypper update -y

Build Image and run the container

Once Dockerfile created, we can build our base image with:

> docker build -t base_os .

SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

Now we can run our container and proceed with inside container operations:

> docker run -i –add-host=”saphost1.docker.sap.corp saphost1:172.17.0.2″ –ipc=host –privileged -t -h saphost1 base_os

SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

Prepare SAP HANA media

Ok, container is working fine and you can play inside.Once it is stopped, all changes will be erased. In order to play with SAP HANA installation, we should

1. Download SAP HANA distribs
2. Adjust them – delete none used folders
3. Add new layer in our docker file with SAP HANA distrib inside.

….  After we’ve finished with SAP HANA distribs download, we can delete unused folders inside SAP HANA extracted archive. We need only files inside our root SAP HANA archive and 2 folders inside DATA:

SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

Ok, greate! Now we should prepare SAP HANA for unattended installation, so we can put it in the image during build phase. Unattended installation how-to guide can be found here.

So now you should have the following things:

1. Adjusted SAP HANA media
2. SAP HANA config file – required for the unattended installation
3. SAP HANA password file – required during unattended installation

Adjust Dockerfile

I will add additional COPY layer inside my Dockerfile in order to copy required files inside our container:

# Copy Installation files and HANA config
COPY /tools/ /jail/

I have SAP HANA media and config files inside my tools folder, so I want to copy host folder tools to the image folder jail.

Ok, now we are rebuilding our image with this new COPY layer. Once it is done, you can run it and find out that required files are inside:

SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

Fine, we should try to execute SAP HANA installation in order to capture missing Linux packets (if there some). After we will identify all of them, we can adjust our Dockerfile.

Finalize Dockerfile

…. After several iterations, you will identify the list of required packets for SAP HANA installation, and now we can finalize our docker file by adding final RUN layer where will install all missing dependencies:

RUN zypper in --force-resolution -y -n -t pattern devel_basis \
 && zypper rm --force-resolution -y -n container-suseconnect \
 && zypper in --force-resolution -y -n bc \
 && zypper in --force-resolution -y -n chrony \
 && zypper in --force-resolution -y -n clamsap \
 && zypper in --force-resolution -y -n cryptctl \
 && zypper in --force-resolution -y -n expect \
 && zypper in --force-resolution -y -n libgtk-2_0-0 \
 && zypper in --force-resolution -y -n libicu60_2 \
 && zypper in --force-resolution -y -n libjpeg62 \
 && zypper in --force-resolution -y -n libpng12-0 \
 && zypper in --force-resolution -y -n libssh2-1 \
 && zypper in --force-resolution -y -n libyui-ncurses9 \
 && zypper in --force-resolution -y -n numactl \
 && zypper in --force-resolution -y -n patterns-sap-hana \
 && zypper in --force-resolution -y -n tcsh \
 && zypper in --force-resolution -y -n python3-six \
 && zypper in --force-resolution -y -n libpython3_6m1_0 \
 && zypper in --force-resolution -y -n saptune \
 && zypper in --force-resolution -y -n iputils

Ok, looks like all is inside, and now we can prepare our first base os image. Dockerfile will looks like this:

FROM registry.suse.com/suse/sle15:15.1

# Extra metadata Layer
LABEL version="1.0"
LABEL description="Base SLES 15 SP1 SAP image"

# Environmant Layer
ENV container docker \
 TERM=xterm \
 HOME=/root \
 LC_CTYPE=en_US \
 SHELL=/bin/bash

# Zypper and empty folder layer
RUN mkdir -p /etc/zypp \
 && mkdir -p /etc/zypp/repos.d \
 && mkdir -p /jail

# Add repsystem from SAP repo server: https://reposerver.cloud.com/suse/SUSE
RUN zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-SAP-Applications/15-SP1/x86_64/product/ SLE-Module-SAP-Applications_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-SAP-Applications/15-SP1/x86_64/update/ SLE-Module-SAP-Applications_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Basesystem/15-SP1/x86_64/product/ SLE-Module-Basesystem_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Basesystem/15-SP1/x86_64/update/ SLE-Module-Basesystem_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Containers/15-SP1/x86_64/product/ SLE-Module-Containers_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Containers/15-SP1/x86_64/update/ SLE-Module-Containers_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Development-Tools/15-SP1/x86_64/product/ SLE-Module-Development-Tools_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Development-Tools/15-SP1/x86_64/update/ SLE-Module-Development-Tools_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Legacy/15-SP1/x86_64/product/ SLE-Module-Legacy_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Legacy/15-SP1/x86_64/update/ SLE-Module-Legacy_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Packagehub-Subpackages/15-SP1/x86_64/product/ SLE-Module-Packagehub-Subpackages_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Packagehub-Subpackages/15-SP1/x86_64/update/ SLE-Module-Packagehub-Subpackages_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Server-Applications/15-SP1/x86_64/product/ SLE-Module-Server-Applications_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Server-Applications/15-SP1/x86_64/update/ SLE-Module-Server-Applications_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Product-SLES/15-SP1/x86_64/product/ SLE-Product-SLES-15-SP1_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Product-SLES/15-SP1/x86_64/update/ SLE-Product-SLES-15-SP1_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Product-SLES_SAP/15-SP1/x86_64/product/ SLE-Product-SLES_SAP_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Product-SLES_SAP/15-SP1/x86_64/update/ SLE-Product-SLES_SAP_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Public-Cloud/15-SP1/x86_64/product/ SLE-Module-Public-Cloud_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Public-Cloud/15-SP1/x86_64/update/ SLE-Module-Public-Cloud_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Module-Web-Scripting/15-SP1/x86_64/product/ SLE-Module-Web-Scripting_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Web-Scripting/15-SP1/x86_64/update/ SLE-Module-Web-Scripting_update \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Products/SLE-Product-HA/15-SP1/x86_64/product/ SLE-Product-HA_product \
 && zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Product-HA/15-SP1/x86_64/update/ SLE-Product-HA_update

# Update repos and install missing packages:
RUN zypper in --force-resolution -y -n -t pattern devel_basis \
 && zypper rm --force-resolution -y -n container-suseconnect \
 && zypper in --force-resolution -y -n bc \
 && zypper in --force-resolution -y -n chrony \
 && zypper in --force-resolution -y -n clamsap \
 && zypper in --force-resolution -y -n cryptctl \
 && zypper in --force-resolution -y -n expect \
 && zypper in --force-resolution -y -n libgtk-2_0-0 \
 && zypper in --force-resolution -y -n libicu60_2 \
 && zypper in --force-resolution -y -n libjpeg62 \
 && zypper in --force-resolution -y -n libpng12-0 \
 && zypper in --force-resolution -y -n libssh2-1 \
 && zypper in --force-resolution -y -n libyui-ncurses9 \
 && zypper in --force-resolution -y -n numactl \
 && zypper in --force-resolution -y -n patterns-sap-hana \
 && zypper in --force-resolution -y -n tcsh \
 && zypper in --force-resolution -y -n python3-six \
 && zypper in --force-resolution -y -n libpython3_6m1_0 \
 && zypper in --force-resolution -y -n saptune \
 && zypper in --force-resolution -y -n iputils

Ok, done, now you can build your base os image that we will use for the SAP HANA image creation.

docker build -t sap_sles .

SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

I am using private docker repository – jFrog to store my images, so I will push created image there:

SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

STEP 2: Building HANA_DB image


SAP HANA Docker file will be quite straightforward:

1. We will use FROM layer with our base os image that we created on previous step
2. We will create RUN layer with unattended SAP HANA installation.

Create Dockerfile

We will use one trick in the Dockerfile in order to bypass issue with hostname (by default, during build process, docker daemon will use dynamic hostname and this dynamic hostname will be used by SAP HANA installer. This we do not need). So we should pass hostname parameter on the same docker layer:

FROM mydocker.repo:8080/sap_sles:v2.0

# Some info regarding image
LABEL version="1.0" \
system.hostname="saphost1" \
system.HANA.sid="BFG"

# Create HOST environment
ENV HOSTNAME saphost1

# Copy Installation files and HANA config
COPY /tools/ /config/* /jail/
COPY /config/network/* /etc/

#  HANA installation is doing hostname check, however during build process dynamic hostname is generated # by docker. In order to bypass this we will pipeline hostname creation in the same Docker layer. This will # be rewrited by docker during starting og the image.
RUN echo $(grep $(hostname) /etc/hosts | cut -f1) saphost1 >> /etc/hosts && cat /jail/configfile.xml | /jail/HANA20SP4/DATA_UNITS/HDB_SERVER_LINUX_X86_64/hdblcm --sid=BFG --read_password_from_stdin=xml --configfile=/jail/configfile.cfg -b

This is it. Now you can build your image.

> docker build -t sap_hana .

Run SAP HANA Docker image

Now we can run our image. In order to make it possible to connect to the SAP HANA from outside we should expose network ports. So our command will look like this:

docker run -i -d –rm -e “container=docker” –add-host=”saphost1.docker.sap.corp saphost1:172.17.0.2″ –ipc=host –privileged -t -h saphost1 -p 30100-30199:30100-30199 -p 50100-50199:50100-50199 -p 1128:1128 -p 1129:1129 sap_hana:latest

With this command we are starting out container and we are exposing ports (-p key). With such way we can connect with SAP HANA studio once this container will be started.

SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

now we can connect to SAP HANA either via hdbsql inside container:

> hdbsql -n saphost1 -i 01 -d SystemDB -u SYSTEM -p yourpassword

SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

Or with SAP HANA studio outside. When you will use SAP HANA studio you should use your host ip, the one where docker installed, not 172.17.0.2 as this one belong to docker network.

SAP HANA 2.0, SAP HANA Study Materials, SAP HANA Tutorial and Material, SAP HANA Certifications, SAP HANA Prep

Great, we are done! Now you have HANA image that can be started in 2 – 3 minutes.

Afterwords


We did quite simple things in terms of docker. And much more things can be added inside that will simplify and automate other things. For example:

1. You can create custom script that will create test users for SAP HANA and will install SAP HANA license

2. You can automate SAP HANA start by putting start in the systemd in order to have your SAP HANA running once container is started

3. You can think on using Jenkins to automate docker build process.

No comments:

Post a Comment