microsoft/Windows-Containers

Uninstall Scripts for Container Runtimes

ntrappe-msft opened this issue · 2 comments

Feature Request

Provide PowerShell scripts for users to uninstall container runtimes and other requirements to support containers. Since we provide ways to install these services, users deserve a way to remove them safely from their machines.

Likely, we'll need a script that can do the following:

  • Stop any running containers
  • Delete all containers and images
  • Remove containerd
  • Remove docker
  • Turn off hyper-v feature
  • Turn off containers feature

Considerations

  • We Check: Assume that the user should do none of the labor. Our script should check if there are running containers, downloaded images, and which container runtime they're using. (Rather than have them check and confirm each).
  • Ask First: We should ask frequently whether they would like to remove or proceed with removing an item.
  • Verify: We should provide confirmation that we did, in fact, remove the runtime(s).
  • OS Support: We probably want the script to work for Windows 10, Windows Server 2022, and Windows 11.

Design Questions

Flags vs Prompts

The current installation scripts have users use flags to determine what they want to do. For example, to install containerd with transparent networking, they use the -useDHCP flag. However, if users don't actually know what's already installed on their system, we may want to use prompts. This way, we could notify them of the existing container runtime(s) and ask if they'd like to remove each. Additionally, for turning off features, we'd have to decide if we want them to use a flag to indicate that or prompt them. If people want to run a script w/o user interaction, it would be better to use a flag. However, we may need to have user interaction in general to confirm the removal of software.

All or One Runtime

Do we want one uninstall script to remove containerd or docker (whatever is present)? Or one uninstall script for each as we have for installation?

ADR 1: Flags vs Prompts

Outcome Date Assignees
Undecided 04/03/24 TBD

Option 1: Flags

Script would be run with or without flags. Flags may determine which items to remove like the runtime (e.g., containerd, docker, or all) and if they'd like to turn off features. Examples may include:

  • .\uninstall-container-runtimes.ps1: uninstalls docker and/or containerd
  • .\uninstall-container-runtimes.ps1 --runtime=docker: only uninstalls docker
  • .\uninstall-container-runtimes.ps1 --off-features: uninstalls runtimes AND turns hyperv and containers features off

(Idk we can discuss)

Option 2: Prompts

Users would just run the script and it would inform them of what's present on their machine and what they'd like to do. For example:

$> .\uninstall-container-runtimes.ps1
$> You have docker installed on your system, would you like to uninstall it? [Yes/No]: Yes
$> You have hyper-v turned on, would you like to turn it off? [Yes/No]: No
.
.
.

This issue has been open for 90 days with no updates.
@ritikaguptams, @ntrappe-msft, please provide an update or close this issue.