summaryrefslogtreecommitdiff
path: root/vendor/github.com/fsouza/go-dockerclient/container_start.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-29 18:15:24 +0100
committerGitHub <noreply@github.com>2020-10-29 18:15:24 +0100
commitc8f0e1dab602ed94af95dc4f604f161696f249e0 (patch)
tree1d8fe4e091300aa7c2c6e61fcb1a509c382974b0 /vendor/github.com/fsouza/go-dockerclient/container_start.go
parente439aec4fa867cda0672079dac0fe394dfb3306c (diff)
parent65a618886efc48562e5b9ff99ca630c83622419b (diff)
downloadpodman-c8f0e1dab602ed94af95dc4f604f161696f249e0.tar.gz
podman-c8f0e1dab602ed94af95dc4f604f161696f249e0.tar.bz2
podman-c8f0e1dab602ed94af95dc4f604f161696f249e0.zip
Merge pull request #8146 from vrothberg/image-mounts
new "image" mount type
Diffstat (limited to 'vendor/github.com/fsouza/go-dockerclient/container_start.go')
-rw-r--r--vendor/github.com/fsouza/go-dockerclient/container_start.go56
1 files changed, 56 insertions, 0 deletions
diff --git a/vendor/github.com/fsouza/go-dockerclient/container_start.go b/vendor/github.com/fsouza/go-dockerclient/container_start.go
new file mode 100644
index 000000000..5edb29438
--- /dev/null
+++ b/vendor/github.com/fsouza/go-dockerclient/container_start.go
@@ -0,0 +1,56 @@
+package docker
+
+import (
+ "context"
+ "net/http"
+)
+
+// StartContainer starts a container, returning an error in case of failure.
+//
+// Passing the HostConfig to this method has been deprecated in Docker API 1.22
+// (Docker Engine 1.10.x) and totally removed in Docker API 1.24 (Docker Engine
+// 1.12.x). The client will ignore the parameter when communicating with Docker
+// API 1.24 or greater.
+//
+// See https://goo.gl/fbOSZy for more details.
+func (c *Client) StartContainer(id string, hostConfig *HostConfig) error {
+ return c.startContainer(id, hostConfig, doOptions{})
+}
+
+// StartContainerWithContext starts a container, returning an error in case of
+// failure. The context can be used to cancel the outstanding start container
+// request.
+//
+// Passing the HostConfig to this method has been deprecated in Docker API 1.22
+// (Docker Engine 1.10.x) and totally removed in Docker API 1.24 (Docker Engine
+// 1.12.x). The client will ignore the parameter when communicating with Docker
+// API 1.24 or greater.
+//
+// See https://goo.gl/fbOSZy for more details.
+//nolint:golint
+func (c *Client) StartContainerWithContext(id string, hostConfig *HostConfig, ctx context.Context) error {
+ return c.startContainer(id, hostConfig, doOptions{context: ctx})
+}
+
+func (c *Client) startContainer(id string, hostConfig *HostConfig, opts doOptions) error {
+ path := "/containers/" + id + "/start"
+ if c.serverAPIVersion == nil {
+ c.checkAPIVersion()
+ }
+ if c.serverAPIVersion != nil && c.serverAPIVersion.LessThan(apiVersion124) {
+ opts.data = hostConfig
+ opts.forceJSON = true
+ }
+ resp, err := c.do(http.MethodPost, path, opts)
+ if err != nil {
+ if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound {
+ return &NoSuchContainer{ID: id, Err: err}
+ }
+ return err
+ }
+ defer resp.Body.Close()
+ if resp.StatusCode == http.StatusNotModified {
+ return &ContainerAlreadyRunning{ID: id}
+ }
+ return nil
+}