Files
.copr
.github
cmd
cni
completions
contrib
dependencies
docs
hack
libpod
logo
nix
pkg
test
utils
vendor
github.com
Azure
BurntSushi
Microsoft
VividCortex
acarl005
beorn7
blang
buger
checkpoint-restore
containerd
containernetworking
containers
coreos
cri-o
cyphar
davecgh
docker
fsnotify
fsouza
go-dockerclient
.gitattributes
.gitignore
.golangci.yaml
AUTHORS
DOCKER-LICENSE
LICENSE
Makefile
README.md
auth.go
change.go
client.go
client_unix.go
client_windows.go
container.go
container_archive.go
container_attach.go
container_changes.go
container_commit.go
container_copy.go
container_create.go
container_export.go
container_inspect.go
container_kill.go
container_list.go
container_logs.go
container_pause.go
container_prune.go
container_remove.go
container_rename.go
container_resize.go
container_restart.go
container_start.go
container_stats.go
container_stop.go
container_top.go
container_unpause.go
container_update.go
container_wait.go
distribution.go
env.go
event.go
exec.go
go.mod
go.sum
image.go
misc.go
network.go
plugin.go
registry_auth.go
signal.go
swarm.go
swarm_configs.go
swarm_node.go
swarm_secrets.go
swarm_service.go
swarm_task.go
system.go
tar.go
tls.go
volume.go
ghodss
go-logr
godbus
gogo
golang
google
gorilla
hashicorp
hpcloud
imdario
inconshreveable
ishidawataru
json-iterator
klauspost
mattn
matttproud
mistifyio
moby
modern-go
morikuni
mrunalp
mtrmac
nxadm
onsi
opencontainers
openshift
opentracing
ostreedev
pkg
pmezard
pquerna
prometheus
rootless-containers
safchain
seccomp
sirupsen
spf13
stretchr
syndtr
tchap
uber
ulikunitz
varlink
vbatts
vbauerster
vishvananda
willf
xeipuuv
go.etcd.io
go.mozilla.org
go.opencensus.io
go.uber.org
golang.org
google.golang.org
gopkg.in
k8s.io
sigs.k8s.io
modules.txt
version
.cirrus.yml
.dockerignore
.gitignore
.golangci.yml
.pre-commit-config.yaml
.ubuntu_prepare.sh
API.md
CODE-OF-CONDUCT.md
CONTRIBUTING.md
LICENSE
Makefile
OWNERS
README.md
RELEASE_NOTES.md
SECURITY.md
Vagrantfile
changelog.txt
commands-demo.md
commands.md
docker
go.mod
go.sum
install.md
rootless.md
transfer.md
troubleshooting.md
podman/vendor/github.com/fsouza/go-dockerclient/container_kill.go
Valentin Rothberg 65a618886e new "image" mount type
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>
2020-10-29 15:06:22 +01:00

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
}