0
votes

I try start a docker-container, but I have a error:

ERROR: Service 'client' failed to build: The command '/bin/sh -c 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-client=$version clickhouse-common-static=$version locales tzdata && rm -rf /var/lib/apt/lists/* /var/cache/debconf && apt-get clean' returned a non-zero code: 2

My dockerfile:

    FROM ubuntu:18.04

ARG repository="deb http://repo.yandex.ru/clickhouse/deb/stable/ main/"
ARG version=19.*

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-client=$version \
            clickhouse-common-static=$version \
            locales \
            tzdata \
    && rm -rf /var/lib/apt/lists/* /var/cache/debconf \
    && apt-get clean

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

ENTRYPOINT ["/usr/bin/clickhouse-client"]
1
Go back further in your logs- the command itself that failed would have some output explaining what went wrong.Paul Becotte
@PaulBecotte How? I haven't container to see logs. I try do it.Alexey_Danilov
it works perfectly for me. As @PaulBecotte says, logs would be useful to understand your context of execution.eramos
i mean, docker build debugging. It seems that something in apt install is failing due to repository access, compatibility... who knows. What i would do, is limit the apt operations to locate the problem. So start installing step by step to know which one is causing the rc=2. Also, i would group apt operations together (exclude mkdir -p and things like that: RUN that before). Perhaps it is an issue with apt-get update for further installations.eramos
I would break your RUN in three parts: first do mkdirs, and env assignment, then apt update && installations (break more to debug if necessary), and finally cleanup (rm -rf and clean).eramos

1 Answers

0
votes

I don't know why, but problem was here:

apt-key adv --keyserver keyserver.ubuntu.com --recv E0C56BD4.

It's working:

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4