#!/bin/bash # any command returning non-zero, should end this script set -e # cycle through *.sh in `opt/containerd` in alphabetical order; executing each one CONTAINERD_FILES=( /opt/containerd/*.sh ) if (( ${#CONTAINERD_FILES[@]} > 1 )); then for (( CONTAINERD_FILEINDEX = 0; CONTAINERD_FILEINDEX < ${#CONTAINERD_FILES[@]}; CONTAINERD_FILEINDEX++ )); do CONTAINERD_FILE=${CONTAINERD_FILES[${CONTAINERD_FILEINDEX}]} if [[ ${CONTAINERD_FILE} != "/opt/containerd/entrypoint.sh" ]]; then echo "Executing entrypoint: ${CONTAINERD_FILE}" . ${CONTAINERD_FILE} fi done fi # if there are arguments to the entrypoint, execute them to finish # like a server startup command if (( $# > 0 )); then echo "Executing entrypoint ..." exec "$@" fi