• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
NameHero® Blog

NameHero® Blog

Web Hosting Tips & Resources From NameHero

  • AI Agents
    • OpenClaw
    • Claude Code
    • n8n
    • Hermes Agent
    • Open WebUI
    • Docker
  • Hosting
    • Web Hosting
    • WordPress Hosting
    • WooCommerce Hosting
    • Enterprise Hosting
    • Email Hosting
    • HeroicGuard
    • GPU Hosting
    • Website Builder
  • VPS
    • Managed VPS
    • Unmanaged VPS
    • Flex VPS
  • Reseller
  • Gaming
  • Domains
  • Account
  • Blog Home
  • Categories
  • Authors

How To Completely Uninstall Docker On Ubuntu

CJ Saathoff

Published on: January 21, 2025

Categories: Linux Command Line 0

Docker allows you to containerize your applications, making it rather easy to distribute the entire software stack needed for applications to run. Have you decided you no longer have a need for docker on your Ubuntu system and would like to remove it completely? If so this post is for you, as we will go through how to completely uninstall docker step by step.

Table of Contents
  • Before You Start
  • Stop All Containers and Data
  • Uninstallation
  • Clean Up
  • Removing Docker GPG Key and Repository
  • Verifying the Uninstallation
  • Conclusion
  • Looking For More

Before You Start

  • Make sure that you want to remove Docker and that you or another user aren’t using any services inside of Docker.
  • Ensure you have the necessary permissions to uninstall Docker, you will need either root access or sudo permissions.
  • Back up any data or configurations even if there is a slight chance you may need the data in the future.

Stop All Containers and Data

First, run docker commands to stop any currently active Docker containers.

sudo docker stop $(sudo docker ps -q)

In case you have containers set to restart we will force remove them as the cleanup command below won’t.

sudo docker rm -f $(docker ps -aq)

Next let’s use docker’s built-in cleanup command to remove all stopped docker containers, unused networks, docker images, and docker files.

sudo docker system prune --volumes

Run the following command to check if there are any containers left on your system. You should see an empty output if all containers have been successfully removed.

sudo docker ps -a

Uninstallation

Run the following commands to uninstall docker packages like docker itself, compose, and even docker desktop from your system.

sudo apt-get remove 'docker*' 

To ensure that any configuration files associated with Docker packages are also removed, use the purge command:

sudo apt-get purge 'docker*'

Clean Up

After removing the Docker packages, you should delete the data directory where images, containers, and volumes are stored. This ensures that no residual Docker data remains.

sudo rm -rf /var/lib/docker

Since Docker relies on containerd for runtime management, it’s also a good idea to clear out its data directory.

sudo rm -rf /var/lib/containerd

Note: If you used a different location for storing data or edited configuration files those likely haven’t been removed. You will need to address those individually.

Removing Docker GPG Key and Repository

Finally, remove any APT source lists and GPG keys associated with Docker that were added for installation from the official repository. This ensures you have no leftover configuration that might cause issues in the future.

sudo rm /etc/apt/sources.list.d/docker.list
sudo rm /etc/apt/keyrings/docker.asc

Verifying the Uninstallation

To make sure there are no more related docker processes running, run the following command:

ps a | grep docker

You can check if any Docker-related packages are still installed by running:

dpkg -l | grep -E 'docker'

Note: If you see a docker-related package still running or installed, try rebooting and see if that solves it.

Conclusion

In this post, we covered the steps to completely remove Docker from your Ubuntu-based system. From prerequisites to stopping all containers and removing their data, to uninstalling docker, cleanup, removing GPG keys, and verification. You have now finished as well as other docker packages like uninstalling docker desktop uninstalling Docker. If you decide you later want to reinstall Docker, you can run the same commands as you used when you installed it before. Consider reinstalling Docker Engine using the official installation instructions.

Looking For More

Done reading and looking for more, why not check these out?

  • Docker VS LXC
  • Official Docker Docs
  • My Other Posts
CJ Saathoff

Embracing a lifelong passion for technology since childhood, CJ delved into the intricate workings of systems, captivated by the desire to understand the unknown. This innate curiosity led to his discovery of Linux, a revelation that resonated deeply. With more than 7 years of on the job experience, he’s honed his technical skills as a Geek and Senior Linux Systems Administrator.

Related Posts

Bash Signal Handling with Trap: EXIT, ERR, INT

Bash in Linux allows us to set functions that run when certain signals are generated - either by the script, or the shell. Here's how.

Differentiating the df vs du Commands in Linux

Both df and du are Linux commands for estimating disk usage, but they differ in their focus. Df stands for “disk free”, and du stands for disk usage. The first shows the amount of free space available on a volume, and the second shows the amount of space used by specific directories. Both commands have […]

Bash Conditional Expressions: [[ vs [ vs test

In bash scripts, we use conditional statements frequently. Whether it’s in an “if fi” logic block or within a “while” or “do” loop, we evaluate statements all the time to determine whether they’re true or false, and perform various actions based on the result. True to form, there are multiple ways to do this, and […]

How Curl Follows Redirects on Linux

We use curl regularly to fetch resources from websites. Unfortunately, curl doesn't follow redirects automatically. Here's how to fix that.

Reader Interactions

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow & Subscribe

Exclusive promos, content and more!


Most Popular Posts

NameHero’s Recommended WordPress Plugin and Theme Setup

WordPress Hosting vs. Web Hosting – What’s The Difference?

How To Increase The InnoDB Buffer Pool Size

How To Fix A Stuck All-in-One WP Migration Import

How To Add A Subdomain In Cloudflare

Top Categories

  • WordPress
  • WordPress Tutorials
  • OpenClaw Hosting
  • Enterprise Hosting
  • WooCommerce
  • Web Hosting
  • Resellers
  • Website Security
  • Website Development
  • Website Performance
  • VPS Hosting
  • SEO Tips
  • Announcements
  • Domain Registration
NameHero

NameHero® proudly provides web hosting to over 40,000 customers with 99.9% uptime to over 750,000 websites.

  • Master Card
  • Visa
  • American Express
  • Discover
  • Paypal
Products
  • Web Hosting
  • Managed VPS Hosting
  • Unmanaged VPS Hosting
  • Flex VPS Hosting
  • WordPress Hosting
  • WooCommerce Hosting
  • Reseller Hosting
  • Enterprise Hosting
  • GPU Hosting
  • Email Hosting
  • HeroicGuard
  • Domains
  • Website Builder
  • AI Agent Hosting
Help & Support
  • NameHero Blog
  • NameHero Gaming Blog
  • Support
  • Help Center
  • Migrations
  • Affiliates
  • Gaming Affiliates
  • Call 1-855-984-6263
Company
  • About Us
  • Contact Sales
  • Reviews
  • Uptime
  • We're Hiring

Copyright © 2026 Name Hero, LLC. All rights reserved.
NameHero® is a registered trademark.

  • Privacy Policy
  • Terms of Use
  • Acceptable Use Policy
  • Payment Policy
  • DMCA