mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
0d23f3f16a
Explicitly set uid / gid of clickhouse user & group to the fixed values 101. 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. Number 101 is used by default in openshift, and was used by all clickhouse-server docker images before 20.10. In 20.11 it was changed (by accident) to 999.
27 lines
791 B
Docker
27 lines
791 B
Docker
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/ /
|
|
|
|
# user/group precreated explicitly with fixed uid/gid on purpose (see commit)
|
|
RUN addgroup -S -g 101 clickhouse \
|
|
&& adduser -S -h /var/lib/clickhouse -s /bin/bash -G clickhouse -g "ClickHouse server" -u 101 clickhouse \
|
|
&& chown clickhouse:clickhouse /var/lib/clickhouse \
|
|
&& chmod 700 /var/lib/clickhouse \
|
|
&& chown root:clickhouse /var/log/clickhouse-server \
|
|
&& chmod 775 /var/log/clickhouse-server \
|
|
&& chmod +x /entrypoint.sh \
|
|
&& apk add --no-cache su-exec bash
|
|
|
|
EXPOSE 9000 8123 9009
|
|
|
|
VOLUME /var/lib/clickhouse \
|
|
/var/log/clickhouse-server
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|