Conversation
k3s-uninstall.sh only handles its embedded containerd runtime. When k3s is configured with --docker, Pod containers appear in `docker ps` with a k8s_ prefix and are silently skipped by the uninstall script. Add remove_k3s_docker_containers() to stop and remove all k8s_* Docker containers after k3s-uninstall.sh runs. The function lists affected containers and prompts for confirmation before removing. Behaviour in non-interactive environments (CI/CD, pipes): - stdin is not a TTY: skip automatically, print manual cleanup command - --yes / -y flag or AUPLC_YES=1: remove without prompting Upstream issue: k3s-io/k3s#1469
…ntainers Replacing the 'name=k8s_' substring filter with a label-based filter on 'io.kubernetes.pod.name', which kubelet stamps on every container it creates via dockershim/cri-dockerd. This prevents accidentally matching user-created containers that happen to have 'k8s_' in their name.
KerwinTsaiii
approved these changes
Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When k3s is installed with
--docker, all Pod containers are managed by Docker and appear indocker pswith ak8s_prefix. The k3s uninstall script (k3s-uninstall.sh) only handles its embedded containerd runtime and makes no Docker API calls, so these containers are silently left behind after uninstall.This is a known upstream issue: k3s-io/k3s#1469.
Closes #45
Changes
Add
remove_k3s_docker_containers()to theremove_k3sflow. Afterk3s-uninstall.shruns, it:--filter "label=io.kubernetes.pod.name"(the label kubelet stamps on every container it creates via dockershim/cri-dockerd), which is more precise than matching thek8s_name prefix--yes/AUPLC_YES=1: removes without prompting, for scripted/CI useTesting
./auplc-installer uninstallwith containers present, confirm prompt lists containers correctlyecho y | ./auplc-installer uninstall), confirm non-interactive path triggers--yes, confirm auto-removal without prompt