Running SAP HANA on Docker
De?erli arkada?lar?m, bu makaleyi SAP Community Forum'da ara?t?rarak buldum ve elimden geldi?ince Türk?e'ye k?salt?p sizlerle payla?mak istedim. Tabi ki bu süre?te GPT'yi de kulland?m. ??
Asl?nda, SAP BASIS dan??manlar? i?in HANA DB üzerinde test yapmak olduk?a ?nemli. A?a??daki ad?mlarla SAP HANA 2.0’? Docker üzerinde ?al??t?rarak büyük fayda sa?layaca??na inan?yorum.
Kurulum s?ras?nda biraz u?ra??yorsunuz, ancak tamamland???nda bir HANA DB test sisteminiz oluyor. ?? Ancak, Docker i?in Pro versiyonu kullanman?z gerekiyor ve bu ayl?k 7 dolara mal oluyor.
Ben yapt?m ve ?u anda bir HANA DB test makinem var. Tabi ki HANA lisans?n? da g?z ?nünde bulundurmal?y?z. ??
SAP HANA 2.0 i?in Docker konteynerinde ?al??t?rmak isteyebilece?iniz ad?mlar a?a??daki gibidir. ?nstalasyonu otomatikle?tirmek ve h?zl? bir da??t?m ortam? olu?turabilece?iniz ad?mlar ?unlard?r:
1. Gerekli Haz?rl?klar
Docker Kurulumu: Docker, bilgisayar?n?zda kurulu ve ?al???r durumda olmal?d?r. Nas?l kurulaca??n? incelemek i?in buraya t?klayabilirsiniz. SUSE Linux (SLES) Temel ?maj?: SUSE Linux Enterprise Server (SLES) i?in gereksinim duyulan imaj? indirme ba?lant?s? buradad?r. SAP HANA Medya Dosyalar?: Yükleme dosyalar?n? SAP’?n resmi web sayfas?ndan edinmelisiniz.
2. SAP HANA OS Temel ?maj?n? Olu?turma
Dockerfile: Dockerfile’? a?a??daki gibi olu?turun:
FROM registry.suse.com/suse/sle15:15.1
LABEL version="1.0"
LABEL description="Base SLES 15 SP1 SAP image"
RUN mkdir -p /etc/zypp/repos.d \
&& mkdir -p /jail \
&& zypper ar https://reposerver.cloud.com/suse/SLE-Module-SAP-Applications/15-SP1/x86_64/product/ SAP_Module \
&& zypper ref -s && zypper update -y
RUN zypper in -y glibc libstdc++ libaio libnuma1 patterns-sap-hana
Docker G?rüntüsü Olu?turma: Dockerfile'?n bulundu?u dizine gidip ?u komutu ?al??t?r?n:
docker build -t sap_sles .
3. SAP HANA ?maj?n? Olu?turma
Dockerfile’a Dosya Ekleyin: A?a??daki sat?r? Dockerfile’a ekleyin:
COPY ./sap_hana_installation_files /jail/
SAP HANA Otomatik Kurulum Komutu:
RUN /jail/HANA20SP4/DATA_UNITS/HDB_SERVER_LINUX_X86_64/hdblcm --sid=BFG --passwords-url=/jail/passwords.xml --configfile=/jail/configfile.cfg -b
?maj? Olu?turun:
docker build -t sap_hana .
4. SAP HANA Konteynerini ?al??t?rma
Konteyneri Ba?latma:
docker run -d --name hana_container -p 30100-30199:30100-30199 -p 1128:1128 sap_hana
5. SAP HANA’ya Eri?im
hdbsql Kullanarak:
hdbsql -n localhost -i 01 -d SystemDB -u SYSTEM -p password
SAP HANA Studio Kullanarak: Sunucu IP adresinizi ve gerekli portlar? kullanarak ba?lant? kurabilirsiniz.
6. ?yile?tirmeler
Bu ad?mlar? ger?ekle?tirerek SAP HANA 2.0 i?in Docker konteyneri i?inde ?al??an bir geli?tirme ortam? olu?turmu? olursunuz. Yard?ma ihtiyac?n?z varsa lütfen bildirin! ??
source:
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, and some?articles?on 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 :). 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. ABAP Part can be found via this?link
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:
?
? Such approach 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:
?
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:
?
Create Dockerfile
- Create base layer with?FROM?instruction
- 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/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
- 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/prod... SLE-Module-Packagehub-Subpackages_product \
?&& zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Packagehub-Subpackages/15-SP1/x86_64/updat... 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:
?
# 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/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/prod... SLE-Module-Packagehub-Subpackages_product \
?&& zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Packagehub-Subpackages/15-SP1/x86_64/updat... 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 .
Now we can?run?our container and proceed with inside container operations:
> docker run -i --add-host="saphost1.docker.gap.corp saphost1:172.17.0.2" --ipc=host --privileged -t -h saphost1 base_os
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: ? 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:
?
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: 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:
?
# 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/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/prod... SLE-Module-Packagehub-Subpackages_product \
?&& zypper ar https://reposerver.cloud.com/suse/SUSE/Updates/SLE-Module-Packagehub-Subpackages/15-SP1/x86_64/updat... 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 .
I am using private docker repository - jFrog to store my images, so I will push created image there:
STEP 2: Building HANA_DB image
SAP HANA Docker file will be quite straightforward:
?
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.gap.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. now we can connect to SAP HANA either via hdbsql inside container:
> hdbsql -n saphost1 -i 01 -d SystemDB -u SYSTEM -p yourpassword
? 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. ? 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:
?
As next step I will think on creating SAP ABAP application part (maybe SAP S/4 HANA 1909) with?abapGit?or?gCTS?in the container, so we can get development infrastructure on demand with GiT as version control system, this will enable us with possibility to do ф parallel development in ABAP, and will move us slightly to the CI\CD