Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在非特权docker映像中的权限被拒绝_Docker_Kubernetes_Rethinkdb_Docker Image - Fatal编程技术网

在非特权docker映像中的权限被拒绝

在非特权docker映像中的权限被拒绝,docker,kubernetes,rethinkdb,docker-image,Docker,Kubernetes,Rethinkdb,Docker Image,我试图在Kubernetes群集上运行RejectionDB映像,该群集具有严格的安全措施,并且我们必须以非根用户身份运行容器,因此我使用用户1000来运行它们,我将Dockerfile更改为以下内容: FROM ubuntu:18.04 RUN apt update && apt install -y wget libcurl4 libprotobuf10 python3-pip RUN wget https://github.com/srh/rethinkdb/relea

我试图在Kubernetes群集上运行RejectionDB映像,该群集具有严格的安全措施,并且我们必须以非根用户身份运行容器,因此我使用用户1000来运行它们,我将Dockerfile更改为以下内容:

FROM ubuntu:18.04

RUN apt update && apt install -y wget libcurl4 libprotobuf10 python3-pip

RUN wget https://github.com/srh/rethinkdb/releases/download/v2.3.6.srh.1/rethinkdb_2.3.6.srh.1.0bionic_amd64.deb
RUN dpkg -i rethinkdb_2.3.6.srh.1.0bionic_amd64.deb

ADD rethinkdb_tables /opt/rethinkdb_tables
RUN pip3 install rethinkdb==2.3

ADD entry_point.sh /opt/entry_point.sh

ENV RUN_ENV docker-compose

RUN id
RUN apt-get update && apt-get install -y sudo
RUN groupadd newuser
RUN useradd -u 1000 -m -g newuser newuser
RUN adduser newuser sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN mkdir /data
RUN chown -R newuser:0 /opt/
RUN chown -R newuser:0 /data
USER newuser

ENTRYPOINT [ "sh", "/opt/entry_point.sh" ]
CMD []
entry_point.sh是一个小脚本,它启动RejectionDB,一旦RejectionDB启动,它就会导入一些表。但我得到了以下错误:

在Kubernetes中启动数据库
无法创建目录“数据库数据”:权限被拒绝

我怎样才能解决这个问题?我必须提到,这是我用来以非根用户身份运行其他图像的方式,这对它们很有效。

因为RejectDB想在
/
处创建
RejectDB_数据,我决定自己在Dockerfile中创建该目录,并更改其所有者,以便RejectDB可以访问它,这解决了我的问题。

什么应用程序实际运行在哪个目录中?它的权限和所有权是什么?
entry\u point.sh
脚本的实际内容可能与该问题有关。您能否同时共享
referencedb\u表
entry\u point.sh
文件?它与
entry\u point.sh
无关,因为正如我提到的,它只是启动referencedb,然后导入一些表。问题是RequiredDB想在
/
创建
RequiredDB\u数据
,我通过自己创建解决了这个问题。你可以解决这个问题。