2020-10-28 12:58:38 +00:00
|
|
|
FROM alpine
|
|
|
|
|
|
|
|
ENV LANG=en_US.UTF-8 \
|
|
|
|
LANGUAGE=en_US:en \
|
|
|
|
LC_ALL=en_US.UTF-8 \
|
|
|
|
TZ=UTC \
|
|
|
|
CLICKHOUSE_CONFIG=/etc/clickhouse-server/config.xml
|
|
|
|
|
|
|
|
COPY alpine-root/ /
|
|
|
|
|
2021-01-15 17:59:12 +00:00
|
|
|
# user/group precreated explicitly with fixed uid/gid on purpose.
|
|
|
|
# It is especially important for rootless containers: in that case entrypoint
|
|
|
|
# can't do chown and owners of mounted volumes should be configured externally.
|
|
|
|
# We do that in advance at the begining of Dockerfile before any packages will be
|
|
|
|
# installed to prevent picking those uid / gid by some unrelated software.
|
|
|
|
# The same uid / gid (101) is used both for alpine and ubuntu.
|
|
|
|
|
2021-01-14 22:37:27 +00:00
|
|
|
RUN addgroup -S -g 101 clickhouse \
|
|
|
|
&& adduser -S -h /var/lib/clickhouse -s /bin/bash -G clickhouse -g "ClickHouse server" -u 101 clickhouse \
|
2021-01-21 17:25:09 +00:00
|
|
|
&& mkdir -p /var/lib/clickhouse /var/log/clickhouse-server /etc/clickhouse-server /etc/clickhouse-client \
|
2020-10-28 12:58:38 +00:00
|
|
|
&& chown clickhouse:clickhouse /var/lib/clickhouse \
|
|
|
|
&& chown root:clickhouse /var/log/clickhouse-server \
|
|
|
|
&& chmod +x /entrypoint.sh \
|
2021-03-23 09:21:51 +00:00
|
|
|
&& apk add --no-cache su-exec bash tzdata \
|
2021-03-23 10:48:28 +00:00
|
|
|
&& cp /usr/share/zoneinfo/UTC /etc/localtime \
|
|
|
|
&& echo "UTC" > /etc/timezone \
|
2021-01-21 17:25:09 +00:00
|
|
|
&& chmod ugo+Xrw -R /var/lib/clickhouse /var/log/clickhouse-server /etc/clickhouse-server /etc/clickhouse-client
|
|
|
|
|
2021-01-22 14:28:36 +00:00
|
|
|
# we need to allow "others" access to clickhouse folder, because docker container
|
2021-01-21 17:25:09 +00:00
|
|
|
# can be started with arbitrary uid (openshift usecase)
|
2020-10-28 12:58:38 +00:00
|
|
|
|
|
|
|
EXPOSE 9000 8123 9009
|
|
|
|
|
|
|
|
VOLUME /var/lib/clickhouse \
|
|
|
|
/var/log/clickhouse-server
|
|
|
|
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|