The Bonita Docker container deployed by BCD can be further customized thanks to a custom initialization mechanism.
This feature relies on the ability to extend the [Bonita Docker image](https://hub.docker.com/_/bonita/) through custom `*.sh` shell scripts.
## Where should I put custom initialization scripts?
Custom initialization scripts must be placed in BCD's `roles/bonita/files/custom-init.d` folder. Each script to execute must have a `.sh` extension.
Here's the directory layout for a `replace-logo.sh` custom script:
```
roles
├── bonita
│ ├── files
│ │ ├── custom-init.d
│ │ │ ├── config-workers.sh
│ │ │ ├── login-logo.png
│ │ │ ├── logo.png
│ │ │ └── replace-logo.sh
```
## When are custom initialization scripts invoked?
Custom initialization scripts are invoked once the database has been initialized and the Tomcat server has been configured with [Bonita Platform setup tool](https://documentation.bonitasoft.com/?page=BonitaBPM_platform_setup).
Hence the Bonita Docker image startup sequence can be described as follows:
1. Initialize database: `setup.sh init`
1. Configure Tomcat server: `setup.sh configure`
1. Execute custom initialization `*.sh` scripts found in the container's `/opt/custom-init.d` folder
1. Start Tomcat server
::: info
**Warning**: all custom scripts are re-executed each time the Bonita Docker container is restarted.
If you want your script to be executed only once, you need to handle the conditional execution in your custom script itself.
## In which order are custom initialization scripts invoked?
Custom scripts are executed in natural sort order as implemented by the `ls` shell command. It is also referred as _natural sort of (version) numbers within text_.
More precisely scripts are executed in the order returned by this command: `ls -v /opt/custom-init.d/*.sh`.
## Examples
### config-workers.sh
Ths `config-workers.sh` script is provided as part of BCD's core scripts.
In particular it shows how to further configure the server using [Bonita Platform setup tool](https://documentation.bonitasoft.com/?page=BonitaBPM_platform_setup).
### replace-logo.sh
This sample script replaces the default logo images (login and header logos) in Bonita Portal.
ls-1 WEB-INF/classes/bonita-portal-theme*.zip | xargs -I{}-n1 zip -r{} skin
# repackage war
zip -r"${war_path}""WEB-INF/classes/bonita-portal-theme*.zip"
touch${indicator_path}
```
### activate-all-dynamic-checks.sh
This sample script activates all standard [REST API dynamic authorization rules](https://documentation.bonitasoft.com/?page=rest-api-authorization) to further secure Bonita REST API. These rules are meant to cover the most frequent cases.
This sample script deploys and registers a Bonita engine Event handler as described in [Event handlers Documentation](https://documentation.bonitasoft.com/?page=event-handlers).
Assuming the following files:
- roles/bonita/files/custom-init.d/event-handler-example-1.0.0-SNAPSHOT.jar (event handler JAR file)
- roles/bonita/files/custom-init.d/bonita-tenant-sp-custom.xml (tenant configuration file where the event handler is registered)
Here's a sample `register-event-handler.sh` script: