Can't use yum inside Docker container running on CentOS

社会主义新天地 提交于 2019-12-03 08:16:34

问题


I am unable to run any yum commands inside my Docker container without getting the following error:

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. Still, if I try putting sudo in front of a yum install -y <package> or yum update -y command I get:

/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/

The underlying distro is CentOS Linux release 7.2.1511 (Core)


回答1:


Turns out the user was set to jboss in the base image.
When is switched to user root with the dockerfile command USER root everything worked.



来源:https://stackoverflow.com/questions/38133849/cant-use-yum-inside-docker-container-running-on-centos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!