diff --git a/README.md b/README.md index 89d9616c2..31531767b 100644 --- a/README.md +++ b/README.md @@ -216,7 +216,7 @@ To use the hooks triggered by the `entrypoint` script, either - Added your script(s) to the individual of the hook folder(s), which are located at the path `/docker-entrypoint-hooks.d` in the container - Use volume(s) if you want to use script from the host system inside the container, see example. -**Note:** Only the script(s) ending with `.sh` and marked as executable will be executed. +**Note:** Only the script(s) located in a hook folder (not sub-folders), ending with `.sh` and marked as executable, will be executed. **Example:** Mount using volumes ```yaml diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 51c68a075..71fc03bb7 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -27,14 +27,13 @@ run_path() { echo "=> Searching for scripts (*.sh) to run in the folder: ${hook_folder_path}" ( - cd "${hook_folder_path}" - find . -type f -iname '*.sh' -print | sort | while read script_file_path; do + for script_file_path in "${hook_folder_path}/"*.sh; do if ! [ -x "${script_file_path}" ] && [ -f "${script_file_path}" ]; then echo "==> The script \"${script_file_path}\" in the folder \"${hook_folder_path}\" was skipping, because it didn't have the executable flag" continue fi - echo "==> Running the script: \"${script_file_path}\"" + echo "==> Running the script (cwd: $(pwd)): \"${script_file_path}\"" run_as "${script_file_path}" || return_code="$?"