diff --git a/docker/server/Dockerfile b/docker/server/Dockerfile index 3cec94b3c66..3528ae68ef6 100644 --- a/docker/server/Dockerfile +++ b/docker/server/Dockerfile @@ -10,7 +10,6 @@ ARG gosu_ver=1.10 # 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 RUN groupadd -r clickhouse --gid=101 \ && useradd -r -g clickhouse --uid=101 --home-dir=/var/lib/clickhouse --shell=/bin/bash clickhouse \ @@ -37,7 +36,12 @@ RUN groupadd -r clickhouse --gid=101 \ /var/lib/apt/lists/* \ /var/cache/debconf \ /tmp/* \ - && apt-get clean + && apt-get clean \ + && mkdir -p /var/lib/clickhouse /var/log/clickhouse-server /etc/clickhouse-server /etc/clickhouse-client \ + && chmod ugo+Xrw -R /var/lib/clickhouse /var/log/clickhouse-server /etc/clickhouse-server /etc/clickhouse-client + +# we need to allow "others" access to clickhouse folder, because docker container +# can be started with arbitrary uid (openshift usecase) ADD https://github.com/tianon/gosu/releases/download/$gosu_ver/gosu-amd64 /bin/gosu diff --git a/docker/server/Dockerfile.alpine b/docker/server/Dockerfile.alpine index 090e20edab8..0f9de1996ab 100644 --- a/docker/server/Dockerfile.alpine +++ b/docker/server/Dockerfile.alpine @@ -14,16 +14,18 @@ COPY alpine-root/ / # 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 RUN addgroup -S -g 101 clickhouse \ && adduser -S -h /var/lib/clickhouse -s /bin/bash -G clickhouse -g "ClickHouse server" -u 101 clickhouse \ + && mkdir -p /var/lib/clickhouse /var/log/clickhouse-server /etc/clickhouse-server /etc/clickhouse-client \ && 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 + && apk add --no-cache su-exec bash \ + && chmod ugo+Xrw -R /var/lib/clickhouse /var/log/clickhouse-server /etc/clickhouse-server /etc/clickhouse-client + +# we need to allow "others" access to clickhouse folder, because docker container +# can be started with arbitrary uid (openshift usecase) EXPOSE 9000 8123 9009