Skip to Content
Technical Articles
Author's profile photo Giridharan Ravisankar

HANA Cockpit on Docker Container

HANA cockpit is a mandatory HANA DB administration tool to be used going forward in all organizations. And every company will have an additional task to implement HANA cockpit to administrate HANA instances.

So thinking about simplifying HANA cockpit implementation with minimal effort and cost, some idea came up in my mind and i would like to share with you all what i have achieved.

Have imagined and achieved the implementation via Docker Container.

Objective

Build a docker image with automated HANA cockpit installation using my GitHub repository and create a HANA cockpit docker image to run HANA cockpit containers in one go.

 

System Requirements

Memory: 24GB Minimum
CPU: 4 Minimum
HDD: 80GB
Host OS: Any OS which can run docker engine
Docker engine version 19.0+

Instructions

  1. Download the latest HANA cockpit installer from SAP support website. The file name will look like “SAPHANACOCKPIT11_11-70002299.SAR”. Also download SAPCAR for extracting the .SAR file.
  2. Install git to your windows/mac desktop or any other Linux machine where docker engine is up and running.  Please refer this link for Git installation steps. If you don’t have a running Docker engine installed please refer to the link on how to install Docker for your windows/mac/Linux.
  3. Next clone the GitHub repository to a local directory using a Linux terminal or windows PowerShell “git clone https://github.com/girid333/hckptoncont.git
    #>git clone https://github.com/girid333/hckptoncont.git​
  4. A folder with name “hckptoncont” will be created.
  5. Perform “cd hckptoncont” and you can see Dockerfile and a folder with name sapdownloads inside hckptoncont folder.
    #>cd hckptoncont​
  6. Extract the downloaded HANA cockpit .SAR file into sapdownloads folder (ex:- SAPCAR -xvf SAPHANACOCKPIT11_11-70002299.SAR -R …/hckptoncont/sapdownloads)
    SAPCAR -xvf SAPHANACOCKPIT11_11-70002299.SAR -R .../hckptoncont/sapdownloads​
  7. From hckptoncont folder execute “docker build -t hanackpt:2.0 .
    #>docker build -t hanackpt:2.0 .​
  8. Wait until build is over with image name “hanackpt:2.0“, then the image with HANA cockpit installed is ready for use. (it may take upto 4-6 hours approximately based on the hardware)
  9. Next we can run a docker container using our built image “docker run -p 8000:8000 -p 443:443 -p 3300-3399:3300-3399 -p 3200-3299:3200-3299 -p 51020-51040:51020-51040 -p 39015:39015 -p 39032:39032 -h hckptn01 –name hckptn1 -it hanackpt:2.0 /bin/bash
    #>docker run -p 8000:8000 -p 443:443 -p 3300-3399:3300-3399 -p 3200-3299:3200-3299 -p 51020-51040:51020-51040 -p 39015:39015 -p 39032:39032 -h hckptn01 --name hckptn1 -it hanackpt:2.0 /bin/bash​
  10. Once container is up and running with above command it will login to container guest shell. From there switch to user h4cadm with “su – h4cadm
    #hckpnt01>su - h4cadm​
  11. Now start HANA database with command “HDB start” wait untill HANA gets started. (First time HANA startup may fail without any reason, wait for 15 mins and perform graceful stop “HDB stop“. Once all process stopped, then start HANA DB again, it will start.)
    #h4cadm@hckpnt01>HDB start​
  12. Once HANA is up and running check “HDB info“for the HANA process status and wait for 15-20 mins for XS apps to get started.
  13. #h4cadm@hckpnt01>HDB info
  14. Then we can Launch SAP HANA cockpit manager by opening the url from browser https://hckptn01:51029 (or with actual port that gets displayed during build) , use XSA_ADMIN as user and the password (can be found in the hana install config-file under sapdownloads of git clone) for login. Note:- Need to add host entry for hckptn01 with docker host ipaddress from where url is called.
  15. We have to setup user roles during first login then we can add resource for HANA cockpit administration. (Even we can add the same HANA cockpit DB for example)
  16. Once required HANA DB resource is added then Launch SAP HANA cockpit administration launchpad by opening url in browser https://hckptn01:51027 (or the port that gets displayed during build)

!!!! Kudos enjoy !!!!!

Additional Instructions for advanced users

If you want to modify hostname, password, SID and instance number based on your needs then you should to adjust the values  in Docker file from the main folder and h4c_config file from inside sapdownloads folder by searching existing value and replace it with your desired values.

 

Before conclusion

Once you are done using HANA cockpit and Docker, just remember to stop the HANA database gracefully with “HDB stop” command and exit the container.

#h4cadm@hckpnt01>HDB stop
#hckpnt01>exit

Next time you want to continue just start the container with “docker start -i hckptn1” and start HANA with h4cadm using command “HDB start”.

#>docker start -i hckptn1

…and check in HANA logs if there is any startup issue.

 

Will do more research on the containers topic and stay tuned for more exiting results.

–Giridharan

 

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Venkatesan Kumarasamy
      Venkatesan Kumarasamy

      Nice one Giri !

      Author's profile photo Mohit Chhikara
      Mohit Chhikara

      Hi I am getting below error for this:

      Cannot resolve host name 'hckptn01'

      xecutor failed running [/bin/sh -c echo "$(hostname -I | awk '{print $1}') hckptn01" >> /etc/hosts | ./hdblcm.sh --action=install --configfile=/tmp/sapdownloads/h4c_config -b; su - h4cadm -c "HDB stop"; rm -rf /hana/shared/H4C/xs/app_working/stager; su - h4cadm -c "mkdir /hana/shared/H4C/xs/app_working/stager"]: exit code: 1

       

      Any suggestions for fixing it.

      Regards,

      Mohit.

      Author's profile photo Giridharan Ravisankar
      Giridharan Ravisankar
      Blog Post Author

      Hi Mohit,

       

      In the docker file the last RUN command has the logic to capture the current host IP and set it to resolve hostname of hckptn01 and append the entry into /etc/hosts file.

      As a workaround if you know the IP address of your host then copy the IP address and replace the last RUN entry in dockerfile like the example below and then run again it should work.

      RUN 192.168.1.112 hckptn01" >> /etc/hosts | ./hdblcm.sh --action=install --configfile=/tmp/sapdownloads/h4c_config -b; su - h4cadm -c "HDB stop"; rm -rf /hana/shared/H4C/xs/app_working/stager; su - h4cadm -c "mkdir /hana/shared/H4C/xs/app_working/stager"

      Author's profile photo Mohit Chhikara
      Mohit Chhikara

      Hi Giri,

       

      Thanks for your reply I tried it by giving my ip dirrectly and building the image still same issue.

      RUN 192.168.179.23 >> /etc/hosts | ./hdblcm.sh --action=install --configfile=/tmp/sapdownloads/h4c_config -b; su - h4cadm -c "HDB stop"; rm -rf /hana/shared/H4C/xs/app_working/stager; su - h4cadm -c "mkdir /hana/shared/H4C/xs/app_working/stager"
      But still getting same issue any more suggestions in this regards.
      Regards,
      Mohit.
      Author's profile photo Giridharan Ravisankar
      Giridharan Ravisankar
      Blog Post Author

      Hi Mohit,

      you still missed to add the hosts file entry properly. Please update the line exactly as below it should work.

       

      RUN echo "192.168.179.23 hckptn01" >> /etc/hosts | ./hdblcm.sh --action=install --configfile=/tmp/sapdownloads/h4c_config -b; su - h4cadm -c "HDB stop"; rm -rf /hana/shared/H4C/xs/app_working/stager; su - h4cadm -c "mkdir /hana/shared/H4C/xs/app_working/stager"

      Author's profile photo Declan McArdle
      Declan McArdle

      Nice - worked fine.  Build time 51 mins.

      One small issue reported on the Github issues page.