mirror of
https://github.com/containers/podman.git
synced 2025-09-13 02:24:31 +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>
46 lines
1.0 KiB
Go
46 lines
1.0 KiB
Go
package docker
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
)
|
|
|
|
// KillContainerOptions represents the set of options that can be used in a
|
|
// call to KillContainer.
|
|
//
|
|
// See https://goo.gl/JnTxXZ for more details.
|
|
type KillContainerOptions struct {
|
|
// The ID of the container.
|
|
ID string `qs:"-"`
|
|
|
|
// The signal to send to the container. When omitted, Docker server
|
|
// will assume SIGKILL.
|
|
Signal Signal
|
|
Context context.Context
|
|
}
|
|
|
|
// KillContainer sends a signal to a container, returning an error in case of
|
|
// failure.
|
|
//
|
|
// See https://goo.gl/JnTxXZ for more details.
|
|
func (c *Client) KillContainer(opts KillContainerOptions) error {
|
|
path := "/containers/" + opts.ID + "/kill" + "?" + queryString(opts)
|
|
resp, err := c.do(http.MethodPost, path, doOptions{context: opts.Context})
|
|
if err != nil {
|
|
e, ok := err.(*Error)
|
|
if !ok {
|
|
return err
|
|
}
|
|
switch e.Status {
|
|
case http.StatusNotFound:
|
|
return &NoSuchContainer{ID: opts.ID}
|
|
case http.StatusConflict:
|
|
return &ContainerNotRunning{ID: opts.ID}
|
|
default:
|
|
return err
|
|
}
|
|
}
|
|
resp.Body.Close()
|
|
return nil
|
|
}
|