Call start in containerd
This fixes a sync issue when the containerd api returns after a container has started. It fixes it by calling the runtime start inside containerd after the oom handler has been setup. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
14e79494da
commit
654c537d38
6 changed files with 54 additions and 30 deletions
|
@ -136,13 +136,6 @@ func start(log *os.File) error {
|
|||
Height: uint16(msg.Height),
|
||||
}
|
||||
term.SetWinsize(p.console.Fd(), &ws)
|
||||
case 2:
|
||||
// tell runtime to execute the init process
|
||||
if err := p.start(); err != nil {
|
||||
p.delete()
|
||||
p.Wait()
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,26 +206,6 @@ func (p *process) create() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *process) start() error {
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
logPath := filepath.Join(cwd, "log.json")
|
||||
args := append([]string{
|
||||
"--log", logPath,
|
||||
"--log-format", "json",
|
||||
}, p.state.RuntimeArgs...)
|
||||
args = append(args, "start", p.id)
|
||||
cmd := exec.Command(p.runtime, args...)
|
||||
cmd.Dir = p.bundle
|
||||
cmd.Stdin = p.stdio.stdin
|
||||
cmd.Stdout = p.stdio.stdout
|
||||
cmd.Stderr = p.stdio.stderr
|
||||
cmd.SysProcAttr = setPDeathSig()
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
func (p *process) pid() int {
|
||||
return p.containerPid
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue