1

I've got some weird behaviour yum vs rpm where both claim to install, but only rpm actually creates the files while yum just claims installed. I can't tell what I'm doing wrong and why the files won't install via yum in docker.

Steps:

docker run --rm -it centos:7

Set yum caching so that we can use the same file via yum and rpm

vi /etc/yum.conf
-> set keepcache=1

And lets kick off yum install

yum install -y centos-indexhtml

trimmed output:

Installed:
  centos-indexhtml.noarch 0:7-9.el7.centos                                                                          

Complete!

Now this package is supposed to install files into /usr/share/doc/HTML as per https://rpmfind.net/linux/RPM/centos/7.7.1908/x86_64/Packages/centos-indexhtml-7-9.el7.centos.noarch.html

ll /usr/share/doc/HTML
ls: cannot access /usr/share/doc/HTML: No such file or directory

so lets uninstall this package from yum and use the yum cache and install directly from RPM

yum remove -y centos-indexhtml
(trimmed output)
Removed:
  centos-indexhtml.noarch 0:7-9.el7.centos                                                                          

Complete!
rpm -Uvh /var/cache/yum/x86_64/7/base/packages/centos-indexhtml-7-9.el7.centos.noarch.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:centos-indexhtml-7-9.el7.centos  ################################# [100%]

And verify files exist:

ll /usr/share/doc/HTML
total 16
drwxr-xr-x 2 root root 4096 Jan 10 18:18 en-US
drwxr-xr-x 2 root root 4096 Jan 10 18:18 img
-rwxr-xr-x 1 root root 4833 May 16  2014 index.html

What am I doing wrong with yum? I'm not getting any errors, just nothing written to the path via yum?

1
  • I can repro. I straced the yum command but found nothing. Baffling. Jan 10, 2020 at 20:07

1 Answer 1

0

The yum configuration in docker is slightly different: in the same /etc/yum.conf file you'll find:

tsflags=nodocs

which means that packages won't install their documentation. In docker images, the goal of most people is to have a working application that is as small as possible, hence the removal of documenation files.

By using rpm directly, you are bypassing this yum configuration.

1
  • 1
    I'm assuming nodocs prevents files from being written to /usr/share/doc/. I can't actually find any documentation on the behaviour of this flag, and man yum merely mentions tsflags once and no mention of nodocs. Now that I know what to look for, I only found this: hub.docker.com/_/centos By default, the CentOS containers are built using yum's nodocs option, which helps reduce the size of the image. If you install a package and discover files missing, please comment out the line tsflags=nodocs in /etc/yum.conf and reinstall your package.
    – rpwcal
    Jan 13, 2020 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.