mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
add more commands in container manager menu
Signed-off-by: xiechengsheng <XIE1995@whut.edu.cn>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -4,4 +4,7 @@ type Manager interface {
|
||||
Start() error
|
||||
Stop() error
|
||||
Remove() error
|
||||
Pause() error
|
||||
Unpause() error
|
||||
Restart() error
|
||||
}
|
||||
|
||||
@@ -17,3 +17,15 @@ func (m *Mock) Stop() error {
|
||||
func (m *Mock) Remove() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Mock) Pause() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Mock) Unpause() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Mock) Restart() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -17,3 +17,15 @@ func (rc *Runc) Stop() error {
|
||||
func (rc *Runc) Remove() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rc *Runc) Pause() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rc *Runc) Unpause() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rc *Runc) Restart() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user