Uninstall Docker Debian: Step-by-Step Guide

Uninstall Docker Debian

If you're looking to uninstall Docker from your Debian system, you've come to the right place. In this article, we'll walk you through the step-by-step process of uninstalling Docker from Debian. Whether you want to switch to a different containerization platform or need to troubleshoot Docker-related issues, removing Docker from your system is a simple task.

Ensure Docker is running: What to do if it's not?

Before we begin, let's first address a common issue many Debian users encounter - the "bash: docker: command not found" error. If you encounter this error, it means that Docker is not installed or not properly configured on your system. To resolve this, you can refer to our article on bash: docker: command not found for a step-by-step guide on installing Docker on Debian.

Step 1: Stop Docker services

To begin the uninstallation process, we need to stop all Docker services that are currently running on your system. Open a terminal window and execute the following command:

sudo systemctl stop docker

This will stop Docker and prevent any interference during the uninstallation process. If Docker is not running, this command will not produce any output.

Step 2: Remove Docker packages

Next, we need to remove the Docker packages from your Debian system. Execute the following command in the terminal to uninstall Docker:

sudo apt-get purge docker-ce docker-ce-cli containerd.io

This command will remove all Docker-related packages, including the Docker engine, command-line interface, and containerd. During the uninstallation process, you may be prompted to confirm the removal of certain dependencies. Simply enter 'y' and press Enter to proceed.

Step 3: Remove Docker directory and files

After removing the Docker packages, we need to delete any remaining Docker directories and files. Execute the following command in the terminal to remove the Docker directory:

sudo rm -rf /var/lib/docker

This command will delete the /var/lib/docker directory, which contains Docker's data and configuration files. Be cautious when using the rm command with the -rf option, as it recursively deletes files and directories without prompting for confirmation.

Step 4: Clean up Docker artifacts

To ensure a complete uninstallation, we need to clean up any remaining Docker artifacts. Execute the following command in the terminal to remove Docker-related artifacts:

sudo apt-get autoremove --purge docker-ce docker-ce-cli containerd.io

This command will remove any Docker artifacts that may have been left behind during the uninstallation process. Once again, you may be prompted to confirm the removal of certain dependencies. Enter 'y' and press Enter to proceed.

Step 5: Verify the uninstallation

To confirm that Docker has been successfully uninstalled from your Debian system, execute the following command in the terminal to check the Docker version:

docker --version

If Docker has been completely removed, this command will return an error message indicating that the 'docker' command is not found.

Related Articles

  • ZSH: command not found: docker - If you're using ZSH as your shell and encounter the "ZSH: command not found: docker" error, this article provides a step-by-step guide on resolving the issue.
  • Docker command not found on Mac - 2023 solution - If you're facing issues with Docker on your Mac system, this article offers a comprehensive solution to the commonly encountered "docker command not found" error.
  • How to start docker daemon on Mac OS - If you're experiencing difficulties starting the Docker daemon on your Mac, this article provides detailed steps to get it up and running smoothly.
  • Is the Docker Daemon Running on MacOs - If you're unsure whether the Docker daemon is running on your Mac, this article explains how to check its status and troubleshoot any issues.

By following the above steps, you can effortlessly uninstall Docker from your Debian system. Whether you're transitioning to a new containerization platform or need to resolve Docker-related problems, this guide has provided you with a step-by-step solution. Remember to always double-check your commands before executing them to avoid any unintended consequences.

Ruslan Osipov
Written by author: Ruslan Osipov