Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minikube image rm Exits with 0 on Failure #19687

Open
kon-foo opened this issue Sep 23, 2024 · 2 comments
Open

minikube image rm Exits with 0 on Failure #19687

kon-foo opened this issue Sep 23, 2024 · 2 comments
Labels
area/image Issues/PRs related to the minikube image subcommand help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/improvement Categorizes issue or PR as related to improving upon a current feature.

Comments

@kon-foo
Copy link

kon-foo commented Sep 23, 2024

What Happened?

Description

When running minikube image rm, the exit code is 0 even though the command fails to remove the image. A failure should result in a non-zero exit code, allowing scripts or CI processes to handle the failure properly.

Steps to reproduce

  1. Load an image and start a pod.
minikube image load alpine:latest
kubectl create deployment alpine-deployment --image=alpine:latest -- sleep 3600
  1. Attempt to remove the image while being in use.
minikube image rm alpine:latest
  1. Check for the error output: You should see an error similar to:
❗  Failed to remove images for profile minikube error removing images: remove image docker: docker rmi alpine:latest: Process exited with status 1
stdout:

stderr:
Error response from daemon: conflict: unable to remove repository reference "alpine:latest" (must force) - container dc9b6c3f872e is using its referenced image 91ef0af61f39
  1. Check the exit code of the minikube command:
echo $?
# Output: 0

Expected Behavior

When minikube image rm encounters an error (such as an image being in use), it should exit with a non-zero status code (e.g. 1), allowing proper error handling in scripts or pipelines.

Actual Behavior

The command exits with a status code of 0, even though it reports an internal failure, which leads to downstream commands executing when they shouldn't.

Suggested Fix

Ensure that minikube image rm propagates the exit status of the underlying image removal process.\

Environment

  • Minikube Version: v1.33.1
  • OS: Ubuntu via WSL2 (5.15.153.1-microsoft-standard-WSL2)

Attach the log file

log.txt

Operating System

Ubuntu

Driver

Docker

@spowelljr spowelljr added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/improvement Categorizes issue or PR as related to improving upon a current feature. area/image Issues/PRs related to the minikube image subcommand labels Sep 30, 2024
@PyAgni
Copy link

PyAgni commented Oct 1, 2024

@spowelljr Can I work on this?

@spowelljr
Copy link
Member

@PyAgni Yup, comment /assign and it will assign the issue to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/image Issues/PRs related to the minikube image subcommand help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/improvement Categorizes issue or PR as related to improving upon a current feature.
Projects
None yet
Development

No branches or pull requests

3 participants