mirror of
https://github.com/containers/podman.git
synced 2025-10-18 19:53:58 +08:00
Allow Init() on stopped containers
Signed-off-by: Matthew Heon <mheon@redhat.com> Closes: #1068 Approved by: baude
This commit is contained in:
@ -29,7 +29,8 @@ func (c *Container) Init(ctx context.Context) (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.state.State != ContainerStateConfigured {
|
if !(c.state.State == ContainerStateConfigured ||
|
||||||
|
c.state.State == ContainerStateStopped) {
|
||||||
return errors.Wrapf(ErrCtrExists, "container %s has already been created in runtime", c.ID())
|
return errors.Wrapf(ErrCtrExists, "container %s has already been created in runtime", c.ID())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +54,12 @@ func (c *Container) Init(ctx context.Context) (err error) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
if c.state.State == ContainerStateStopped {
|
||||||
|
// Reinitialize the container
|
||||||
|
return c.reinit(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize the container for the first time
|
||||||
return c.init(ctx)
|
return c.init(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user