Merge pull request #765 from dlorenc/buildrootenv
Add docker-env options to the buildroot provisioner.pull/766/head
commit
d80b108313
|
@ -68,7 +68,8 @@ Type=notify
|
||||||
|
|
||||||
# DOCKER_RAMDISK disables pivot_root in Docker, using MS_MOVE instead.
|
# DOCKER_RAMDISK disables pivot_root in Docker, using MS_MOVE instead.
|
||||||
Environment=DOCKER_RAMDISK=yes
|
Environment=DOCKER_RAMDISK=yes
|
||||||
|
{{range .EngineOptions.Env}}Environment={{.}}
|
||||||
|
{{end}}
|
||||||
ExecStart=/usr/bin/docker daemon -H tcp://0.0.0.0:{{.DockerPort}} -H unix:///var/run/docker.sock --tlsverify --tlscacert {{.AuthOptions.CaCertRemotePath}} --tlscert {{.AuthOptions.ServerCertRemotePath}} --tlskey {{.AuthOptions.ServerKeyRemotePath}} {{ range .EngineOptions.Labels }}--label {{.}} {{ end }}{{ range .EngineOptions.InsecureRegistry }}--insecure-registry {{.}} {{ end }}{{ range .EngineOptions.RegistryMirror }}--registry-mirror {{.}} {{ end }}{{ range .EngineOptions.ArbitraryFlags }}--{{.}} {{ end }}
|
ExecStart=/usr/bin/docker daemon -H tcp://0.0.0.0:{{.DockerPort}} -H unix:///var/run/docker.sock --tlsverify --tlscacert {{.AuthOptions.CaCertRemotePath}} --tlscert {{.AuthOptions.ServerCertRemotePath}} --tlskey {{.AuthOptions.ServerKeyRemotePath}} {{ range .EngineOptions.Labels }}--label {{.}} {{ end }}{{ range .EngineOptions.InsecureRegistry }}--insecure-registry {{.}} {{ end }}{{ range .EngineOptions.RegistryMirror }}--registry-mirror {{.}} {{ end }}{{ range .EngineOptions.ArbitraryFlags }}--{{.}} {{ end }}
|
||||||
ExecReload=/bin/kill -s HUP $MAINPID
|
ExecReload=/bin/kill -s HUP $MAINPID
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,17 @@ func TestDockerEnv(t *testing.T) {
|
||||||
minikubeRunner.RunCommand(startCmd, true)
|
minikubeRunner.RunCommand(startCmd, true)
|
||||||
minikubeRunner.EnsureRunning()
|
minikubeRunner.EnsureRunning()
|
||||||
|
|
||||||
profileContents := minikubeRunner.RunCommand("ssh cat /var/lib/boot2docker/profile", true)
|
filename := "/var/lib/boot2docker/profile"
|
||||||
|
// Figure out if it's b2d or buildroot
|
||||||
|
osContents := minikubeRunner.RunCommand("ssh cat /etc/os-release", true)
|
||||||
|
if strings.Contains(osContents, "Name=Buildroot") {
|
||||||
|
filename = "/etc/systemd/system/docker.service"
|
||||||
|
}
|
||||||
|
|
||||||
|
profileContents := minikubeRunner.RunCommand(fmt.Sprintf("ssh sudo cat %s", filename), true)
|
||||||
fmt.Println(profileContents)
|
fmt.Println(profileContents)
|
||||||
for _, envVar := range []string{"FOO=BAR", "BAZ=BAT"} {
|
for _, envVar := range []string{"FOO=BAR", "BAZ=BAT"} {
|
||||||
if !strings.Contains(profileContents, fmt.Sprintf("export \"%s\"", envVar)) {
|
if !strings.Contains(profileContents, envVar) {
|
||||||
t.Fatalf("Env var %s missing from file: %s.", envVar, profileContents)
|
t.Fatalf("Env var %s missing from file: %s.", envVar, profileContents)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue