docker 安装 clickhouse单机版

默认已经安装好Docker, 尚未安装docker的可以参考这篇: Ubuntu安装Docker

  1. 直接运行, docker会自动帮你拉取镜像:
docker run -d --name ch-server --ulimit nofile=262144:262144 -p 8123:8123 -p 9000:9000 -p 9009:9009 yandex/clickhouse-server
  1. 执行情况:
Unable to find image 'yandex/clickhouse-server:latest' locally
latest: Pulling from yandex/clickhouse-server
423ae2b273f4: Pull complete 
de83a2304fa1: Pull complete 
f9a83bce3af0: Pull complete 
b6b53be908de: Pull complete 
965325ddb17a: Pull complete 
0578e5e66a8e: Pull complete 
cf4817e12b9b: Pull complete 
fc49cff4c4a9: Pull complete 
9d0dcd4885ed: Pull complete 
7c6aa06ea350: Pull complete 
26b0facd9219: Pull complete 
Digest: sha256:26692f0312d8456bb9091957ce532135eeb31648adc3c7e22f31443cde8b9f1d
Status: Downloaded newer image for yandex/clickhouse-server:latest

  1. 查看镜像

    [email protected]:~# docker images
    REPOSITORY                 TAG                 IMAGE ID            CREATED             SIZE
    yandex/clickhouse-server   latest              f62e485ae47b        6 days ago          492MB
  2. 进入容器

    [email protected]:~# docker run -it f62e485ae47b /bin/bash
  3. 启动clickhouse-client

    [email protected]:/# clickhouse-client --host
    ClickHouse client version (official build).
    Connecting to as user default.
    Connected to ClickHouse server version 20.3.4 revision 54433.
  4. 查看数据库

    e8e77479edf9 :) show databases;
    │ default │
    │ system  │
    2 rows in set. Elapsed: 0.002 sec.