It is recomended when creating docker images that minimal images be used. In the case of Fedora it is recomended that for smallest images the minimal image should be used and “microdnf” be used instead of the full blown “dnf” package manager.
One major issue I have hit with using microdnf is that if a package in the main Fedora repositories is downgraded to a version below that shipped with the minimal image “microdnf” cannot handle downgrading packages when required.
Re-doing a build that had been working for over four months it suddenly started failing with a conflict. The error I hit is below.
..... Upgrading: glibc-2.29-22.fc30.x86_64 updates 4.2\xc2\xa0MB glibc-common-2.29-22.fc30.x86_64 updates 858.5\xc2\xa0kB glibc-minimal-langpack-2.29-22.fc30.x86_64 updates 48.4\xc2\xa0kB libxcrypt-4.4.10-1.fc30.x86_64 updates 125.3\xc2\xa0kB Downgrading: libstdc++-9.0.1-0.10.fc30.x86_64 fedora 583.9\xc2\xa0kB Transaction Summary: Installing: 204 packages Reinstalling: 0 packages Upgrading: 4 packages Removing: 0 packages Downgrading: 1 packages Downloading packages... Running transaction test... error: Error running transaction: package libstdc++-9.1.1-1.fc30.x86_64 (which is newer than libstdc++-9.0.1-0.10.fc30.x86_64) is already installed
The “microdnf” tool does not support usefull options “dnf” supports for resolving conflicts, in the case of conflicts like this the only solution is to switch to using the full “dnf” package. It requires changing the Dockerfile from…
FROM registry.fedoraproject.org/fedora-minimal:30 ...lots of stuff... RUN microdnf -y install perl procps-ng vim-minimal && microdnf clean all
to the below…
FROM registry.fedoraproject.org/fedora-minimal:30 ...lots of stuff... RUN microdnf -y install dnf RUN dnf -y --allowerasing --obsoletes install perl procps-ng vim-minimal && dnf clean all && microdnf clean all
This results in a image size around 42Mb larger than just using microdnf, but it is unfortunately the only way to handle the issue.