Merge pull request #7490 from crosbymichael/reexec

Use argv0 as reexec implementation for dockerinit
Upstream-commit: 01995ebebb3f26a2bd1e1131b5794e8b6b6ae18e
Component: engine
This commit is contained in:
Victor Vieux
2014-08-11 18:43:34 -07:00
15 changed files with 217 additions and 214 deletions

View File

@ -8,10 +8,6 @@ import (
const CanDaemon = false
func mainSysinit() {
log.Fatal("This is a client-only binary - running it as 'dockerinit' is not supported.")
}
func mainDaemon() {
log.Fatal("This is a client-only binary - running the Docker daemon is not supported.")
}

View File

@ -7,20 +7,16 @@ import (
"net"
"github.com/docker/docker/builtins"
_ "github.com/docker/docker/daemon/execdriver/lxc"
_ "github.com/docker/docker/daemon/execdriver/native"
"github.com/docker/docker/dockerversion"
"github.com/docker/docker/engine"
flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/pkg/signal"
"github.com/docker/docker/sysinit"
)
const CanDaemon = true
func mainSysinit() {
// Running in init mode
sysinit.SysInit()
}
func mainDaemon() {
if flag.NArg() != 0 {
flag.Usage()

View File

@ -13,6 +13,7 @@ import (
"github.com/docker/docker/api/client"
"github.com/docker/docker/dockerversion"
flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/reexec"
"github.com/docker/docker/utils"
)
@ -23,8 +24,7 @@ const (
)
func main() {
if selfPath := utils.SelfPath(); strings.Contains(selfPath, ".dockerinit") {
mainSysinit()
if reexec.Init() {
return
}