I experienced the same issue after starting to use llama.cpp docker containers; my Windows QEMU/KVM wouldn’t have network access.
Found some more helpful resources:
I honestly can’t make heads nor tails of the networking stack, especially iptables, but I assume Gerard de Leeuw’s answer (add ExecStartPost to docker.service) is enough for me. Hopefully, the explanation here is helpful to someone else.
Edit: I split iptables -I DOCKER-USER -i virbr0 -o virbr0 -j ACCEPT into two, iptables -I DOCKER-USER -i virbr0 -j ACCEPT and iptables -I DOCKER-USER -o virbr0 -j ACCEPT, and added them as ExecStartPost values. Otherwise, VM’s DHCP works but Internet doesn’t. I have virbr0 because I use the default automatically created bridge instead of making it myself, change it to whatever bridge name you have.