Skip to Content
Technical Articles
Author's profile photo Andre Fischer

How to gracefully shutdown your SAP ABAP Platform Developer Edition when shutting down Windows


Docker does only wait 10 seconds

As announced by the blog SAP ABAP Platform 1909, Developer Edition: AVAILABLE NOW of my colleague Julie Plummer the new ABAP Platform developer edition is available as a Docker image so that you can run it on your laptop.

Running it on you laptop does also mean that you are responsible for it and that you have to make sure to shutdown the system in a proper way.

Unfortunately Docker only waits up to 10 seconds for a container to stop before it kills the process which will then result in an inconsistent HANA DB 😒.

This happened to me on the very first day as a ABAP Platform developer edition user 😥.

As mentioned in the setup instructions of the ABAP platform docker image in order to gracefully shutdown your docker image you should run the following command before stopping docker or shutting down your laptop.

docker stop --time 7200 a4h

So if you just shutdown your laptop (as I did) without having run the above mentioned command beforehand you have a problem …

If this happens to you, you only have to delete the container using Docker Desktop and recreate it using the following command

docker run --stop-timeout 3600 -i --name a4h -h vhcala4hci -p 3200:3200 -p 3300:3300
-p 8443:8443 -p 30213:30213 -p 50000:50000 -p 50001:50001 store/saplabs/abaptrial:1909
-skip-limits-check -agree-to-sap-license

So you fortunately don’t have to download the whole image again 😅.

However all the ABAP development you have done might be lost if you haven’t saved it to some Git repository.

Gracefully shutdown docker container using Group Policy Editor

Reading through the setup instructions I was wondering whether there is a way to run the command as a script automatically when shutting down Windows because I know myself and I was sure that I would otherwise run into this problem again and again.

As described in this answer posted on Stackoverflow it is possible to do the following:

  1. Run gpedit.msc to open the Group Policy Editor
  2. Navigate to Computer Configuration | Windows Settings | Scripts (Startup/Shutdown).
  3. Double click on Shutdown


Local Group Policy Editor (Picture taken from above mentioned answer in Stackoverflow)

This will open a dialogue to select a script from a location of your choice. The default location (administrative access is needed) is the following folder


Here I have created the script stop_docker.cmd



The source code of this script is shown here


set MyDir="C:\temp"
IF not exist %MyDir% ( mkdir %MyDir% )
echo stopping instance a4h %date% %time% >> %MyDir%\docker_stop.txt
docker stop --time 7200 a4h 1>> %MyDir%\docker_stop.txt 2>>&1
echo instance a4h stopped %date% %time% >> %MyDir%\docker_stop.txt


The script first checks if the directory C:\temp does exist. If not, it will create it. Afterwards the system date and system time will be read from environment variables and are added to the log file docker_stop.txt and your docker container a4h will be safely stopped using the command docker stop –time 7200 a4h.

This provides up to 7200 seconds for SAP HANA to safely shut down.

Checking the log file

When you run the script manually from a cmd box (be sure to use the option Run as Administrator because the folder where the script resides can only accessed with administrative rights) you will find that a file docker_stop.txt has been created in the specified folder (here C:\temp).


Here you then find entries like the following:

  1. stopping instance a4h 05.03.2021 12:49:34,09
    error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/a4h/stop?t=7200: open //./pipe/docker_engine: The system cannot find the file specified.
    instance a4h stopped 05.03.2021 12:49:34,35
  2. stopping instance a4h 05.03.2021 12:50:27,80
    Error response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file specified.
    instance a4h stopped 05.03.2021 12:50:28,11
  3. stopping instance a4h 05.03.2021 12:51:00,26
    instance a4h stopped 05.03.2021 12:51:00,54
  4. stopping instance a4h 05.03.2021 12:59:44,81
    instance a4h stopped 05.03.2021 13:00:55,96

which have been created as follows:

  1. Entries like the first one you will find if Docker Desktop has not been started.
  2. The second type of entries you will find when run the script docker_stop.cmd but Docker Desktop is still starting.
  3. The third type of entries that shows a very fast shutdown you will find when Docker is running but when your instance A4H has not been started yet.
  4. The fourth entry is finally the one that shows the graceful shutdown of a running SAP ABAP platform docker instance.
    As you can see the shutdown will take more than 60 seconds.

So we notice that the shutdown of your windows machine will not be postponed for the 7200 seconds but only for the time it takes to gracefully shutdown the docker instance of your SAP ABAP platform installation.


Putting a script on my desktop to start the SAP ABAP developer edition

Last not least I put a script start_a4.cmd on my desktop that only contains the following command.

docker start -ai a4h

so that I can conveniently start the container of my SAP ABAP developer edition.

When using the script wait until you see the line *** Have fun! ***  before trying to log on to your SAP ABAP developer edition.


When you use the script stop_docker.cmd to gracefully shut down your docker image you will see in this command box the output of the shut down procedure starting with the output

My termination has been requested


In principle it would also be possible to put this script into the folder


and schedule the docker container to start automatically each time you start your laptop, but since the docker image consumes quite some resources I refrained from doing so.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Andrea Borgia
      Andrea Borgia

      Prevention is always a good thing! I should find out the systemd equivalent.

      I have a question, though: is there a way to recover the DB without restarting from scratch? Something like fsck, but for the DB.

      Rationale: I've had a couple of crashes while the "AS ABAP 7.52SP04" VM was running but apparently no major damage occurred; was it simply luck or is it that Sybase is more forgiving?


      Author's profile photo Uwe Fetzer
      Uwe Fetzer

      Sybase ASE is indeed more forgiving. The older Developer Edition on MaxDB would even survive a nuclear attack.

      The HANA DB is an in-memory DB, so all the changes made on the DB must be written to the disk before the system can be shut down else the database has an inconsistent state and probably can't be recovered.

      Author's profile photo Fabian Lupa
      Fabian Lupa

      The HANA DB is an in-memory DB, so all the changes made on the DB must be written to the disk before the system can be shut down else the database has an inconsistent state and probably can't be recovered.

      I would assume a hard shutdown is somewhat comparable to the power outage scenario. Which should just result in loading the last persisted snapshot from disk into memory on restart and executing the transaction log since the snapshot timestamp, which should also have been synchronously persisted with every transaction. Resulting in ideally no data loss?

      Unless of course the crash causes corruption in the persistence layer of the VM or docker environment itself.

      Author's profile photo Uwe Fetzer
      Uwe Fetzer

      I don't think that a power outage is the problem (you probably can turn off the PC and the Edition should come up again), but the hard stop during the shutdown phase. The drive is hard working a couple of minutes at 100% during this phase.

      Author's profile photo Denis Galand
      Denis Galand

      Very nice, thank you Andre Fischer

      There is one thing i would like to automate but I don't know how, to start the cloud connector automatically when A4H is instanciated, is it possible?

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      That would be a question for our LINUX experts. But I would be surprised to hear if that would not be possible.


      Author's profile photo Jakub Filak
      Jakub Filak

      Well, that's no supported yet but I can add such a feature to the init process. I was not sure if anyone will use the cloud connector at all.

      Author's profile photo Declan McArdle
      Declan McArdle


      /opt/sap/scc/ start

      to the line after:

      sapcontrol -nr 0 -function Start

      (or wherever docker starts the ABAP engine from...)

      Author's profile photo Alban Leong
      Alban Leong

      Absolutely loving this Developer Edition!

      I'm running Docker Desktop with WSL2 and I like how simple it is that I can just use the "Start" and "Stop" button and it does gracefully start and stop the instance.


      Stop ABAP 1909 container


      Gracefully shutsdown

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      But you have to do it manually ;-).

      Author's profile photo Alban Leong
      Alban Leong

      Oh yeah - /agree~ I do like your automated approach for the times that I might be in a hurry and forget to hit that "Stop" button!

      Author's profile photo Andrea Borgia
      Andrea Borgia

      In case anyone is running Docker under Linux, here is the equivalent systemd unit file:

      Description=A4H - SAP HANA 1909 container
      ExecStop=/usr/bin/docker stop -t 3600 a4h

      To activate, as root:

      1. save to /etc/systemd/system/a4h.service
      2. systemctl daemon-reload
      3. systemctl enable a4h.service --now

      It is also possible to have it start automatically on boot, either by changing ExecStart or setting "Always" as container restart policy