dockerdocs sugests to remove old docker packages before docker installation:
Since there is no old docker version installed I expected that there’s nothing to remove but the result was different:
pacey@o2:~$ sudo dnf remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
[sudo] password for pacey:
No match for argument: docker
No match for argument: docker-client
No match for argument: docker-client-latest
No match for argument: docker-common
No match for argument: docker-latest
No match for argument: docker-latest-logrotate
No match for argument: docker-logrotate
No match for argument: docker-engine-selinux
No match for argument: docker-engine
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Removing:
container-selinux noarch 4:2.235.0-2.fc40 @updates 72 k
Removing dependent packages:
flatpak-selinux noarch 1.15.91-1.fc40 @updates 13 k
nbdkit-selinux noarch 1.38.5-2.fc40 @updates 16 k
passt-selinux noarch 0^20250217.ga1e48a0-2.fc40 @updates 204 k
selinux-policy-targeted noarch 40.29-2.fc40 @updates 19 M
swtpm-selinux noarch 0.9.0-5.fc40 @updates 252 k
Removing unused dependencies:
rpm-plugin-selinux x86_64 4.19.1.1-1.fc40 @anaconda 16 k
selinux-policy noarch 40.29-2.fc40 @updates 29 k
Transaction Summary
================================================================================
Remove 8 Packages
Freed space: 20 M
Is this ok [y/N]:
I wonder why its is required to remove container-selinux and it’s dependencies.
You seem to have no docker installed yet. Therefore, it doesn’t remove packages as they are not installed.
But the packages that would be marked for deletion indirectly by that command could break things: I suggest to not remove them. On one hand, they are unlikely to break docker. On the other, removing them could break other containerization tools as SELinux then would not know how to handle them. I am not even sure if even docker would need that package on Fedora given that we use SELinux for security, but I do not know that for sure.
Anyway, keep in mind that if you install a third party repo, such as that from docker, you install unsupported software: we cannot say what their packages makes with your system and if they properly tailored the packages to Fedora, and to me it looks that their Docs are written by people who ain’t that well informed about what is going on on Fedora or didn’t test their command sufficiently (as they suggest a command that would delete general container-policies that are relevant for other software too - and maybe even for docker itself).
However, if they provide their own policies that conflict with these, their repo will replace the very packages anyway. If not, it is likely that it would not make a difference anyway (or it would break anyway). So I do not see a need to remove these packages that way even if you want to install Docker from a third party repo afterwards.
I have to add that I am not an expert for docker and more specific, docker on Fedora. But I wanted to ensure that you are aware that removing these packages can have negative side effects. However, I remain a little wondering why this command is somehow linked to container-linux → maybe someone else can shed light on that behavior.
Just an addition, in case that applies to you: is it possible that you use already containers, but not docker but flatpak? And therefore, that you maybe want to stick with current versions of flatpak rather than docker? Just to avoid misunderstandings… (I see in your output that you have no immutable desktop installed, but flatpak policies)
Indeed, it seems that docker-selinux triggers the removal of container-selinux.
A further concern is that this command cannot add anything useful, as dnf will always use the newest version available in all added repos (whatever one that is), while it will also enforce the package dependencies to be aligned among each other - it is not relevant in such circumstances if you have removed it before adding the other repo when the installation then occurs while both repos are fully enabled. So removing any package without subsequently excluding it from the default repos doesn’t add any potential advantage but only the risk to accidental remove things that maybe should not be removed. Further, the local configs of earlier/other docker versions will not be removed by that command anyway. I don’t think that the authors of this Docs page fully understand dnf, and I would be careful with their advice.
In any case, I do not think that the packages you have marked for removal by that command need to be removed: you have no other docker installed anyway. If docker needs different versions of these packages, it will provide them in their repo so that dnf can automatically replace them (then of course you have to know that you fully trust them when you use their variants of the packages). If removing these specific packages would make a difference, that would indicate package issues because it would mean both can be installed without dnf being able to identify conflicts while still creating conflicts among the packages’ outcome, but I don’t think that is the case.