Clean up on Docker shutdown

There may be times that you’d need to clean up resources such as temporary files or in my case deregister a container from a WebSphere Liberty Collective. To set this up, we just need to use `trap` on `bash` to handle any cleanup. This will also work with `docker-compose.yml` built stacks and `replica`s.

The skeleton of the start up script (e.g. `start.sh`) would be as follows

#!/bin/bash

cleanupFunction() {
   …
   exit
}
trap cleanupFunction 0

myNormalDaemonProcess &

wait

`DockerFile` just needs to `COPY` the script and set it as the `CMD`. There is no need for an `ENTRYPOINT` nor use `tini` nor use `–init`. Simply

COPY script.sh /
CMD "/script.sh"