Destroy destroys the container, if its in a valid state. Any event registrations are removed before the container is destroyed. No error is returned if the container is already destroyed. Running containers must first be stopped using Signal. Paused containers must first be resumed using Resume.
()
| 748 | // Running containers must first be stopped using Signal. |
| 749 | // Paused containers must first be resumed using Resume. |
| 750 | func (c *Container) Destroy() error { |
| 751 | c.m.Lock() |
| 752 | defer c.m.Unlock() |
| 753 | if err := c.state.destroy(); err != nil { |
| 754 | return fmt.Errorf("unable to destroy container: %w", err) |
| 755 | } |
| 756 | return nil |
| 757 | } |
| 758 | |
| 759 | // Pause pauses the container, if its state is RUNNING or CREATED, changing |
| 760 | // its state to PAUSED. If the state is already PAUSED, does nothing. |