使用yum安装时拒绝Dockerfile权限
我正在尝试从此图像创建Dockerfile: 我的Dockerfile:使用yum安装时拒绝Dockerfile权限,docker,dockerfile,centos7,rpm,yum,Docker,Dockerfile,Centos7,Rpm,Yum,我正在尝试从此图像创建Dockerfile: 我的Dockerfile: FROM centos/python-27-centos7:latest RUN yum install rpm-build -y WORKDIR /usr/src/app COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt CMD ["bash"] 但我得到了下一个错误: => ER
FROM centos/python-27-centos7:latest
RUN yum install rpm-build -y
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
CMD ["bash"]
但我得到了下一个错误:
=> ERROR [2/9] RUN yum install rpm-build -y 0.6s
------
> [2/9] RUN yum install rpm-build -y:
#5 0.480 Loaded plugins: fastestmirror, ovl
#5 0.485 ovl: Error while doing RPMdb copy-up:
#5 0.485 [Errno 13] Permission denied: '/var/lib/rpm/Dirnames'
#5 0.579 You need to be root to perform this command.
------
我尝试添加sudo,但仍然不起作用。
这里出了什么问题?尝试使用用户根目录
FROM centos/python-27-centos7:latest
USER root
RUN yum install rpm-build -y
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
CMD ["bash"]
@SiHa我不确定,因为然后
yum安装
安装到另一个目录。。。也许我需要以root用户身份安装,但需要替换一些二进制文件或添加到PATH.。然后使用运行chmod 0644
?