clickhouse
50K+
ClickHouse is the fastest and most resource efficient OSS database for real-time apps and analytics.
docker pull clickhouse
Maintained by:
ClickHouse Inc.
Where to get help:
the Docker Community Slack, Server Fault, Unix & Linux, or Stack Overflow
Dockerfile
linkslatest
, jammy
, 25.1
, 25.1-jammy
, 25.1.5
, 25.1.5-jammy
, 25.1.5.31
, 25.1.5.31-jammy
24.12
, 24.12-jammy
, 24.12.5
, 24.12.5-jammy
, 24.12.5.81
, 24.12.5.81-jammy
24.11
, 24.11-jammy
, 24.11.5
, 24.11.5-jammy
, 24.11.5.49
, 24.11.5.49-jammy
lts
, lts-focal
, 24.8
, 24.8-focal
, 24.8.14
, 24.8.14-focal
, 24.8.14.39
, 24.8.14.39-focal
24.3
, 24.3-focal
, 24.3.18
, 24.3.18-focal
, 24.3.18.7
, 24.3.18.7-focal
Where to file issues:
https://github.com/ClickHouse/ClickHouse/issues
Supported architectures: (more info)amd64
, arm64v8
Published image artifact details:
repo-info repo's repos/clickhouse/
directory (history)
(image metadata, transfer size, etc)
Image updates:
official-images repo's library/clickhouse
label
official-images repo's library/clickhouse
file (history)
Source of this description:
docs repo's clickhouse/
directory (history)
ClickHouse is an open-source column-oriented DBMS (columnar database management system) for online analytical processing (OLAP) that allows users to generate analytical reports using SQL queries in real-time.
ClickHouse works 100-1000x faster than traditional database management systems, and processes hundreds of millions to over a billion rows and tens of gigabytes of data per server per second. With a widespread user base around the globe, the technology has received praise for its reliability, ease of use, and fault tolerance.
For more information and documentation see https://clickhouse.com/.
latest
tag points to the latest release of the latest stable branch.22.2
point to the latest release of the corresponding branch.22.2.3
and 22.2.3.5
point to the corresponding release.ubuntu:22.04
as its base image. It requires docker version >= 20.10.10
containing patch. As a workaround you could use docker run --security-opt seccomp=unconfined
instead, however that has security implications.docker run -d --name some-clickhouse-server --ulimit nofile=262144:262144 clickhouse
By default, ClickHouse will be accessible only via the Docker network. See the networking section below.
By default, starting above server instance will be run as the default
user without password.
docker run -it --rm --network=container:some-clickhouse-server --entrypoint clickhouse-client clickhouse
# OR
docker exec -it some-clickhouse-server clickhouse-client
More information about the ClickHouse client.
echo "SELECT 'Hello, ClickHouse!'" | docker run -i --rm --network=container:some-clickhouse-server buildpack-deps:curl curl 'http://localhost:8123/?query=' -s --data-binary @-
More information about the ClickHouse HTTP Interface.
docker stop some-clickhouse-server
docker rm some-clickhouse-server
⚠️ Note: the predefined user
default
does not have the network access unless the password is set, see "How to create default database and user on starting" and "Managingdefault
user" below
You can expose your ClickHouse running in docker by mapping a particular port from inside the container using host ports:
docker run -d -p 18123:8123 -p19000:9000 -e CLICKHOUSE_PASSWORD=changeme --name some-clickhouse-server --ulimit nofile=262144:262144 clickhouse
echo 'SELECT version()' | curl 'http://localhost:18123/?password=changeme' --data-binary @-
22.6.3.35
Or by allowing the container to use host ports directly using --network=host
(also allows achieving better network performance):
docker run -d --network=host --name some-clickhouse-server --ulimit nofile=262144:262144 clickhouse
echo 'SELECT version()' | curl 'http://localhost:8123/' --data-binary @-
22.6.3.35
⚠️ Note: the user
default
in the example above is available only for the localhost requests
Typically you may want to mount the following folders inside your container to achieve persistency:
/var/lib/clickhouse/
- main folder where ClickHouse stores the data/var/log/clickhouse-server/
- logsdocker run -d \
-v "$PWD/ch_data:/var/lib/clickhouse/" \
-v "$PWD/ch_logs:/var/log/clickhouse-server/" \
--name some-clickhouse-server --ulimit nofile=262144:262144 clickhouse
You may also want to mount:
/etc/clickhouse-server/config.d/*.xml
- files with server configuration adjustments/etc/clickhouse-server/users.d/*.xml
- files with user settings adjustments/docker-entrypoint-initdb.d/
- folder with database initialization scripts (see below).ClickHouse has some advanced functionality, which requires enabling several Linux capabilities.
They are optional and can be enabled using the following docker command-line arguments:
docker run -d \
--cap-add=SYS_NICE --cap-add=NET_ADMIN --cap-add=IPC_LOCK \
--name some-clickhouse-server --ulimit nofile=262144:262144 clickhouse
Read more in knowledge base.
The container exposes port 8123 for the HTTP interface and port 9000 for the native client.
ClickHouse configuration is represented with a file "config.xml" (documentation)
docker run -d --name some-clickhouse-server --ulimit nofile=262144:262144 -v /path/to/your/config.xml:/etc/clickhouse-server/config.xml clickhouse
# $PWD/data/clickhouse should exist and be owned by current user
docker run --rm --user "${UID}:${GID}" --name some-clickhouse-server --ulimit nofile=262144:262144 -v "$PWD/logs/clickhouse:/var/log/clickhouse-server" -v "$PWD/data/clickhouse:/var/lib/clickhouse" clickhouse
When you use the image with local directories mounted, you probably want to specify the user to maintain the proper file ownership. Use the --user
argument and mount /var/lib/clickhouse
and /var/log/clickhouse-server
inside the container. Otherwise, the image will complain and not start.
docker run --rm -e CLICKHOUSE_RUN_AS_ROOT=1 --name clickhouse-server-userns -v "$PWD/logs/clickhouse:/var/log/clickhouse-server" -v "$PWD/data/clickhouse:/var/lib/clickhouse" clickhouse
Sometimes you may want to create a user (user named default
is used by default) and database on a container start. You can do it using environment variables CLICKHOUSE_DB
, CLICKHOUSE_USER
, CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT
and CLICKHOUSE_PASSWORD
:
docker run --rm -e CLICKHOUSE_DB=my_database -e CLICKHOUSE_USER=username -e CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1 -e CLICKHOUSE_PASSWORD=password -p 9000:9000/tcp clickhouse
Managing default
user
The user default
has disabled network access by default in the case none of CLICKHOUSE_USER
, CLICKHOUSE_PASSWORD
, or CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT
are set.
There's a way to make default
user insecurely available by setting environment variable CLICKHOUSE_SKIP_USER_SETUP
to 1:
docker run --rm -e CLICKHOUSE_SKIP_USER_SETUP=1 -p 9000:9000/tcp clickhouse
To perform additional initialization in an image derived from this one, add one or more *.sql
, *.sql.gz
, or *.sh
scripts under /docker-entrypoint-initdb.d
. After the entrypoint calls initdb
, it will run any *.sql
files, run any executable *.sh
scripts, and source any non-executable *.sh
scripts found in that directory to do further initialization before starting the service.
Also, you can provide environment variables CLICKHOUSE_USER
& CLICKHOUSE_PASSWORD
that will be used for clickhouse-client during initialization.
For example, to add an additional user and database, add the following to /docker-entrypoint-initdb.d/init-db.sh
:
#!/bin/bash
set -e
clickhouse client -n <<-EOSQL
CREATE DATABASE docker;
CREATE TABLE docker.docker (x Int32) ENGINE = Log;
EOSQL
View license information for the software contained in this image.
As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
Some additional license information which was able to be auto-detected might be found in the repo-info
repository's clickhouse/
directory.
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
Docker Official Images are a curated set of Docker open source and drop-in solution repositories.
These images have clear documentation, promote best practices, and are designed for the most common use cases.