我正在为21.8.11.4版本创建Clickhouse docker镜像,Dockerfile成功构建,但当我尝试使用docker run <imagename>
命令运行它时,它显示/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
默认密码.xml
<yandex>
<users>
<default>
<password remove='1' />
<password_sha256_hex>ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad</password_sha256_hex>
</default>
</users>
</yandex>
命令:
$docker build -t clickhouse-server:21.8.11.4 .
$docker run clickhouse-server:21.8.11.4
这不起作用,因为clickhouse需要文件系统权限,而当您使用docker run <image-name>
运行docker映像时,这些权限不会被授予
如果你想运行你的图像,你可能可以使用:
docker run --cap-add=SYS_NICE --cap-add=NET_ADMIN --cap-add=IPC_LOCK clickhouse-server:21.8.11.4
如果您想了解更多信息,Clickhouse存储库中已记录了一个与此相关的问题。