I came here after discovering that
sudo docker ps would hang forever on my fresh
raspberry pi 4 with a ubuntu 20.04.
Putting the value of
/etc/hosts seemed to have made sudo "more accessible".
But still docker would not run properly.
apt upgrade failed for docker also, I couldn't even kill the process with
ctrl + c, but had to
pkill apt and then kill the process of
dpkg by its
sudo dpkg --configure -a as suggested by another ´apt upgrade´, hung at docker-ce package again.
BUT during the first ´apt upgrade´ a new kernel had been installed. So I tried my luck with rebooting. Now it works again. Someone else had a similar experience here: https://askubuntu.com/questions/1236208/docker-ps-stuck-docker-install-also-just-hangs