mirror of
https://github.com/rancher/os.git
synced 2025-07-10 13:23:03 +00:00
Modify how /var/lib/rancher/conf/docker is sourced
This commit is contained in:
parent
bd904fcbda
commit
258a5a173c
@ -22,12 +22,6 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Main() {
|
func Main() {
|
||||||
if os.Getenv("DOCKER_CONF_SOURCED") == "" {
|
|
||||||
if err := sourceDockerConf(os.Args); err != nil {
|
|
||||||
log.Warnf("Failed to source %s: %v", dockerConf, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
if _, err := os.Stat(consoleDone); err == nil {
|
if _, err := os.Stat(consoleDone); err == nil {
|
||||||
break
|
break
|
||||||
@ -70,16 +64,9 @@ func Main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
"dockerlaunch",
|
"bash",
|
||||||
dockerBin,
|
"-c",
|
||||||
}
|
fmt.Sprintf(`[ -e %s ] && source %s; exec /usr/bin/dockerlaunch %s %s $DOCKER_OPTS >> %s 2>&1`, dockerConf, dockerConf, dockerBin, strings.Join(os.Args[1:], " "), dockerLog),
|
||||||
|
|
||||||
if len(os.Args) > 1 {
|
|
||||||
args = append(args, os.Args[1:]...)
|
|
||||||
}
|
|
||||||
|
|
||||||
if os.Getenv("DOCKER_OPTS") != "" {
|
|
||||||
args = append(args, os.Getenv("DOCKER_OPTS"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := config.LoadConfig()
|
cfg := config.LoadConfig()
|
||||||
@ -88,16 +75,5 @@ func Main() {
|
|||||||
log.Error(err)
|
log.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Fatal(syscall.Exec("/usr/bin/dockerlaunch", args, os.Environ()))
|
log.Fatal(syscall.Exec("/bin/bash", args, os.Environ()))
|
||||||
}
|
|
||||||
|
|
||||||
func sourceDockerConf(args []string) error {
|
|
||||||
args = append([]string{
|
|
||||||
"bash",
|
|
||||||
"-c",
|
|
||||||
fmt.Sprintf(`[ -e %s ] && source %s; exec docker-init "$@" >> %s 2>&1`, dockerConf, dockerConf, dockerLog),
|
|
||||||
}, args...)
|
|
||||||
env := os.Environ()
|
|
||||||
env = append(env, "DOCKER_CONF_SOURCED=1")
|
|
||||||
return syscall.Exec("/bin/bash", args, env)
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user