简体   繁体   English

不能在CentOS上运行Docker容器中使用yum

[英]Can't use yum inside Docker container running on CentOS

I am unable to run any yum commands inside my Docker container without getting the following error: 我无法在我的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.

I'm confused because I'm pretty sure docker containers are run with the default user root. 我很困惑,因为我非常确定docker容器是使用默认用户root运行的。 Still, if I try putting sudo in front of a yum install -y <package> or yum update -y command I get: 不过,如果我尝试将sudo放在yum install -y <package>yum update -y命令前面,我会得到:

/bin/sh: sudo: command not found

I'm using the following base image so I can easily run a Java Wildfly application inside Docker: https://hub.docker.com/r/jboss/wildfly/ 我正在使用以下基本映像,因此我可以在Docker中轻松运行Java Wildfly应用程序: https ://hub.docker.com/r/jboss/wildfly/

The underlying distro is CentOS Linux release 7.2.1511 (Core) 底层发行版是CentOS Linux release 7.2.1511 (Core)

Turns out the user was set to jboss in the base image. 原来用户被设置为基本图像中的jboss
When is switched to user root with the dockerfile command USER root everything worked. 当使用dockerfile命令切换到用户root时, USER root一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM