/bin/sh: 1: clickhouse: 不允许操作

/bin/sh: 1: clickhouse: Operation not permitted

我正在为版本 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

默认-password.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
如果您想阅读更多内容,

An issue 已记录在 Clickhouse 存储库中。