mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00

Add a new "image" mount type to `--mount`. The source of the mount is the name or ID of an image. The destination is the path inside the container. Image mounts further support an optional `rw,readwrite` parameter which if set to "true" will yield the mount writable inside the container. Note that no changes are propagated to the image mount on the host (which in any case is read only). Mounts are overlay mounts. To support read-only overlay mounts, vendor a non-release version of Buildah. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
package docker
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
// PruneContainersOptions specify parameters to the PruneContainers function.
|
|
//
|
|
// See https://goo.gl/wnkgDT for more details.
|
|
type PruneContainersOptions struct {
|
|
Filters map[string][]string
|
|
Context context.Context
|
|
}
|
|
|
|
// PruneContainersResults specify results from the PruneContainers function.
|
|
//
|
|
// See https://goo.gl/wnkgDT for more details.
|
|
type PruneContainersResults struct {
|
|
ContainersDeleted []string
|
|
SpaceReclaimed int64
|
|
}
|
|
|
|
// PruneContainers deletes containers which are stopped.
|
|
//
|
|
// See https://goo.gl/wnkgDT for more details.
|
|
func (c *Client) PruneContainers(opts PruneContainersOptions) (*PruneContainersResults, error) {
|
|
path := "/containers/prune?" + queryString(opts)
|
|
resp, err := c.do(http.MethodPost, path, doOptions{context: opts.Context})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer resp.Body.Close()
|
|
var results PruneContainersResults
|
|
if err := json.NewDecoder(resp.Body).Decode(&results); err != nil {
|
|
return nil, err
|
|
}
|
|
return &results, nil
|
|
}
|