Iptables error while running any container

if I try to run any image I get an error like this

docker run -d -p 8000:8000 -p 9000:9000 --name=portainer1 --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer


docker: Error response from daemon: driver failed programming    external connectivity on endpoint portainer1 (85c113c0416564a2e9978fcf77a045f57abe661535efdaf8e4df1efdb5eca1dd):  (iptables failed: iptables --wait -t filter -A DOCKER ! -i docker0 -o docker0 -p tcp -d 172.17.0.2 --dport 9000 -j ACCEPT: iptables: No chain/target/match by that name.

(exit status 1)).

I restarted the docker deamon and tried again but it didnt work

I then tried the solutions suggested in this SO answer https://stackoverflow.com/questions/31667160/running-docker-container-iptables-no-chain-target-match-by-that-name

I cleared the iptable chain and restarted docker but it didnt work still getting the same error

what am I doing wrong?

I am running Ubuntu 20.04