Skip to content

Completely uninstall and reinstall docker in ubuntu

Last updated on May 10, 2023

The following actions are run with administrator privileges

Uninstall docker
1. Remove docker and all packages automatically installed during installation

apt-get autoremove docker docker-ce docker-engine docker.io containerd runc

2. Check if docker is uninstalled

dpkg -l | grep docker

dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P

# Remove useless and relevant configuration files

3. Remove the relevant plugins that are not removed

apt-get autoremove docker-ce-*

4. Remove docker-related configuration & directories

rm -rf /etc/systemd/system/docker.service.d

rm -rf /var/lib/docker

5. Make sure docker is uninstalled

docker --version

Install docker
Just read the official website documentation, I believe it is clearer than I can explain:
https://docs.docker.com/engine/install/ubuntu/#install-using-the-convenience-script

Published inWeb

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *