Skip to content

upload uninstall script and docs#602

Merged
ntrappe-msft merged 7 commits into
Mainfrom
ntrappe-uninstall
Sep 4, 2025
Merged

upload uninstall script and docs#602
ntrappe-msft merged 7 commits into
Mainfrom
ntrappe-uninstall

Conversation

@ntrappe-msft

@ntrappe-msft ntrappe-msft commented Jun 17, 2025

Copy link
Copy Markdown
Contributor

This PR adds a comprehensive PowerShell script to uninstall Docker Community Edition from Windows systems, addressing the need for a clean removal process.

What's Added

uninstall-docker-ce.ps1 Script

A complete uninstall script that reverses the Docker CE installation by:

  • Service Management: Stops and removes the Docker service registration
  • Binary Cleanup: Removes docker.exe and dockerd.exe from System32
  • Data Management: Cleans up Docker data directory and configuration files
  • Optional Components:
    • Preserves images, volumes, or networks

Safety Features

  • Administrator privilege validation
  • Confirmation prompts for destructive operations
  • -Force parameter to skip confirmations for automation
  • -Keep... parameter to preserve images/volumes/networks (i.e. Docker data directory)
  • Comprehensive error handling with informative warnings

Parameters

.\uninstall-docker-ce.ps1 [-Force] [-KeepImages] [-KeepVolumes] [-KeepNetworks]

Usage Examples

# Complete removal including images and networks
.\uninstall-docker-ce.ps1

# Automated uninstall without prompts
.\uninstall-docker-ce.ps1 -Force

# Uninstall but keep Docker data
.\uninstall-docker-ce.ps1 -KeepImages

Documentation Updates

  • Updated Install-DockerCE/README.md with complete documentation for the uninstall script

Design Principles

The script follows the same patterns and coding style as the existing install-docker-ce.ps1, ensuring consistency and maintainability. It includes proper error handling, user feedback, and follows PowerShell best practices.

Fixes #545.

@ntrappe-msft ntrappe-msft requested a review from Copilot June 17, 2025 20:20

This comment was marked as outdated.

ntrappe-msft and others added 2 commits June 17, 2025 13:22
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ntrappe-msft

Copy link
Copy Markdown
Contributor Author

Testing

Tested across Windows 11, Server 2022, and Server 2025.

  1. Installed Docker CE via install-docker-ce.ps1.
  2. Pulled images like Nano Server 2025 and Server Core 2022.
  3. Created volumes and custom networks.
  4. Started containers (continuously running and exited).
  5. Ran the uninstall script uninstall-docker-ce.ps1 with various parameters.
  6. Confirmed that relevant files and directories were removed, if needed, or preserved, if requested.

@ntrappe-msft ntrappe-msft self-assigned this Jun 18, 2025
Comment thread helpful_tools/Install-DockerCE/uninstall-docker-ce.ps1
Comment thread helpful_tools/Install-DockerCE/README.md
Comment thread helpful_tools/Install-DockerCE/uninstall-docker-ce.ps1
Comment thread helpful_tools/Install-DockerCE/uninstall-docker-ce.ps1
@ntrappe-msft ntrappe-msft requested a review from Copilot July 7, 2025 08:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a PowerShell script to cleanly uninstall Docker CE on Windows and updates documentation links and instructions to include the new script.

  • Introduces uninstall-docker-ce.ps1 with safety checks, optional preservation flags, and cleanup routines
  • Updates top-level helpful_tools/README.md to reference both install and uninstall scripts
  • Extends Install-DockerCE/README.md with detailed uninstall script usage, parameters, and examples

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
helpful_tools/README.md Updated link text to include uninstall instructions
helpful_tools/Install-DockerCE/uninstall-docker-ce.ps1 Added full uninstall script with service, binary, data, and registry cleanup
helpful_tools/Install-DockerCE/README.md Extended documentation to cover uninstall-docker-ce.ps1 usage
Comments suppressed due to low confidence (3)

helpful_tools/Install-DockerCE/uninstall-docker-ce.ps1:57

  • [nitpick] The KeepData parameter overlaps with KeepImages, KeepVolumes, and KeepNetworks but isn’t referenced in the main removal logic. Either remove KeepData or integrate it consistently (and document its behavior) to avoid confusion.
    $KeepData,

helpful_tools/Install-DockerCE/README.md:171

  • The README lists -Force, -KeepImages, -KeepVolumes, and -KeepNetworks but does not document the -KeepData parameter. Update the docs to include or remove -KeepData based on the final parameter set.
    -Force [<SwitchParameter>]

helpful_tools/Install-DockerCE/uninstall-docker-ce.ps1:1

  • [nitpick] This powerful uninstall script lacks automated or documented manual tests. Consider adding tests or a test plan to validate each uninstallation step and parameter combination across environments.
############################################################

}
}
return $results
} -ArgumentList @(,$layerDirs)

Copilot AI Jul 7, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The -ArgumentList @(,$layerDirs) syntax passes a null as the first argument, so the $layers parameter ends up empty. Replace with -ArgumentList $layerDirs or -ArgumentList @($layerDirs) to ensure $layers receives the array of directories.

Suggested change
} -ArgumentList @(,$layerDirs)
} -ArgumentList @($layerDirs)

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ntrappe-msft , I'm wondering if this copilot suggestion was helpful in your script or just nonsense?

@slonopotamus

Copy link
Copy Markdown

I wonder why installation method is using all this PowerShell machinery instead of already existing mechanisms (MSI, AppxBundle, MSIX or whatever).

@ntrappe-msft

Copy link
Copy Markdown
Contributor Author

We're trying to mirror the install script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide uninstall-docker-ce.ps1

8 participants