mirror of
https://github.com/containers/podman.git
synced 2025-07-04 10:10:32 +08:00
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
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user