1
0
mirror of https://github.com/rancher/os.git synced 2025-06-20 20:21:54 +00:00

Move multiple user-docker images to rancher/os-dind

This commit is contained in:
niusmallnan 2018-12-13 10:24:08 +08:00
parent 846bb25ecb
commit 1b15e7ae36
2 changed files with 16 additions and 15 deletions

View File

@ -31,10 +31,6 @@ import (
"golang.org/x/net/context" "golang.org/x/net/context"
) )
var (
SupportedDindVersions = []string{"cnrancher/docker:17.12.1-dind", "cnrancher/docker:18.03.1-dind"}
)
func engineSubcommands() []cli.Command { func engineSubcommands() []cli.Command {
return []cli.Command{ return []cli.Command{
{ {
@ -54,15 +50,16 @@ func engineSubcommands() []cli.Command {
}, },
{ {
Name: "create", Name: "create",
Usage: "create user Docker engine without a reboot", Usage: "create Dind engine without a reboot",
Description: "must switch user docker to 17.12.1 or earlier if using Dind",
ArgsUsage: "<name>", ArgsUsage: "<name>",
Before: preFlightValidate, Before: preFlightValidate,
Action: engineCreate, Action: engineCreate,
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{ cli.StringFlag{
Name: "version, v", Name: "version, v",
Value: SupportedDindVersions[0], Value: config.DefaultDind,
Usage: "set the version for the engine", Usage: fmt.Sprintf("set the version for the engine, %s are available", config.SupportedDinds),
}, },
cli.StringFlag{ cli.StringFlag{
Name: "network", Name: "network",
@ -79,7 +76,7 @@ func engineSubcommands() []cli.Command {
}, },
cli.StringFlag{ cli.StringFlag{
Name: "authorized-keys", Name: "authorized-keys",
Usage: "set the ssh authorized_keys path for the engine", Usage: "set the ssh authorized_keys absolute path for the engine",
}, },
}, },
}, },
@ -414,7 +411,7 @@ func preFlightValidate(c *cli.Context) error {
} }
isVersionMatch := false isVersionMatch := false
for _, v := range SupportedDindVersions { for _, v := range config.SupportedDinds {
if v == version { if v == version {
isVersionMatch = true isVersionMatch = true
break break
@ -422,7 +419,7 @@ func preFlightValidate(c *cli.Context) error {
} }
if !isVersionMatch { if !isVersionMatch {
return errors.Errorf("Engine version not supported only %v are supported", SupportedDindVersions) return errors.Errorf("Engine version not supported only %v are supported", config.SupportedDinds)
} }
addr, err := net.ResolveTCPAddr("tcp", "localhost:"+strconv.Itoa(port)) addr, err := net.ResolveTCPAddr("tcp", "localhost:"+strconv.Itoa(port))
@ -495,7 +492,6 @@ func generateEngineCompose(name, version string, sshPort int, authorizedKeys, ne
Volumes: volumes, Volumes: volumes,
VolumesFrom: []string{}, VolumesFrom: []string{},
Command: composeYaml.Command{ Command: composeYaml.Command{
"dockerd-entrypoint.sh",
"--storage-driver=overlay2", "--storage-driver=overlay2",
"--data-root=" + config.MultiDockerDataDir + "/" + name, "--data-root=" + config.MultiDockerDataDir + "/" + name,
"--host=unix://" + config.MultiDockerDataDir + "/" + name + "/docker-" + name + ".sock", "--host=unix://" + config.MultiDockerDataDir + "/" + name + "/docker-" + name + ".sock",

View File

@ -25,6 +25,7 @@ const (
SystemImages = "images-system.tar" SystemImages = "images-system.tar"
Debug = false Debug = false
SystemDockerBin = "/usr/bin/system-dockerd" SystemDockerBin = "/usr/bin/system-dockerd"
DefaultDind = "rancher/os-dind:17.12.1"
DetachLabel = "io.rancher.os.detach" DetachLabel = "io.rancher.os.detach"
CreateOnlyLabel = "io.rancher.os.createonly" CreateOnlyLabel = "io.rancher.os.createonly"
@ -77,6 +78,10 @@ var (
"rancher.autologin", "rancher.autologin",
"EXTRA_CMDLINE", "EXTRA_CMDLINE",
} }
SupportedDinds = []string{
"rancher/os-dind:17.12.1",
"rancher/os-dind:18.03.1",
}
) )
func init() { func init() {