dockeralpine-linuxclickhouse

Run clickhouse-client and clickhouse-local on a Alpine docker container


I have this app that uses clickhouse-client to connect on an external clickhouse-server installation.

Everything goes fine when running this app at a docker alpine container, except the clickhouse-client library.

I have tried to pre-built packages, but I had no success. Is there some way to have this clickhouse-client (not the server) enable on an Alpine Docker Container?


Solution

  • The Docker image you're using should already come with clickhouse-client pre-installed, so you can use it directly.

    If you still want to install clickhouse-client separately, you can follow the instructions:

    LATEST_VERSION=$(curl -s https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/utils/list-versions/version_date.tsv | \
        grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | sort -V -r | head -n 1)
    export LATEST_VERSION
    
    case $(uname -m) in
      x86_64) ARCH=amd64 ;;
      aarch64) ARCH=arm64 ;;
      *) echo "Unknown architecture $(uname -m)"; exit 1 ;;
    esac
    
    curl -fO "https://packages.clickhouse.com/tgz/stable/clickhouse-client-${LATEST_VERSION}-${ARCH}.tgz" \
      || curl -fO "https://packages.clickhouse.com/tgz/stable/clickhouse-client-${LATEST_VERSION}.tgz"