Merge pull request #765 from dlorenc/buildrootenv

Add docker-env options to the buildroot provisioner.
pull/766/head
Jimmi Dyson 2016-10-28 10:09:58 +01:00 committed by GitHub
commit d80b108313
2 changed files with 11 additions and 3 deletions

View File

@ -68,7 +68,8 @@ Type=notify
# DOCKER_RAMDISK disables pivot_root in Docker, using MS_MOVE instead.
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 }}
ExecReload=/bin/kill -s HUP $MAINPID

View File

@ -38,10 +38,17 @@ func TestDockerEnv(t *testing.T) {
minikubeRunner.RunCommand(startCmd, true)
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)
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)
}
}