尝试将Clickhouse堆栈部署到docker swarm并出现错误:Service Builder生成失败:COPY失败

时间:2019-09-02 05:23:14

标签: docker docker-compose dockerfile clickhouse

在学习docker swarm的过程中,目前有一个三节点nuc安装程序在Ubuntu 16.04上运行docker swarm。我希望使用以下官方图片构建一个2节点Clickhouse集群:

https://hub.docker.com/r/yandex/clickhouse-server/dockerfile

我可以轻松地在一个节点上将其作为映像运行,但是我试图将docker映像部署到2个节点上,以便可以使用以下文档从那里构建集群:

https://docs.docker.com/engine/swarm/stack-deploy/

但是运行docker-compose up -d时出现以下错误:

ERROR: Service 'builder' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder795701575/docker_related_config.xml: no such file or directory

目录图:

my_app
----docker-compose.yml
----docker
-------client
-------server
-------builder
            --Dockerfile

Dockerfile: https://hub.docker.com/r/yandex/clickhouse-server/dockerfile

FROM ubuntu:18.04

ARG repository="deb http://repo.yandex.ru/clickhouse/deb/stable/ main/"
ARG version=19.1.13
ARG gosu_ver=1.10

RUN apt-get update \
    && apt-get install --yes --no-install-recommends \
        apt-transport-https \
        dirmngr \
        gnupg \
    && mkdir -p /etc/apt/sources.list.d \
    && apt-key adv --keyserver keyserver.ubuntu.com --recv E0C56BD4 \
    && echo $repository > /etc/apt/sources.list.d/clickhouse.list \
    && apt-get update \
    && env DEBIAN_FRONTEND=noninteractive \
        apt-get install --allow-unauthenticated --yes --no-install-recommends \
            clickhouse-common-static=$version \
            clickhouse-client=$version \
            clickhouse-server=$version \
            libgcc-7-dev \
            locales \
            tzdata \
            wget \
    && rm -rf \
        /var/lib/apt/lists/* \
        /var/cache/debconf \
        /tmp/* \
    && apt-get clean

ADD https://github.com/tianon/gosu/releases/download/1.10/gosu-amd64 /bin/gosu

RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

RUN mkdir /docker-entrypoint-initdb.d

COPY docker_related_config.xml /etc/clickhouse-server/config.d/
COPY entrypoint.sh /entrypoint.sh

RUN chmod +x \
    /entrypoint.sh \
    /bin/gosu

EXPOSE 9000 8123 9009
VOLUME /var/lib/clickhouse

ENV CLICKHOUSE_CONFIG /etc/clickhouse-server/config.xml

ENTRYPOINT ["/entrypoint.sh"]

docker-compose.yml https://github.com/yandex/ClickHouse/blob/master/docker-compose.yml

version: "2"

services:
  builder:
    image: yandex/clickhouse-builder
    build: docker/builder
  client:
    image: yandex/clickhouse-client
    build: docker/client
    command: ['--host', 'server']
  server:
    image: yandex/clickhouse-server
    build: docker/server
    ports:
      - 8123:8123

我处理方法有误吗?感谢您的帮助。

更新

尝试使用评论解决方案,但不起作用:

ERROR: Service 'builder' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder511288209/docker_related_config.xml: no such file or directory

1 个答案:

答案 0 :(得分:1)

查看该项目的Github存储库,然后尝试从那里构建它:https://github.com/yandex/ClickHouse/tree/master/docker/server

不仅要复制Dockerfile,还要克隆项目并从那里构建它。