Added a showcase of minimal Docker image

This commit is contained in:
Alexey Milovidov 2020-07-04 01:45:17 +03:00
parent 5a4d9fb9ae
commit 08dfc140a3
3 changed files with 58 additions and 0 deletions

2
docker/bare/Dockerfile Normal file
View File

@ -0,0 +1,2 @@
FROM scratch
ADD root /

35
docker/bare/README.md Normal file
View File

@ -0,0 +1,35 @@
## 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;

21
docker/bare/prepare Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
set -e
SRC_DIR=../..
BUILD_DIR=${SRC_DIR}/build
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