summaryrefslogtreecommitdiff
path: root/libpod/runtime_pod_linux.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-09-06 08:29:32 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-09-06 16:16:59 +0000
commita40aa7e9c8d5642e57add77ac3d9b92d174f9add (patch)
treea17c53ad1a1250f0d5ec4dbd24b55c800985860e /libpod/runtime_pod_linux.go
parentbbbbfa582b923746d752e336edcf21135c340fcf (diff)
downloadpodman-a40aa7e9c8d5642e57add77ac3d9b92d174f9add.tar.gz
podman-a40aa7e9c8d5642e57add77ac3d9b92d174f9add.tar.bz2
podman-a40aa7e9c8d5642e57add77ac3d9b92d174f9add.zip
Start pod infra container when pod is created
When we create a pod that also has an infra container, we should start the infra container automatically. This allows users to add running containers to the pod immediately. Signed-off-by: baude <bbaude@redhat.com> Closes: #1415 Approved by: rhatdan
Diffstat (limited to 'libpod/runtime_pod_linux.go')
-rw-r--r--libpod/runtime_pod_linux.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/libpod/runtime_pod_linux.go b/libpod/runtime_pod_linux.go
index 17629defe..dd57007e0 100644
--- a/libpod/runtime_pod_linux.go
+++ b/libpod/runtime_pod_linux.go
@@ -109,6 +109,15 @@ func (r *Runtime) NewPod(ctx context.Context, options ...PodCreateOption) (*Pod,
if err := pod.save(); err != nil {
return nil, err
}
+
+ // Once the pod infra container has been created, we start it
+ if err := ctr.Start(ctx); err != nil {
+ // If the infra container does not start, we need to tear the pod down.
+ if err2 := r.removePod(ctx, pod, true, true); err2 != nil {
+ logrus.Errorf("Error removing pod after infra container failed to start: %v", err2)
+ }
+ return nil, errors.Wrapf(err, "error starting Infra Container")
+ }
}
return pod, nil