Ver código fonte

Ensure thread is locked in sysinit for docker

Signed-off-by: Michael Crosby <michael@docker.com>
Michael Crosby 11 anos atrás
pai
commit
cd6b903825
1 arquivos alterados com 5 adições e 0 exclusões
  1. 5 0
      sysinit/sysinit.go

+ 5 - 0
sysinit/sysinit.go

@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"log"
 	"os"
+	"runtime"
 
 	"github.com/docker/docker/daemon/execdriver"
 	_ "github.com/docker/docker/daemon/execdriver/lxc"
@@ -23,6 +24,10 @@ func executeProgram(args *execdriver.InitArgs) error {
 // This code is run INSIDE the container and is responsible for setting
 // up the environment before running the actual process
 func SysInit() {
+	// The very first thing that we should do is lock the thread so that other
+	// system level options will work and not have issues, i.e. setns
+	runtime.LockOSThread()
+
 	if len(os.Args) <= 1 {
 		fmt.Println("You should not invoke dockerinit manually")
 		os.Exit(1)