Files
runtime/apps/runner/pkg/docker/image_remove.go
zeekay ea80dc3638 feat: Add new Dockerfiles and improve containerization
- Add main Dockerfile for production builds
- Add Dockerfile.runtime for secure code execution
- Add Dockerfile.runtime.fixed with improved configuration
- Include .dockerignore for build optimization
- Add integration documentation and publishing guides
- Update API and CLI components for better runtime support
- Enhance sandbox and container management features
2025-08-16 23:03:39 -05:00

32 lines
669 B
Go

// Copyright 2025 Hanzo Industries Inc.
// SPDX-License-Identifier: AGPL-3.0
package docker
import (
"context"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/errdefs"
log "github.com/sirupsen/logrus"
)
func (d *DockerClient) RemoveImage(ctx context.Context, imageName string, force bool) error {
_, err := d.apiClient.ImageRemove(ctx, imageName, image.RemoveOptions{
Force: force,
PruneChildren: true,
})
if err != nil {
if errdefs.IsNotFound(err) {
log.Infof("Image %s already removed and not found", imageName)
return nil
}
return err
}
log.Infof("Image %s deleted successfully", imageName)
return nil
}