Run clickhouse-server in exec form

This commit is contained in:
Elghazal Ahmed 2018-11-26 00:26:48 +00:00 committed by proller
parent a7d75c527b
commit 0dd5777c1c
2 changed files with 8 additions and 3 deletions

View File

@ -39,4 +39,3 @@ ENV CLICKHOUSE_CONFIG /etc/clickhouse-server/config.xml
ENTRYPOINT ["/entrypoint.sh"]
CMD /usr/bin/clickhouse-server --config=${CLICKHOUSE_CONFIG}

View File

@ -30,5 +30,11 @@ chown -R $USER:$GROUP \
"$TMP_DIR" \
"$USER_PATH"
# execute CMD
exec gosu clickhouse "$@"
# if no args passed to `docker run` or first argument start with `--`, then the user is passing clickhouse-server arguments
if [[ $# -lt 1 ]] || [[ "$1" == "--"* ]]; then
exec gosu clickhouse /usr/bin/clickhouse-server --config-file=$CLICKHOUSE_CONFIG "$@"
fi
# Otherwise, we assume the user want to run his own process, for example a `bash` shell to explore this image
exec "$@"