diff --git a/docker/bare/Dockerfile b/docker/bare/Dockerfile new file mode 100644 index 00000000000..d0ee8661cad --- /dev/null +++ b/docker/bare/Dockerfile @@ -0,0 +1,2 @@ +FROM scratch +ADD root / diff --git a/docker/bare/README.md b/docker/bare/README.md new file mode 100644 index 00000000000..7b5ab6f5ea9 --- /dev/null +++ b/docker/bare/README.md @@ -0,0 +1,37 @@ +## The bare minimum ClickHouse Docker image. + +It is intented as a showcase to check the amount of implicit dependencies of ClickHouse from the OS in addition to the OS kernel. + +Example usage: + +``` +./prepare +docker build --tag clickhouse-bare . +``` + +Run clickhouse-local: +``` +docker run -it --rm --network host clickhouse-bare /clickhouse local --query "SELECT 1" +``` + +Run clickhouse-client in interactive mode: +``` +docker run -it --rm --network host clickhouse-bare /clickhouse client +``` + +Run clickhouse-server: +``` +docker run -it --rm --network host clickhouse-bare /clickhouse server +``` + +It can be also run in chroot instead of Docker (first edit the `prepare` script to enable `proc`): + +``` +sudo chroot . /clickhouse server +``` + +## What does it miss? + +- creation of `clickhouse` user to run the server; +- VOLUME for server; +- most of the details, see other docker images for comparison. diff --git a/docker/bare/prepare b/docker/bare/prepare new file mode 100755 index 00000000000..10d791cac73 --- /dev/null +++ b/docker/bare/prepare @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +SRC_DIR=../.. +BUILD_DIR=${SRC_DIR}/build + +# BTW, .so files are acceptable from any Linux distribution for the last 12 years (at least). +# See https://presentations.clickhouse.tech/cpp_russia_2020/ for the details. + +mkdir root +pushd root +mkdir lib lib64 etc tmp root +cp ${BUILD_DIR}/programs/clickhouse . +cp ${SRC_DIR}/programs/server/{config,users}.xml . +cp /lib/x86_64-linux-gnu/{libc.so.6,libdl.so.2,libm.so.6,libpthread.so.0,librt.so.1,libnss_dns.so.2,libresolv.so.2} lib +cp /lib64/ld-linux-x86-64.so.2 lib64 +cp /etc/resolv.conf ./etc +strip clickhouse + +# This is needed for chroot but not needed for Docker: + +# mkdir proc +# sudo mount --bind /proc proc