uninstall docker in ubuntu

How to Uninstall Docker in Ubuntu

Docker is a popular application container used by many websites & organizations. It allows you to easily build, deploy, run and update applications in a platform-independent manner. However, sometimes you may have to delete Docker from your system, in case you face any issues. In this article, we will look at how to uninstall docker in Ubuntu.


How to Uninstall Docker in Ubuntu

Here are the steps to completely remove docker in Ubuntu.


1. Find out packages to be deleted

Open terminal and run the following command to determine which packages need to be deleted on your system.

$ dpkg -l | grep -i docker

You will see a list of packages.


2. Delete packages

Run the following command to delete those packages.

$ sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli
$ sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce

This will remove all ocker-related packages from your system. However, it will not remove images, containers, volumes, or user created configuration files on your host. To do that, follow the next step.


3. Delete Remaining Files

Run the following commands to delete all images, containers, volumes, user created configuration files. Do this only if you are sure you don’t need to use Docker again. Otherwise, if you re-install Docker, you will not be able to access these files.

$ sudo rm -rf /var/lib/docker /etc/docker
$ sudo rm /etc/apparmor.d/docker
$ sudo groupdel docker
$ sudo rm -rf /var/run/docker.sock

Depending on your system, you may also need to run the following commands.

$ sudo rm -rf /usr/local/bin/docker-compose
$ sudo rm -rf /etc/docker
$ sudo rm -rf ~/.docker

That’s it. The above steps should help you completely uninstall Docker in Ubuntu.

Also read:

How to Become Root User in Linux
How to Change Default Home Directory in Linux
How to Remove Sudo Privileges in Linux
How to Install Webmin in CentOS
How to Uninstall Python In Ubuntu

Leave a Reply

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