mirror of
https://github.com/rancher/os.git
synced 2025-08-01 06:59:05 +00:00
Wait for userdocker to start
This commit is contained in:
parent
ae5d41b696
commit
a1f912c4d5
19
cmd/wait/wait.go
Normal file
19
cmd/wait/wait.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package wait
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/Sirupsen/logrus"
|
||||||
|
"github.com/rancherio/os/config"
|
||||||
|
"github.com/rancherio/os/docker"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Main() {
|
||||||
|
_, err := docker.NewClient(config.DOCKER_HOST)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("Failed to conect to Docker")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.Infof("Docker is ready")
|
||||||
|
}
|
@ -129,6 +129,7 @@ func NewConfig() *Config {
|
|||||||
"/init:/usr/bin/rancherctl:ro",
|
"/init:/usr/bin/rancherctl:ro",
|
||||||
"/init:/usr/bin/respawn:ro",
|
"/init:/usr/bin/respawn:ro",
|
||||||
"/init:/usr/bin/system-docker:ro",
|
"/init:/usr/bin/system-docker:ro",
|
||||||
|
"/init:/usr/sbin/wait-for-docker:ro",
|
||||||
"/lib/modules:/lib/modules:ro",
|
"/lib/modules:/lib/modules:ro",
|
||||||
"/usr/bin/docker:/usr/bin/docker:ro",
|
"/usr/bin/docker:/usr/bin/docker:ro",
|
||||||
},
|
},
|
||||||
@ -255,6 +256,15 @@ func NewConfig() *Config {
|
|||||||
Links: []string{
|
Links: []string{
|
||||||
"network",
|
"network",
|
||||||
},
|
},
|
||||||
|
"userdockerwait": {
|
||||||
|
Image: "userdockerwait",
|
||||||
|
Net: "host",
|
||||||
|
Labels: []string{
|
||||||
|
"io.rancher.os.detach=false",
|
||||||
|
},
|
||||||
|
Links: []string{
|
||||||
|
"userdocker",
|
||||||
|
},
|
||||||
VolumesFrom: []string{
|
VolumesFrom: []string{
|
||||||
"all-volumes",
|
"all-volumes",
|
||||||
},
|
},
|
||||||
|
4
main.go
4
main.go
@ -8,11 +8,12 @@ import (
|
|||||||
"github.com/docker/docker/pkg/reexec"
|
"github.com/docker/docker/pkg/reexec"
|
||||||
"github.com/rancherio/os/cmd/cloudinit"
|
"github.com/rancherio/os/cmd/cloudinit"
|
||||||
"github.com/rancherio/os/cmd/control"
|
"github.com/rancherio/os/cmd/control"
|
||||||
|
"github.com/rancherio/os/cmd/network"
|
||||||
"github.com/rancherio/os/cmd/power"
|
"github.com/rancherio/os/cmd/power"
|
||||||
"github.com/rancherio/os/cmd/respawn"
|
"github.com/rancherio/os/cmd/respawn"
|
||||||
"github.com/rancherio/os/cmd/sysinit"
|
"github.com/rancherio/os/cmd/sysinit"
|
||||||
"github.com/rancherio/os/cmd/systemdocker"
|
"github.com/rancherio/os/cmd/systemdocker"
|
||||||
"github.com/rancherio/os/cmd/network"
|
"github.com/rancherio/os/cmd/wait"
|
||||||
osInit "github.com/rancherio/os/init"
|
osInit "github.com/rancherio/os/init"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -46,6 +47,7 @@ func main() {
|
|||||||
registerCmd("/usr/sbin/rancherctl", control.Main)
|
registerCmd("/usr/sbin/rancherctl", control.Main)
|
||||||
registerCmd("/usr/bin/cloud-init", cloudinit.Main)
|
registerCmd("/usr/bin/cloud-init", cloudinit.Main)
|
||||||
registerCmd("/usr/sbin/netconf", network.Main)
|
registerCmd("/usr/sbin/netconf", network.Main)
|
||||||
|
registerCmd("/usr/sbin/wait-for-docker", wait.Main)
|
||||||
|
|
||||||
if !reexec.Init() {
|
if !reexec.Init() {
|
||||||
log.Fatalf("Failed to find an entry point for %s", os.Args[0])
|
log.Fatalf("Failed to find an entry point for %s", os.Args[0])
|
||||||
|
2
scripts/dockerimages/11-userdockerwait
Normal file
2
scripts/dockerimages/11-userdockerwait
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
FROM base
|
||||||
|
CMD ["/usr/sbin/wait-for-docker"]
|
Loading…
Reference in New Issue
Block a user