add more commands in container manager menu

Signed-off-by: xiechengsheng <XIE1995@whut.edu.cn>
This commit is contained in:
xiechengsheng
2018-06-22 15:41:16 +08:00
parent a3b8585697
commit f7a3d38d6b
6 changed files with 91 additions and 0 deletions

View File

@@ -42,3 +42,24 @@ func (dc *Docker) Remove() error {
}
return nil
}
func (dc *Docker) Pause() error {
if err := dc.client.PauseContainer(dc.id); err != nil {
return fmt.Errorf("cannot pause container: %v", err)
}
return nil
}
func (dc *Docker) Unpause() error {
if err := dc.client.UnpauseContainer(dc.id); err != nil {
return fmt.Errorf("cannot unpause container: %v", err)
}
return nil
}
func (dc *Docker) Restart() error {
if err := dc.client.RestartContainer(dc.id, 3); err != nil {
return fmt.Errorf("cannot restart container: %v", err)
}
return nil
}