mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 14:13:58 +08:00
570eed473b
This adds a new env var for identifying the internal sync pipe that libcontainer uses to sync with the container and parent process. This replaces #496 to allow the user to add additional files to the processes and not take over fd 3 for all containers. Closes #496 Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
28 lines
597 B
Go
28 lines
597 B
Go
package integration
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"runtime"
|
|
|
|
"github.com/docker/libcontainer"
|
|
_ "github.com/docker/libcontainer/nsenter"
|
|
)
|
|
|
|
// init runs the libcontainer initialization code because of the busybox style needs
|
|
// to work around the go runtime and the issues with forking
|
|
func init() {
|
|
if len(os.Args) < 2 || os.Args[1] != "init" {
|
|
return
|
|
}
|
|
runtime.GOMAXPROCS(1)
|
|
runtime.LockOSThread()
|
|
factory, err := libcontainer.New("")
|
|
if err != nil {
|
|
log.Fatalf("unable to initialize for container: %s", err)
|
|
}
|
|
if err := factory.StartInitialization(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|