mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Runtime: Automatically use docker-init if it exists
In some builds the main docker binary is not statically linked, and as such not usable in as the .dockerinit binary, for those cases we look for a separately shipped docker-init binary and use that instead.
This commit is contained in:
parent
250bc3f615
commit
0f5ccf934e
1 changed files with 12 additions and 1 deletions
13
runtime.go
13
runtime.go
|
@ -10,6 +10,7 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -42,7 +43,17 @@ type Runtime struct {
|
|||
var sysInitPath string
|
||||
|
||||
func init() {
|
||||
sysInitPath = utils.SelfPath()
|
||||
selfPath := utils.SelfPath()
|
||||
|
||||
// If we have a separate docker-init, use that, otherwise use the
|
||||
// main docker binary
|
||||
dir := filepath.Dir(selfPath)
|
||||
dockerInitPath := filepath.Join(dir, "docker-init")
|
||||
if _, err := os.Stat(dockerInitPath); err != nil {
|
||||
sysInitPath = selfPath
|
||||
} else {
|
||||
sysInitPath = dockerInitPath
|
||||
}
|
||||
}
|
||||
|
||||
// List returns an array of all containers registered in the runtime.
|
||||
|
|
Loading…
Reference in a new issue