mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-26 02:07:56 +00:00
This requires updating all import paths throughout, and a matching buildah update to interoperate. I can't figure out the reason for go.mod tracking github.com/containers/image v3.0.2+incompatible // indirect ((go mod graph) lists it as a direct dependency of libpod, but (go list -json -m all) lists it as an indirect dependency), but at least looking at the vendor subdirectory, it doesn't seem to be actually used in the built binaries. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
36 lines
896 B
Go
36 lines
896 B
Go
package client // import "github.com/docker/docker/client"
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
"github.com/docker/docker/api/types/filters"
|
|
)
|
|
|
|
// ImagesPrune requests the daemon to delete unused data
|
|
func (cli *Client) ImagesPrune(ctx context.Context, pruneFilters filters.Args) (types.ImagesPruneReport, error) {
|
|
var report types.ImagesPruneReport
|
|
|
|
if err := cli.NewVersionError("1.25", "image prune"); err != nil {
|
|
return report, err
|
|
}
|
|
|
|
query, err := getFiltersQuery(pruneFilters)
|
|
if err != nil {
|
|
return report, err
|
|
}
|
|
|
|
serverResp, err := cli.post(ctx, "/images/prune", query, nil, nil)
|
|
defer ensureReaderClosed(serverResp)
|
|
if err != nil {
|
|
return report, err
|
|
}
|
|
|
|
if err := json.NewDecoder(serverResp.body).Decode(&report); err != nil {
|
|
return report, fmt.Errorf("Error retrieving disk usage: %v", err)
|
|
}
|
|
|
|
return report, nil
|
|
}
|