无法在 CentOS 上的 Docker 容器 运行 中使用 yum
Can't use yum inside Docker container running on CentOS
我无法在我的 Docker 容器中 运行 任何 yum 命令而不会出现以下错误:
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/Group'
You need to be root to perform this command.
我很困惑,因为我很确定 docker 容器是 运行 默认用户 root。不过,如果我尝试将 sudo 放在 yum install -y <package>
或 yum update -y
命令前面,我会得到:
/bin/sh: sudo: command not found
我正在使用以下基本映像,因此我可以轻松地 运行 Java Wildfly 应用程序 Docker:https://hub.docker.com/r/jboss/wildfly/
基础发行版是CentOS Linux release 7.2.1511 (Core)
原来用户在基本图像中设置为 jboss
。
当使用 dockerfile 命令 USER root
切换到用户 root 时,一切正常。
我无法在我的 Docker 容器中 运行 任何 yum 命令而不会出现以下错误:
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/Group'
You need to be root to perform this command.
我很困惑,因为我很确定 docker 容器是 运行 默认用户 root。不过,如果我尝试将 sudo 放在 yum install -y <package>
或 yum update -y
命令前面,我会得到:
/bin/sh: sudo: command not found
我正在使用以下基本映像,因此我可以轻松地 运行 Java Wildfly 应用程序 Docker:https://hub.docker.com/r/jboss/wildfly/
基础发行版是CentOS Linux release 7.2.1511 (Core)
原来用户在基本图像中设置为 jboss
。
当使用 dockerfile 命令 USER root
切换到用户 root 时,一切正常。