Skip to content

Commit

Permalink
Merge pull request ClickHouse#31802 from pkit/fix_setcap
Browse files Browse the repository at this point in the history
fix setcap in docker
  • Loading branch information
alexey-milovidov authored Nov 30, 2021
2 parents 1cc9c92 + 2f50642 commit 42787cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions programs/install/Install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,12 +769,13 @@ int mainEntryClickHouseInstall(int argc, char ** argv)
#if defined(__linux__)
fmt::print("Setting capabilities for clickhouse binary. This is optional.\n");
std::string command = fmt::format("command -v setcap >/dev/null"
" && echo > {0} && chmod a+x {0} && {0} && setcap 'cap_net_admin,cap_ipc_lock,cap_sys_nice+ep' {0} && {0} && rm {0}"
" && setcap 'cap_net_admin,cap_ipc_lock,cap_sys_nice+ep' {1}"
" && command -v capsh >/dev/null"
" && capsh --has-p=cap_net_admin,cap_ipc_lock,cap_sys_nice+ep >/dev/null 2>&1"
" && setcap 'cap_net_admin,cap_ipc_lock,cap_sys_nice+ep' {0}"
" || echo \"Cannot set 'net_admin' or 'ipc_lock' or 'sys_nice' capability for clickhouse binary."
" This is optional. Taskstats accounting will be disabled."
" To enable taskstats accounting you may add the required capability later manually.\"",
"/tmp/test_setcap.sh", fs::canonical(main_bin_path).string());
fs::canonical(main_bin_path).string());
executeScript(command);
#endif

Expand Down

0 comments on commit 42787cf

Please sign in to comment.