MCPcopy Create free account
hub / github.com/containerd/nerdctl / Unpause

Function Unpause

pkg/containerutil/containerutil.go:529–559  ·  view source on GitHub ↗

Unpause unpauses a container by its id.

(ctx context.Context, client *containerd.Client, id string, cfg *config.Config, nerdctlCmd string, nerdctlArgs []string)

Source from the content-addressed store, hash-verified

527
528// Unpause unpauses a container by its id.
529func Unpause(ctx context.Context, client *containerd.Client, id string, cfg *config.Config, nerdctlCmd string, nerdctlArgs []string) error {
530 container, err := client.LoadContainer(ctx, id)
531 if err != nil {
532 return err
533 }
534
535 task, err := container.Task(ctx, cio.Load)
536 if err != nil {
537 return err
538 }
539
540 status, err := task.Status(ctx)
541 if err != nil {
542 return err
543 }
544
545 // Recreate healthcheck related systemd timer/service files.
546 if err := healthcheck.CreateTimer(ctx, container, cfg, nerdctlCmd, nerdctlArgs); err != nil {
547 return fmt.Errorf("failed to create healthcheck timer: %w", err)
548 }
549 if err := healthcheck.StartTimer(ctx, container, cfg); err != nil {
550 return fmt.Errorf("failed to start healthcheck timer: %w", err)
551 }
552
553 switch status.Status {
554 case containerd.Paused:
555 return task.Resume(ctx)
556 default:
557 return fmt.Errorf("container %s is not paused", id)
558 }
559}
560
561// ContainerStateDirPath returns the path to the Nerdctl-managed state directory for the container with the given ID.
562func ContainerStateDirPath(ns, dataStore, id string) (string, error) {

Callers 2

UnpauseMethod · 0.92
UnpauseFunction · 0.92

Calls 2

CreateTimerFunction · 0.92
StartTimerFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…