ITADN

Add uninstall-docker-ce.ps1 script to provide Docker CE removal functionality

#598Pull RequestCopilot 创建于 2025-06-02
C
Copilotcommented
This PR adds a comprehensive PowerShell script to uninstall Docker Community Edition from Windows systems, addressing the need for a clean removal process when switching between Docker installations or troubleshooting conflicts. ## 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 - **Download Cleanup**: Removes downloaded Docker installation files from user profile - **Optional Components**: - Removes Docker images with `-RemoveImages` - Removes custom networks with `-RemoveNetworks` - Removes Windows Container and Hyper-V features with `-RemoveWindowsFeatures` ### Safety Features - Administrator privilege validation - Confirmation prompts for destructive operations - `-Force` parameter to skip confirmations for automation - `-KeepData` parameter to preserve Docker data directory - Comprehensive error handling with informative warnings ### Parameters ```powershell .\uninstall-docker-ce.ps1 [-RemoveImages] [-RemoveNetworks] [-KeepData] [-Force] [-RemoveWindowsFeatures] ``` ### Usage Examples ```powershell # Basic uninstall (preserves images and data) .\uninstall-docker-ce.ps1 # Complete removal including images and networks .\uninstall-docker-ce.ps1 -RemoveImages -RemoveNetworks # Automated uninstall without prompts .\uninstall-docker-ce.ps1 -Force -RemoveImages # Uninstall but keep Docker data .\uninstall-docker-ce.ps1 -KeepData ``` ## Documentation Updates - Updated `Install-DockerCE/README.md` with complete documentation for the uninstall script - Added reference to uninstall capability in main `helpful_tools/README.md` - Comprehensive PowerShell help documentation with examples and parameter descriptions ## 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. --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.
合并状态:未合并 10 条评论