driver/docker: ignore error if container exists before cgroup can be written
This commit is contained in:
parent
49befcb8e0
commit
9d194bb2d9
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue