I ran into this issue as well and I came up with a better solution by updating the docker.repo file to include the module_hotfixes=1 option. This works around the modularity issue by enabling all rpms included in the repo instead of excluding them. A better explanation can be found here.
The dnf.conf manpage states the following regarding the module_hotfixes option:
module_hotfixes
boolean
Set this to True to disable module RPM filtering and make all RPMs
from the repository available. The default is False. This allows user
to create a repository with cherry-picked hotfixes that are included
in a package set on a modular system.