Skip to content

Commit 98dcef6

Browse files
authored
Merge pull request ClickHouse#63400 from ClickHouse/docker-server-official-review
The Dockerfile is reviewed by docker-official
2 parents 83ee9a6 + 544875f commit 98dcef6

File tree

2 files changed

+30
-27
lines changed

2 files changed

+30
-27
lines changed

docker/server/Dockerfile.ubuntu

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
FROM ubuntu:20.04
22

33
# see https://github.com/moby/moby/issues/4032#issuecomment-192327844
4+
# It could be removed after we move on a version 23:04+
45
ARG DEBIAN_FRONTEND=noninteractive
56

67
# ARG for quick switch to a given ubuntu mirror
78
ARG apt_archive="http://archive.ubuntu.com"
89

10+
# We shouldn't use `apt upgrade` to not change the upstream image. It's updated biweekly
11+
912
# user/group precreated explicitly with fixed uid/gid on purpose.
1013
# It is especially important for rootless containers: in that case entrypoint
1114
# can't do chown and owners of mounted volumes should be configured externally.
@@ -16,20 +19,21 @@ RUN sed -i "s|http://archive.ubuntu.com|${apt_archive}|g" /etc/apt/sources.list
1619
&& groupadd -r clickhouse --gid=101 \
1720
&& useradd -r -g clickhouse --uid=101 --home-dir=/var/lib/clickhouse --shell=/bin/bash clickhouse \
1821
&& apt-get update \
19-
&& apt-get upgrade -yq \
2022
&& apt-get install --yes --no-install-recommends \
2123
ca-certificates \
2224
locales \
2325
tzdata \
2426
wget \
25-
&& apt-get clean \
2627
&& rm -rf /var/lib/apt/lists/* /var/cache/debconf /tmp/*
2728

2829
ARG REPO_CHANNEL="stable"
2930
ARG REPOSITORY="deb [signed-by=/usr/share/keyrings/clickhouse-keyring.gpg] https://packages.clickhouse.com/deb ${REPO_CHANNEL} main"
3031
ARG VERSION="24.4.1.2088"
3132
ARG PACKAGES="clickhouse-client clickhouse-server clickhouse-common-static"
3233

34+
#docker-official-library:off
35+
# The part between `docker-official-library` tags is related to our builds
36+
3337
# set non-empty deb_location_url url to create a docker image
3438
# from debs created by CI build, for example:
3539
# docker build . --network host --build-arg version="21.4.1.6282" --build-arg deb_location_url="https://..." -t ...
@@ -80,19 +84,22 @@ RUN if [ -n "${single_binary_location_url}" ]; then \
8084
&& rm -rf /tmp/* ; \
8185
fi
8286

87+
# The rest is the same in the official docker and in our build system
88+
#docker-official-library:on
89+
8390
# A fallback to installation from ClickHouse repository
8491
RUN if ! clickhouse local -q "SELECT ''" > /dev/null 2>&1; then \
8592
apt-get update \
8693
&& apt-get install --yes --no-install-recommends \
8794
apt-transport-https \
88-
ca-certificates \
8995
dirmngr \
9096
gnupg2 \
9197
&& mkdir -p /etc/apt/sources.list.d \
9298
&& GNUPGHOME=$(mktemp -d) \
93-
&& GNUPGHOME="$GNUPGHOME" gpg --no-default-keyring \
99+
&& GNUPGHOME="$GNUPGHOME" gpg --batch --no-default-keyring \
94100
--keyring /usr/share/keyrings/clickhouse-keyring.gpg \
95-
--keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8919F6BD2B48D754 \
101+
--keyserver hkp://keyserver.ubuntu.com:80 \
102+
--recv-keys 3a9ea1193a97b548be1457d48919f6bd2b48d754 \
96103
&& rm -rf "$GNUPGHOME" \
97104
&& chmod +r /usr/share/keyrings/clickhouse-keyring.gpg \
98105
&& echo "${REPOSITORY}" > /etc/apt/sources.list.d/clickhouse.list \
@@ -127,7 +134,6 @@ RUN mkdir /docker-entrypoint-initdb.d
127134

128135
COPY docker_related_config.xml /etc/clickhouse-server/config.d/
129136
COPY entrypoint.sh /entrypoint.sh
130-
RUN chmod +x /entrypoint.sh
131137

132138
EXPOSE 9000 8123 9009
133139
VOLUME /var/lib/clickhouse

docker/server/README.md

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,34 @@
44

55
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.
66

7-
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.
7+
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.
88

99
For more information and documentation see https://clickhouse.com/.
1010

1111
## Versions
1212

13-
- The `latest` tag points to the latest release of the latest stable branch.
14-
- Branch tags like `22.2` point to the latest release of the corresponding branch.
15-
- Full version tags like `22.2.3.5` point to the corresponding release.
16-
- The tag `head` is built from the latest commit to the default branch.
17-
- Each tag has optional `-alpine` suffix to reflect that it's built on top of `alpine`.
13+
- The `latest` tag points to the latest release of the latest stable branch.
14+
- Branch tags like `22.2` point to the latest release of the corresponding branch.
15+
- Full version tags like `22.2.3.5` point to the corresponding release.
16+
- The tag `head` is built from the latest commit to the default branch.
17+
- Each tag has optional `-alpine` suffix to reflect that it's built on top of `alpine`.
1818

1919
### Compatibility
2020

21-
- The amd64 image requires support for [SSE3 instructions](https://en.wikipedia.org/wiki/SSE3). Virtually all x86 CPUs after 2005 support SSE3.
22-
- The arm64 image requires support for the [ARMv8.2-A architecture](https://en.wikipedia.org/wiki/AArch64#ARMv8.2-A) and additionally the Load-Acquire RCpc register. The register is optional in version ARMv8.2-A and mandatory in [ARMv8.3-A](https://en.wikipedia.org/wiki/AArch64#ARMv8.3-A). Supported in Graviton >=2, Azure and GCP instances. Examples for unsupported devices are Raspberry Pi 4 (ARMv8.0-A) and Jetson AGX Xavier/Orin (ARMv8.2-A).
21+
- The amd64 image requires support for [SSE3 instructions](https://en.wikipedia.org/wiki/SSE3). Virtually all x86 CPUs after 2005 support SSE3.
22+
- The arm64 image requires support for the [ARMv8.2-A architecture](https://en.wikipedia.org/wiki/AArch64#ARMv8.2-A) and additionally the Load-Acquire RCpc register. The register is optional in version ARMv8.2-A and mandatory in [ARMv8.3-A](https://en.wikipedia.org/wiki/AArch64#ARMv8.3-A). Supported in Graviton >=2, Azure and GCP instances. Examples for unsupported devices are Raspberry Pi 4 (ARMv8.0-A) and Jetson AGX Xavier/Orin (ARMv8.2-A).
2323

2424
## How to use this image
2525

2626
### start server instance
27+
2728
```bash
2829
docker run -d --name some-clickhouse-server --ulimit nofile=262144:262144 clickhouse/clickhouse-server
2930
```
3031

3132
By default, ClickHouse will be accessible only via the Docker network. See the [networking section below](#networking).
3233

33-
By default, starting above server instance will be run as the `default` user without password.
34+
By default, starting above server instance will be run as the `default` user without password.
3435

3536
### connect to it from a native client
3637

@@ -66,9 +67,7 @@ docker run -d -p 18123:8123 -p19000:9000 --name some-clickhouse-server --ulimit
6667
echo 'SELECT version()' | curl 'http://localhost:18123/' --data-binary @-
6768
```
6869

69-
```
70-
22.6.3.35
71-
```
70+
`22.6.3.35`
7271

7372
or by allowing the container to use [host ports directly](https://docs.docker.com/network/host/) using `--network=host` (also allows achieving better network performance):
7473

@@ -77,16 +76,14 @@ docker run -d --network=host --name some-clickhouse-server --ulimit nofile=26214
7776
echo 'SELECT version()' | curl 'http://localhost:8123/' --data-binary @-
7877
```
7978

80-
```
81-
22.6.3.35
82-
```
79+
`22.6.3.35`
8380

8481
### Volumes
8582

8683
Typically you may want to mount the following folders inside your container to achieve persistency:
8784

88-
* `/var/lib/clickhouse/` - main folder where ClickHouse stores the data
89-
* `/var/log/clickhouse-server/` - logs
85+
- `/var/lib/clickhouse/` - main folder where ClickHouse stores the data
86+
- `/var/log/clickhouse-server/` - logs
9087

9188
```bash
9289
docker run -d \
@@ -97,9 +94,9 @@ docker run -d \
9794

9895
You may also want to mount:
9996

100-
* `/etc/clickhouse-server/config.d/*.xml` - files with server configuration adjustments
101-
* `/etc/clickhouse-server/users.d/*.xml` - files with user settings adjustments
102-
* `/docker-entrypoint-initdb.d/` - folder with database initialization scripts (see below).
97+
- `/etc/clickhouse-server/config.d/*.xml` - files with server configuration adjustments
98+
- `/etc/clickhouse-server/users.d/*.xml` - files with user settings adjustments
99+
- `/docker-entrypoint-initdb.d/` - folder with database initialization scripts (see below).
103100

104101
### Linux capabilities
105102

@@ -150,7 +147,7 @@ docker run --rm -e CLICKHOUSE_DB=my_database -e CLICKHOUSE_USER=username -e CLIC
150147

151148
## How to extend this image
152149

153-
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.
150+
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.
154151
Also, you can provide environment variables `CLICKHOUSE_USER` & `CLICKHOUSE_PASSWORD` that will be used for clickhouse-client during initialization.
155152

156153
For example, to add an additional user and database, add the following to `/docker-entrypoint-initdb.d/init-db.sh`:

0 commit comments

Comments
 (0)