Reputation: 591
I am creating Clickhouse docker image for version 21.8.11.4, Dockerfile gets build successfully but when I tried to run it using docker run <imagename>
command, it says /bin/sh: 1: exec: /usr/bin/clickhouse-server: Operation not permitted
Dockerfile:
FROM ubuntu:20.04
ENV CH_VERSION 21.8.11.4
COPY default-password.xml /etc/clickhouse-server/users.d/default-password.xml
RUN apt-get update
RUN apt-get install --yes --no-install-recommends apt-transport-https apt-utils dirmngr gnupg
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv E0C56BD4
RUN echo "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" | tee /etc/apt/sources.list.d/clickhouse.list
RUN apt-get update
RUN apt-get install --allow-unauthenticated -y clickhouse-client=${CH_VERSION} clickhouse-server=${CH_VERSION} clickhouse-common-static=${CH_VERSION} libgcc-7-dev tzdata libreadline-dev curl
RUN rm -rf /var/lib/apt/lists/* /var/cache/debconf /tmp/*
RUN apt-get clean
VOLUME /var/lib/clickhouse
EXPOSE 9000 8123 9009
ENTRYPOINT exec /usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml
default-password.xml
<yandex>
<users>
<default>
<password remove='1' />
<password_sha256_hex>ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad</password_sha256_hex>
</default>
</users>
</yandex>
Commands:
$docker build -t clickhouse-server:21.8.11.4 .
$docker run clickhouse-server:21.8.11.4
Upvotes: 0
Views: 2132
Reputation: 2063
This doesn't work because clickhouse requires filesystem privileges that aren't granted when you run a docker image using docker run <image-name>
If you want to run your image you could probably do it with:
docker run --cap-add=SYS_NICE --cap-add=NET_ADMIN --cap-add=IPC_LOCK clickhouse-server:21.8.11.4
An issue has been recorded on the Clickhouse repository regarding this if you want to read more.
Upvotes: 2