Skip to content

Commit

Permalink
Merge pull request #10416 from hashicorp/b-cores-docker
Browse files Browse the repository at this point in the history
driver/docker: ignore error if container exists before cgroup can be written
  • Loading branch information
Mahmood Ali committed Jun 9, 2021
2 parents 594ceb7 + aba23b4 commit 646e811
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drivers/docker/driver_linux.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
package docker

import (
"strings"

"github.com/opencontainers/runc/libcontainer/cgroups"
)

func setCPUSetCgroup(path string, pid int) error {
return cgroups.WriteCgroupProc(path, pid)
// Sometimes the container exists before we can write the
// cgroup resulting in an error which can be ignored.
if err := cgroups.WriteCgroupProc(path, pid); err != nil {
if strings.Contains(err.Error(), "no such process") {
return nil
}
return err
}
return nil
}

0 comments on commit 646e811

Please sign in to comment.