rm: allow removing builders with invalid config

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2026-07-06 12:04:37 +02:00
parent cd58eac2cb
commit 4f6f49dd81
3 changed files with 163 additions and 8 deletions
+12 -2
View File
@@ -78,8 +78,15 @@ func runRm(ctx context.Context, dockerCli command.Cli, in rmOptions) error {
return errors.Errorf("context builder cannot be removed, run `docker context rm %s` to remove this context", b.Name)
}
nodes, err := b.LoadNodes(timeoutCtx)
if in.keepDaemon {
return txn.Remove(b.Name)
}
nodes, err := b.LoadNodes(timeoutCtx, builder.WithSkippedImageOpt())
if err != nil {
if err1 := txn.Remove(b.Name); err1 != nil {
return err1
}
return err
}
@@ -169,7 +176,10 @@ func rmAllInactive(ctx context.Context, txn *store.Txn, dockerCli command.Cli, i
for _, b := range builders {
func(b *builder.Builder) {
eg.Go(func() error {
nodes, err := b.LoadNodes(timeoutCtx, builder.WithData())
if b.DockerContext {
return nil
}
nodes, err := b.LoadNodes(timeoutCtx, builder.WithData(), builder.WithSkippedImageOpt())
if err != nil {
return errors.Wrapf(err, "cannot load %s", b.Name)
}