mirror of
https://github.com/containers/podman.git
synced 2026-03-29 03:52:19 -04:00
Two incomptable changes, they removed the BridgeNfIP6tables and BridgeNfIptables fields so we must drop them. As they are not important ones that should not cause problems. Second, they moved to using DockerOCIImageConfig from another new module. The json format did not chnage so this is not an external API break. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
40 lines
862 B
Go
40 lines
862 B
Go
package client // import "github.com/docker/docker/client"
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"net/url"
|
|
|
|
"github.com/docker/docker/api/types/image"
|
|
)
|
|
|
|
// ImageRemove removes an image from the docker host.
|
|
func (cli *Client) ImageRemove(ctx context.Context, imageID string, options image.RemoveOptions) ([]image.DeleteResponse, error) {
|
|
query := url.Values{}
|
|
|
|
if options.Force {
|
|
query.Set("force", "1")
|
|
}
|
|
if !options.PruneChildren {
|
|
query.Set("noprune", "1")
|
|
}
|
|
|
|
if len(options.Platforms) > 0 {
|
|
p, err := encodePlatforms(options.Platforms...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
query["platforms"] = p
|
|
}
|
|
|
|
resp, err := cli.delete(ctx, "/images/"+imageID, query, nil)
|
|
defer ensureReaderClosed(resp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
var dels []image.DeleteResponse
|
|
err = json.NewDecoder(resp.Body).Decode(&dels)
|
|
return dels, err
|
|
}
|