Skip to content

Instantly share code, notes, and snippets.

@R4wm
Last active January 6, 2023 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save R4wm/ffaace93fefdb20eb7bb36e24f9a10a1 to your computer and use it in GitHub Desktop.
Save R4wm/ffaace93fefdb20eb7bb36e24f9a10a1 to your computer and use it in GitHub Desktop.
setup hoyj clickhouse docker instance
[r4wm@todo hoyj_clickhouse_database]$ cat Dockerfile
FROM yandex/clickhouse-server
RUN apt update
COPY create_database.sh .
COPY create_media_table.sql .
VOLUME /home/r4wm/hoyj_clickhouse_database:/var/lib/clickhouse
EXPOSE 8123/tcp
[r4wm@todo hoyj_clickhouse_database]$
r4wm@todo ~]$ mkdir $HOME/hoyj_clickhouse_database
[root@todo hoyj_clickhouse_database]# docker build -t hoyj_clickhouse .
Sending build context to Docker daemon 83.32MB
Step 1/6 : FROM yandex/clickhouse-server
---> c739327b5607
Step 2/6 : RUN apt update
---> Running in 5677acee62e5
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [1,791 kB]
Ign:4 https://repo.clickhouse.com/deb/stable main/ InRelease
Get:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:7 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [2,368 kB]
Get:8 https://repo.clickhouse.com/deb/stable main/ Release [749 B]
Get:9 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:10 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [976 kB]
Get:11 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [27.7 kB]
Get:12 https://repo.clickhouse.com/deb/stable main/ Release.gpg [836 B]
Get:13 https://repo.clickhouse.com/deb/stable main/ Packages [230 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1,275 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1,929 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [31.3 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1,277 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2,859 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [28.6 kB]
Get:22 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [55.2 kB]
Fetched 25.0 MB in 8s (3,081 kB/s)
Reading package lists...
Building dependency tree...
Reading state information...
70 packages can be upgraded. Run 'apt list --upgradable' to see them.
Removing intermediate container 5677acee62e5
---> 2d4fbe3d7701
Step 3/6 : COPY create_database.sh .
---> 873433c51775
Step 4/6 : COPY create_media_table.sql .
---> 4d2080749406
Step 5/6 : VOLUME /home/r4wm/hoyj_clickhouse_database:/var/lib/clickhouse
---> Running in 8bd9d5fc1c58
Removing intermediate container 8bd9d5fc1c58
---> cd547be78ac6
Step 6/6 : EXPOSE 8123/tcp
---> Running in 8a7f4de2b420
Removing intermediate container 8a7f4de2b420
---> f6bb0319508e
Successfully built f6bb0319508e
Successfully tagged hoyj_clickhouse:latest
[root@todo hoyj_clickhouse_database]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hoyj_clickhouse latest f6bb0319508e 6 seconds ago 867MB
clickhouse/clickhouse-server latest 3bbe3275fe85 3 weeks ago 910MB
ubuntu 20.04 d5447fc01ae6 4 weeks ago 72.8MB
yandex/clickhouse-server latest c739327b5607 11 months ago 826MB
[root@todo hoyj_clickhouse_database]# docker run -it -d -p 8123:8123 f6bb0319508e
d1e98ff9358f461418f58a64ad9a97235563419ef7f7e55f6aa9bae3ea0e73a2
[root@todo hoyj_clickhouse_database]# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d1e98ff9358f f6bb0319508e "/entrypoint.sh" 4 seconds ago Up 3 seconds 9000/tcp, 0.0.0.0:8123->8123/tcp, :::8123->8123/tcp, 9009/tcp beautiful_rhodes
[root@todo hoyj_clickhouse_database]# curl http://localhost:8123/play
<html> <!-- TODO If I write DOCTYPE HTML something changes but I don't know what. -->
<head>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment