mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Merge pull request #12126 from ClickHouse/minimal-docker-image
Added a showcase of minimal Docker image
This commit is contained in:
commit
5382b6ce2e
2
docker/bare/Dockerfile
Normal file
2
docker/bare/Dockerfile
Normal file
@ -0,0 +1,2 @@
|
||||
FROM scratch
|
||||
ADD root /
|
37
docker/bare/README.md
Normal file
37
docker/bare/README.md
Normal file
@ -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.
|
24
docker/bare/prepare
Executable file
24
docker/bare/prepare
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user