I am trying to pass extra parameters from a container to the contained application. The following bash script is working to pass extra variables, but I'm not sure that it's optimal, or a standard method for running a containerized application. Any insight would be appreciated.
#!/bin/bash
# allow arguments to be passed to dnsmasq
if [[ ${1:0:1} = '-' ]]; then
EXTRA_ARGS="$@"
set --
elif [[ ${1} == dnsmasq || ${1} == $(which dnsmasq) ]]; then
EXTRA_ARGS="${@:2}"
set --
fi
# default behaviour is to launch dnsmasq
if [[ -z ${1} ]]; then
echo "Starting dnsmasq..."
exec $(which dnsmasq) --log-facility=- --keep-in-foreground --no-resolv --no-hosts --strict-order ${EXTRA_ARGS}
else
exec "$@"
fi