Last active
March 18, 2021 12:25
-
-
Save fuomag9/3ff2da547173d4b6251fe8dc1f3935fc to your computer and use it in GitHub Desktop.
Delete/cleanup all containerd kubernetes images on microk8s
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
import subprocess | |
a = subprocess.getoutput('microk8s.ctr i ls') | |
a = a.split("\n") | |
b = [x.split(" ")[0] for x in a] | |
del b[0] | |
ii = str(input(f"Do you want to delete {len(b)} images?")) | |
if ii == "yes" or ii=="y": | |
for x in b: | |
print(subprocess.getoutput(f'microk8s.ctr i rm {x}')+" has been deleted") | |
else: | |
print("Aborted") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment