Job for docker.service failed because the control process exited with error code (Pi-hole)

On a Intel NUC with a fresh Ubuntu Server 22.04.1 LTS installation I failed to install docker according to these instructions. Step:

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

gave the following error:

Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xeu docker.service" for details.
invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Mon 2022-11-14 10:55:55 CET; 39ms ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
    Process: 3671 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
   Main PID: 3671 (code=exited, status=1/FAILURE)
        CPU: 145ms
dpkg: error processing package docker-ce (--configure):
 installed docker-ce package post-installation script subprocess returned error exit status 1
Processing triggers for man-db (2.10.2-1) ...
Errors were encountered while processing:
 docker-ce
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

See also similar topic without a solution mentioned.

I found my solution in disable blocking of my pi-hole (possible a VPN could also create this error)
Perhaps this will help someone during installation

had the same issue. opened up synaptic and saw docker-ce-rootless packages were not uninstalled from previous setup. removed those and reinstalled again. that fixed my problem.

The logs shows that iptables parameter is invalid.
Here’s my case:
12月 09 17:07:20 rock-5b dockerd[11123]: time="2022-12-09T17:07:20.968713872+09:00" level=warning msg="Running iptables --wait -t nat -L -n failed with message: `iptables v1.8.7 (nf_tables): Could not fetch rule set generation id: Invalid argument`, error: exit status >

I found the solution to fix this here;
iptables v1.8.7 (nf_tables): Could not fetch rule set generation id: Invalid argument · Issue #140 · P0cL4bs/wifipumpkin3 (github.com)

Run this command. This fixed my case.
update-alternatives --set iptables /usr/sbin/iptables-legacy