How to uninstall Docker and Kubernetes1 min read

In this tutorial, we will learn how to completely uninstall Docker and Kubernetes.

Uninstall Docker from Ubuntu

Execute the below commands to completely uninstall Docker from Ubuntu

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  
sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker
sudo rm -rf /var/run/docker.sock

Uninstall Docker from CentOS

Execute the below commands to completely uninstall Docker from CentOS

sudo yum remove docker-engine docker docker.io docker-ce docker-ce-cli
sudo rm -rf /var/lib/docker /etc/docker

Uninstall Kubernetes from Ubuntu

Execute the below commands to completely uninstall Kubernetes from Ubuntu

kubeadm reset
sudo apt-get purge kubeadm kubectl kubelet kubernetes-cni kube* 
sudo apt-get autoremove
sudo rm -rf ~/.kube

Uninstall Kubernetes from CentOS

Execute the below commands to completely uninstall Kubernetes from CentOS

kubeadm reset
sudo yum remove kubeadm kubectl kubelet kubernetes-cni kube*
sudo yum autoremove
sudo rm -rf ~/.kube

Refer to the below tutorials to install Docker and Kubernetes,

  1. How to install Kubernetes on Ubuntu
  2. How to install Kubernetes on CentOS

Share:

Leave a Reply