2015-05-01 21:03:35 -04:00
|
|
|
package daemon
|
|
|
|
|
2015-09-18 13:48:16 -04:00
|
|
|
import (
|
2015-09-10 18:01:18 -04:00
|
|
|
"github.com/docker/docker/context"
|
2015-09-18 13:48:16 -04:00
|
|
|
derr "github.com/docker/docker/errors"
|
|
|
|
)
|
2015-05-01 21:03:35 -04:00
|
|
|
|
|
|
|
// ContainerPause pauses a container
|
2015-09-10 18:01:18 -04:00
|
|
|
func (daemon *Daemon) ContainerPause(ctx context.Context, name string) error {
|
|
|
|
container, err := daemon.Get(ctx, name)
|
2015-05-01 21:03:35 -04:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2015-09-10 18:01:18 -04:00
|
|
|
if err := container.pause(ctx); err != nil {
|
2015-09-18 13:48:16 -04:00
|
|
|
return derr.ErrorCodePauseError.WithArgs(name, err)
|
2015-05-01 21:03:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|