Uninstall docker from Ubuntu

If you installed docker with snap:

simple uninstall:

sudo snap remove docker

and to disable automatic snapshot:

sudo snap remove --purge docker

If after reinstalling docker you have the following error:

bash: /snap/bin/docker: No such file or directory

you need to run

hash docker

and

hash docker-compose

Installation instruction:

https://docs.docker.com/engine/install/ubuntu/

Note that if you installed an old version with snap, you should follow the instruction provided in this article.

https://docs.docker.com/compose/install/