Data directory permissions on host for Clickhouse installation via docker

巧了我就是萌 提交于 2019-12-08 11:21:34

问题


My setup for clickhouse is via docker (https://hub.docker.com/r/yandex/clickhouse-server/~/dockerfile/). Currently, I am running some issues when mounting the data directory (/var/lib/clickhouse) from the container to the host machine as I want to persist the data outside of the container runtime.

Since the docker process is responsible for creating the directories on the host (these directories for /var/lib/clickhouse do not exist until running docker with a -v flag), what are the permissions and/or directory structure I should provision on my host instance?

I am bumping into something like:Application: Access to file denied: /var/lib/clickhouse/data. My explicit file mounts are: /var/lib/clickhouse and /var/lib/clickhouse/tmp as prescribed in the configuration file. But since the clickhouse server process seems to create more directories, the docker process is being "rejected" when trying to create more processes.

I could explicitly mount the /data, etc but this makes an assumption that is outside of the configuration. Also, this does work if I give generous permissions top /var/clickhouse like: chmod 777 /var/clickhouse but wanted to make sure this was best practice.


回答1:


as i see in https://hub.docker.com/r/yandex/clickhouse-server/~/dockerfile/ you can try run on host OS

docker run --rm -i --entrypoint /bin/sh yandex/clickhouse-server -c id clickhouse

uid=105(clickhouse) gid=106(clickhouse) groups=106(clickhouse)

after get id, you can run on host OS

chown -R 105:106 /var/lib/clickhouse



来源:https://stackoverflow.com/questions/46917533/data-directory-permissions-on-host-for-clickhouse-installation-via-docker

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!