ClickHouse
What is ClickHouse?
ClickHouse is a column-oriented database built for fast analytical (OLAP) queries over very large datasets, the kind of workload row-oriented databases like MySQL or Postgres struggle with. Laradock builds it from the official ClickHouse Debian packages on top of Ubuntu, with an HTTP interface, a native TCP interface, and its own config and users files pre-wired.
Start ClickHouse
docker compose up -d clickhouse
The clickhouse service links to the workspace container, so it's reachable from there by container name once both are up.
Stop ClickHouse
docker compose stop clickhouse
This stops the container without deleting its data. Data lives under DATA_PATH_HOST/clickhouse.
Configuration
All settings live in clickhouse/defaults.env and can be overridden by adding the same line to your own .env:
| Variable | Default | What it does |
|---|---|---|
CLICKHOUSE_VERSION | 25.8.2.29 | Version of the clickhouse-server/clickhouse-client packages installed at build time. |
CLICKHOUSE_GOSU_VERSION | 1.17 | Version of gosu used by the entrypoint to drop root privileges. |
CLICKHOUSE_USER | default | Database user created on boot. |
CLICKHOUSE_PASSWORD | HAHA | Password for CLICKHOUSE_USER. Change this before using anything beyond local dev. |
CLICKHOUSE_HTTP_PORT | 8123 | Host-side port for the HTTP interface (container port 8123). |
CLICKHOUSE_CLIENT_PORT | 9000 | Host-side port for the native TCP protocol used by clickhouse-client (container port 9000). |
CLICKHOUSE_NATIVE_PORT | 9009 | Host-side port for the interserver replication port (container port 9009). |
CLICKHOUSE_CUSTOM_CONFIG | ./clickhouse/config.xml | Server config file mounted into the container. |
CLICKHOUSE_USERS_CUSTOM_CONFIG | ./clickhouse/users.xml | Users/roles config file mounted into the container. |
CLICKHOUSE_ENTRYPOINT_INITDB | ./clickhouse/docker-entrypoint-initdb.d | Folder of scripts auto-run on first boot. |
CLICKHOUSE_HOST_LOG_PATH | ./logs/clickhouse | Host folder ClickHouse writes its logs to. |
Connect with clickhouse-client
docker compose exec clickhouse clickhouse-client --user default --password HAHA
Or from the workspace container, reach it by service name: clickhouse-client --host clickhouse --user default --password HAHA.
Connect over HTTP
curl "http://localhost:8123/?user=default&password=HAHA" -d "SELECT 1"
The HTTP interface also exposes a lightweight health check at /ping.
Change resource limits
The container requests high ulimits (nproc: 65535, nofile: 262144), ClickHouse itself recommends this for production-grade workloads. If Docker on your host caps these lower, you'll see startup warnings in docker compose logs clickhouse; raise the limits in Docker Desktop's resource settings or your Docker daemon config.
Common issues
- Default password is
HAHA. It's genuinely the shipped default inclickhouse/defaults.env, set your ownCLICKHOUSE_PASSWORDin.envbefore using this for anything beyond local dev. - Config changes don't take effect.
clickhouse/config.xmlandclickhouse/users.xmlare bind-mounted, edits apply on container restart; no rebuild needed. ChangingCLICKHOUSE_VERSIONdoes require a rebuild:docker compose build clickhouse. - Client can't connect from another container. Use the service name
clickhouseas the host, notlocalhost, and the container-internal ports (9000native,8123HTTP), not the host-mapped ones. - Logs directory missing on host.
CLICKHOUSE_HOST_LOG_PATH(./logs/clickhouseby default) needs to exist for the bind mount to work; create it if Docker complains on startup.
Need a search engine instead? See Manticore. Back to the Getting Started guide.