In my case, the solution was to remove the distro provided docker (which I didn't have -- this is just for safety),
$ for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
Which should do nothing, and didn't for me but that's fine. Then you need to reinstall docker-ce
,
apt-get --reinstall install docker-ce
In my case, that didn't work either, because the distro upgrade from one version of Ubuntu to another disabled the docker-ce
repo, so I had to re-add that, I just re-ran the commands Docker provides,
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Then I ran,
apt-get --reinstall install docker-ce
And it worked!