diff options
author | Matthew Heon <mheon@redhat.com> | 2018-07-09 15:20:43 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-07-09 20:33:09 +0000 |
commit | 4f9b1ae62553efb2f88ec143ed0782585e7d8d51 (patch) | |
tree | 2064356ba19f6e16fee04c5c18d41696a9841f8c /libpod | |
parent | a62b3436db1929b5f73e247f4d1913072db09db1 (diff) | |
download | podman-4f9b1ae62553efb2f88ec143ed0782585e7d8d51.tar.gz podman-4f9b1ae62553efb2f88ec143ed0782585e7d8d51.tar.bz2 podman-4f9b1ae62553efb2f88ec143ed0782585e7d8d51.zip |
Allow Init() on stopped containers
Signed-off-by: Matthew Heon <mheon@redhat.com>
Closes: #1068
Approved by: baude
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_api.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index f4613534c..a3756ac5f 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -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()) } @@ -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) } |