'microdnf update command installs new packages instead of just updating existing packages

My Dockerfile uses base image registry.access.redhat.com/ubi8/ubi-minimal which has microdnf package manager.

When I include following snippet in docker file to have latest updates on existing packages,

RUN true \
    && microdnf clean all \
    && microdnf update --nodocs \
    && microdnf clean all \
    && true

It's not just upgrades 4 existing packages but also install 33 new packages,

Transaction Summary:
 Installing:       33 packages
 Reinstalling:      0 packages
 Upgrading:         4 packages
 Removing:          0 packages
 Downgrading:       0 packages

The dnf documentation does not suggest that it should install new packages. Is it a bug in microdnf?

microdnf update also increases the new image size by ~75MB



Solution 1:[1]

I had the same or a very similar problem. Found a command-line flag that helped to lower the number of additionally installed packages. If you add install_weak_deps=0, it should help with these additional packages.

microdnf upgrade \
  --refresh \
  --best \
  --nodocs \
  --noplugins \
  --setopt=install_weak_deps=0

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matthias Diester