1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Remove deprecated environment.MinimalBaseImage()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2018-01-15 15:31:02 +01:00
parent da8032d7d3
commit dfedc9ef62
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
6 changed files with 30 additions and 36 deletions

View file

@ -47,7 +47,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsBindNamedPipe(c *check.C) {
name := "test-bind-npipe" name := "test-bind-npipe"
data := map[string]interface{}{ data := map[string]interface{}{
"Image": testEnv.MinimalBaseImage(), "Image": testEnv.PlatformDefaults.BaseImage,
"Cmd": []string{"cmd", "/c", cmd}, "Cmd": []string{"cmd", "/c", cmd},
"HostConfig": map[string]interface{}{"Mounts": []map[string]interface{}{{"Type": "npipe", "Source": hostPipeName, "Target": containerPipeName}}}, "HostConfig": map[string]interface{}{"Mounts": []map[string]interface{}{{"Type": "npipe", "Source": hostPipeName, "Target": containerPipeName}}},
} }

View file

@ -603,7 +603,7 @@ RUN [ $(cat "/test dir/test_file6") = 'test6' ]`, command, command, command, com
func (s *DockerSuite) TestBuildCopyFileWithWhitespaceOnWindows(c *check.C) { func (s *DockerSuite) TestBuildCopyFileWithWhitespaceOnWindows(c *check.C) {
testRequires(c, DaemonIsWindows) testRequires(c, DaemonIsWindows)
dockerfile := `FROM ` + testEnv.MinimalBaseImage() + ` dockerfile := `FROM ` + testEnv.PlatformDefaults.BaseImage + `
RUN mkdir "C:/test dir" RUN mkdir "C:/test dir"
RUN mkdir "C:/test_dir" RUN mkdir "C:/test_dir"
COPY [ "test file1", "/test_file1" ] COPY [ "test file1", "/test_file1" ]
@ -5148,7 +5148,7 @@ func (s *DockerSuite) TestBuildWorkdirWindowsPath(c *check.C) {
testRequires(c, DaemonIsWindows) testRequires(c, DaemonIsWindows)
name := "testbuildworkdirwindowspath" name := "testbuildworkdirwindowspath"
buildImageSuccessfully(c, name, build.WithDockerfile(` buildImageSuccessfully(c, name, build.WithDockerfile(`
FROM `+testEnv.MinimalBaseImage()+` FROM `+testEnv.PlatformDefaults.BaseImage+`
RUN mkdir C:\\work RUN mkdir C:\\work
WORKDIR C:\\work WORKDIR C:\\work
RUN if "%CD%" NEQ "C:\work" exit -1 RUN if "%CD%" NEQ "C:\work" exit -1
@ -6143,7 +6143,7 @@ func (s *DockerTrustSuite) TestBuildMultiStageTrusted(c *check.C) {
func (s *DockerSuite) TestBuildMultiStageMultipleBuildsWindows(c *check.C) { func (s *DockerSuite) TestBuildMultiStageMultipleBuildsWindows(c *check.C) {
testRequires(c, DaemonIsWindows) testRequires(c, DaemonIsWindows)
dockerfile := ` dockerfile := `
FROM ` + testEnv.MinimalBaseImage() + ` FROM ` + testEnv.PlatformDefaults.BaseImage + `
COPY foo c:\\bar` COPY foo c:\\bar`
ctx := fakecontext.New(c, "", ctx := fakecontext.New(c, "",
fakecontext.WithDockerfile(dockerfile), fakecontext.WithDockerfile(dockerfile),
@ -6156,7 +6156,7 @@ func (s *DockerSuite) TestBuildMultiStageMultipleBuildsWindows(c *check.C) {
dockerfile = ` dockerfile = `
FROM build1:latest FROM build1:latest
FROM ` + testEnv.MinimalBaseImage() + ` FROM ` + testEnv.PlatformDefaults.BaseImage + `
COPY --from=0 c:\\bar / COPY --from=0 c:\\bar /
COPY foo /` COPY foo /`
ctx = fakecontext.New(c, "", ctx = fakecontext.New(c, "",
@ -6177,8 +6177,8 @@ func (s *DockerSuite) TestBuildMultiStageMultipleBuildsWindows(c *check.C) {
func (s *DockerSuite) TestBuildCopyFromForbidWindowsSystemPaths(c *check.C) { func (s *DockerSuite) TestBuildCopyFromForbidWindowsSystemPaths(c *check.C) {
testRequires(c, DaemonIsWindows) testRequires(c, DaemonIsWindows)
dockerfile := ` dockerfile := `
FROM ` + testEnv.MinimalBaseImage() + ` FROM ` + testEnv.PlatformDefaults.BaseImage + `
FROM ` + testEnv.MinimalBaseImage() + ` FROM ` + testEnv.PlatformDefaults.BaseImage + `
COPY --from=0 %s c:\\oscopy COPY --from=0 %s c:\\oscopy
` `
exp := icmd.Expected{ exp := icmd.Expected{
@ -6194,8 +6194,8 @@ func (s *DockerSuite) TestBuildCopyFromForbidWindowsSystemPaths(c *check.C) {
func (s *DockerSuite) TestBuildCopyFromForbidWindowsRelativePaths(c *check.C) { func (s *DockerSuite) TestBuildCopyFromForbidWindowsRelativePaths(c *check.C) {
testRequires(c, DaemonIsWindows) testRequires(c, DaemonIsWindows)
dockerfile := ` dockerfile := `
FROM ` + testEnv.MinimalBaseImage() + ` FROM ` + testEnv.PlatformDefaults.BaseImage + `
FROM ` + testEnv.MinimalBaseImage() + ` FROM ` + testEnv.PlatformDefaults.BaseImage + `
COPY --from=0 %s c:\\oscopy COPY --from=0 %s c:\\oscopy
` `
exp := icmd.Expected{ exp := icmd.Expected{
@ -6212,9 +6212,9 @@ func (s *DockerSuite) TestBuildCopyFromForbidWindowsRelativePaths(c *check.C) {
func (s *DockerSuite) TestBuildCopyFromWindowsIsCaseInsensitive(c *check.C) { func (s *DockerSuite) TestBuildCopyFromWindowsIsCaseInsensitive(c *check.C) {
testRequires(c, DaemonIsWindows) testRequires(c, DaemonIsWindows)
dockerfile := ` dockerfile := `
FROM ` + testEnv.MinimalBaseImage() + ` FROM ` + testEnv.PlatformDefaults.BaseImage + `
COPY foo / COPY foo /
FROM ` + testEnv.MinimalBaseImage() + ` FROM ` + testEnv.PlatformDefaults.BaseImage + `
COPY --from=0 c:\\fOo c:\\copied COPY --from=0 c:\\fOo c:\\copied
RUN type c:\\copied RUN type c:\\copied
` `
@ -6294,7 +6294,7 @@ func (s *DockerSuite) TestBuildOpaqueDirectory(c *check.C) {
func (s *DockerSuite) TestBuildWindowsUser(c *check.C) { func (s *DockerSuite) TestBuildWindowsUser(c *check.C) {
testRequires(c, DaemonIsWindows) testRequires(c, DaemonIsWindows)
name := "testbuildwindowsuser" name := "testbuildwindowsuser"
buildImage(name, build.WithDockerfile(`FROM `+testEnv.MinimalBaseImage()+` buildImage(name, build.WithDockerfile(`FROM `+testEnv.PlatformDefaults.BaseImage+`
RUN net user user /add RUN net user user /add
USER user USER user
RUN set username RUN set username
@ -6325,7 +6325,7 @@ func (s *DockerSuite) TestBuildWindowsEnvCaseInsensitive(c *check.C) {
testRequires(c, DaemonIsWindows) testRequires(c, DaemonIsWindows)
name := "testbuildwindowsenvcaseinsensitive" name := "testbuildwindowsenvcaseinsensitive"
buildImageSuccessfully(c, name, build.WithDockerfile(` buildImageSuccessfully(c, name, build.WithDockerfile(`
FROM `+testEnv.MinimalBaseImage()+` FROM `+testEnv.PlatformDefaults.BaseImage+`
ENV FOO=bar foo=baz ENV FOO=bar foo=baz
`)) `))
res := inspectFieldJSON(c, name, "Config.Env") res := inspectFieldJSON(c, name, "Config.Env")

View file

@ -225,7 +225,7 @@ func (s *DockerSuite) TestCreateHostnameWithNumber(c *check.C) {
image := "busybox" image := "busybox"
// Busybox on Windows does not implement hostname command // Busybox on Windows does not implement hostname command
if testEnv.DaemonPlatform() == "windows" { if testEnv.DaemonPlatform() == "windows" {
image = testEnv.MinimalBaseImage() image = testEnv.PlatformDefaults.BaseImage
} }
out, _ := dockerCmd(c, "run", "-h", "web.0", image, "hostname") out, _ := dockerCmd(c, "run", "-h", "web.0", image, "hostname")
c.Assert(strings.TrimSpace(out), checker.Equals, "web.0", check.Commentf("hostname not set, expected `web.0`, got: %s", out)) c.Assert(strings.TrimSpace(out), checker.Equals, "web.0", check.Commentf("hostname not set, expected `web.0`, got: %s", out))

View file

@ -75,7 +75,7 @@ func (s *DockerSuite) TestRunLookupGoogleDNS(c *check.C) {
if testEnv.DaemonPlatform() == "windows" { if testEnv.DaemonPlatform() == "windows" {
// nslookup isn't present in Windows busybox. Is built-in. Further, // nslookup isn't present in Windows busybox. Is built-in. Further,
// nslookup isn't present in nanoserver. Hence just use PowerShell... // nslookup isn't present in nanoserver. Hence just use PowerShell...
dockerCmd(c, "run", testEnv.MinimalBaseImage(), "powershell", "Resolve-DNSName", "google.com") dockerCmd(c, "run", testEnv.PlatformDefaults.BaseImage, "powershell", "Resolve-DNSName", "google.com")
} else { } else {
dockerCmd(c, "run", "busybox", "nslookup", "google.com") dockerCmd(c, "run", "busybox", "nslookup", "google.com")
} }
@ -162,7 +162,7 @@ func (s *DockerSuite) TestRunWithoutNetworking(c *check.C) {
image := "busybox" image := "busybox"
if testEnv.DaemonPlatform() == "windows" { if testEnv.DaemonPlatform() == "windows" {
count = "-n" count = "-n"
image = testEnv.MinimalBaseImage() image = testEnv.PlatformDefaults.BaseImage
} }
// First using the long form --net // First using the long form --net
@ -355,7 +355,7 @@ func (s *DockerSuite) TestRunWithVolumesFromExited(c *check.C) {
// Create a file in a volume // Create a file in a volume
if testEnv.DaemonPlatform() == "windows" { if testEnv.DaemonPlatform() == "windows" {
out, exitCode = dockerCmd(c, "run", "--name", "test-data", "--volume", `c:\some\dir`, testEnv.MinimalBaseImage(), "cmd", "/c", `echo hello > c:\some\dir\file`) out, exitCode = dockerCmd(c, "run", "--name", "test-data", "--volume", `c:\some\dir`, testEnv.PlatformDefaults.BaseImage, "cmd", "/c", `echo hello > c:\some\dir\file`)
} else { } else {
out, exitCode = dockerCmd(c, "run", "--name", "test-data", "--volume", "/some/dir", "busybox", "touch", "/some/dir/file") out, exitCode = dockerCmd(c, "run", "--name", "test-data", "--volume", "/some/dir", "busybox", "touch", "/some/dir/file")
} }
@ -365,7 +365,7 @@ func (s *DockerSuite) TestRunWithVolumesFromExited(c *check.C) {
// Read the file from another container using --volumes-from to access the volume in the second container // Read the file from another container using --volumes-from to access the volume in the second container
if testEnv.DaemonPlatform() == "windows" { if testEnv.DaemonPlatform() == "windows" {
out, exitCode = dockerCmd(c, "run", "--volumes-from", "test-data", testEnv.MinimalBaseImage(), "cmd", "/c", `type c:\some\dir\file`) out, exitCode = dockerCmd(c, "run", "--volumes-from", "test-data", testEnv.PlatformDefaults.BaseImage, "cmd", "/c", `type c:\some\dir\file`)
} else { } else {
out, exitCode = dockerCmd(c, "run", "--volumes-from", "test-data", "busybox", "cat", "/some/dir/file") out, exitCode = dockerCmd(c, "run", "--volumes-from", "test-data", "busybox", "cat", "/some/dir/file")
} }
@ -407,7 +407,7 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir(c *check.C) {
f.Close() f.Close()
if testEnv.DaemonPlatform() == "windows" { if testEnv.DaemonPlatform() == "windows" {
dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir %s\nRUN mklink /D c:\\test %s", testEnv.MinimalBaseImage(), dir, dir) dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir %s\nRUN mklink /D c:\\test %s", testEnv.PlatformDefaults.BaseImage, dir, dir)
containerPath = `c:\test\test` containerPath = `c:\test\test`
cmd = "tasklist" cmd = "tasklist"
} else { } else {
@ -432,7 +432,7 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir2(c *check.C) {
name := "test-volume-symlink2" name := "test-volume-symlink2"
if testEnv.DaemonPlatform() == "windows" { if testEnv.DaemonPlatform() == "windows" {
dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir c:\\%s\nRUN mklink /D c:\\test c:\\%s", testEnv.MinimalBaseImage(), name, name) dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir c:\\%s\nRUN mklink /D c:\\test c:\\%s", testEnv.PlatformDefaults.BaseImage, name, name)
containerPath = `c:\test\test` containerPath = `c:\test\test`
cmd = "tasklist" cmd = "tasklist"
} else { } else {
@ -670,7 +670,7 @@ func (s *DockerSuite) TestRunVolumesFromSymlinkPath(c *check.C) {
if testEnv.DaemonPlatform() == "windows" { if testEnv.DaemonPlatform() == "windows" {
prefix = `c:` prefix = `c:`
dfContents = `FROM ` + testEnv.MinimalBaseImage() + ` dfContents = `FROM ` + testEnv.PlatformDefaults.BaseImage + `
RUN mkdir c:\home RUN mkdir c:\home
RUN mklink /D c:\foo c:\home RUN mklink /D c:\foo c:\home
VOLUME ["c:/foo/bar"] VOLUME ["c:/foo/bar"]
@ -922,7 +922,7 @@ func (s *DockerSuite) TestRunEnvironmentOverride(c *check.C) {
func (s *DockerSuite) TestRunContainerNetwork(c *check.C) { func (s *DockerSuite) TestRunContainerNetwork(c *check.C) {
if testEnv.DaemonPlatform() == "windows" { if testEnv.DaemonPlatform() == "windows" {
// Windows busybox does not have ping. Use built in ping instead. // Windows busybox does not have ping. Use built in ping instead.
dockerCmd(c, "run", testEnv.MinimalBaseImage(), "ping", "-n", "1", "127.0.0.1") dockerCmd(c, "run", testEnv.PlatformDefaults.BaseImage, "ping", "-n", "1", "127.0.0.1")
} else { } else {
dockerCmd(c, "run", "busybox", "ping", "-c", "1", "127.0.0.1") dockerCmd(c, "run", "busybox", "ping", "-c", "1", "127.0.0.1")
} }
@ -1231,7 +1231,7 @@ func (s *DockerSuite) TestRunRootWorkdir(c *check.C) {
func (s *DockerSuite) TestRunAllowBindMountingRoot(c *check.C) { func (s *DockerSuite) TestRunAllowBindMountingRoot(c *check.C) {
if testEnv.DaemonPlatform() == "windows" { if testEnv.DaemonPlatform() == "windows" {
// Windows busybox will fail with Permission Denied on items such as pagefile.sys // Windows busybox will fail with Permission Denied on items such as pagefile.sys
dockerCmd(c, "run", "-v", `c:\:c:\host`, testEnv.MinimalBaseImage(), "cmd", "-c", "dir", `c:\host`) dockerCmd(c, "run", "-v", `c:\:c:\host`, testEnv.PlatformDefaults.BaseImage, "cmd", "-c", "dir", `c:\host`)
} else { } else {
dockerCmd(c, "run", "-v", "/:/host", "busybox", "ls", "/host") dockerCmd(c, "run", "-v", "/:/host", "busybox", "ls", "/host")
} }
@ -1705,14 +1705,14 @@ func (s *DockerSuite) TestRunCleanupCmdOnEntrypoint(c *check.C) {
out = strings.TrimSpace(out) out = strings.TrimSpace(out)
expected := "root" expected := "root"
if testEnv.DaemonPlatform() == "windows" { if testEnv.DaemonPlatform() == "windows" {
if strings.Contains(testEnv.MinimalBaseImage(), "windowsservercore") { if strings.Contains(testEnv.PlatformDefaults.BaseImage, "windowsservercore") {
expected = `user manager\containeradministrator` expected = `user manager\containeradministrator`
} else { } else {
expected = `ContainerAdministrator` // nanoserver expected = `ContainerAdministrator` // nanoserver
} }
} }
if out != expected { if out != expected {
c.Fatalf("Expected output %s, got %q. %s", expected, out, testEnv.MinimalBaseImage()) c.Fatalf("Expected output %s, got %q. %s", expected, out, testEnv.PlatformDefaults.BaseImage)
} }
} }
@ -1944,7 +1944,7 @@ func (s *DockerSuite) TestRunCidFileCleanupIfEmpty(c *check.C) {
image := "emptyfs" image := "emptyfs"
if testEnv.DaemonPlatform() == "windows" { if testEnv.DaemonPlatform() == "windows" {
// Windows can't support an emptyfs image. Just use the regular Windows image // Windows can't support an emptyfs image. Just use the regular Windows image
image = testEnv.MinimalBaseImage() image = testEnv.PlatformDefaults.BaseImage
} }
out, _, err := dockerCmdWithError("run", "--cidfile", tmpCidFile, image) out, _, err := dockerCmdWithError("run", "--cidfile", tmpCidFile, image)
if err == nil { if err == nil {
@ -2561,7 +2561,7 @@ func (s *DockerSuite) TestRunNonLocalMacAddress(c *check.C) {
if testEnv.DaemonPlatform() != "windows" { if testEnv.DaemonPlatform() != "windows" {
args = append(args, "busybox", "ifconfig") args = append(args, "busybox", "ifconfig")
} else { } else {
args = append(args, testEnv.MinimalBaseImage(), "ipconfig", "/all") args = append(args, testEnv.PlatformDefaults.BaseImage, "ipconfig", "/all")
expected = strings.Replace(strings.ToUpper(addr), ":", "-", -1) expected = strings.Replace(strings.ToUpper(addr), ":", "-", -1)
} }
@ -3483,7 +3483,7 @@ func (s *DockerSuite) TestRunLoopbackOnlyExistsWhenNetworkingDisabled(c *check.C
// Issue #4681 // Issue #4681
func (s *DockerSuite) TestRunLoopbackWhenNetworkDisabled(c *check.C) { func (s *DockerSuite) TestRunLoopbackWhenNetworkDisabled(c *check.C) {
if testEnv.DaemonPlatform() == "windows" { if testEnv.DaemonPlatform() == "windows" {
dockerCmd(c, "run", "--net=none", testEnv.MinimalBaseImage(), "ping", "-n", "1", "127.0.0.1") dockerCmd(c, "run", "--net=none", testEnv.PlatformDefaults.BaseImage, "ping", "-n", "1", "127.0.0.1")
} else { } else {
dockerCmd(c, "run", "--net=none", "busybox", "ping", "-c", "1", "127.0.0.1") dockerCmd(c, "run", "--net=none", "busybox", "ping", "-c", "1", "127.0.0.1")
} }
@ -4253,7 +4253,7 @@ func (s *DockerSuite) TestRunServicingContainer(c *check.C) {
c.Skip("Disabled on post-RS3 builds") c.Skip("Disabled on post-RS3 builds")
} }
out := cli.DockerCmd(c, "run", "-d", testEnv.MinimalBaseImage(), "cmd", "/c", "mkdir c:\\programdata\\Microsoft\\Windows\\ContainerUpdates\\000_000_d99f45d0-ffc8-4af7-bd9c-ea6a62e035c9_200 && sc control cexecsvc 255").Combined() out := cli.DockerCmd(c, "run", "-d", testEnv.PlatformDefaults.BaseImage, "cmd", "/c", "mkdir c:\\programdata\\Microsoft\\Windows\\ContainerUpdates\\000_000_d99f45d0-ffc8-4af7-bd9c-ea6a62e035c9_200 && sc control cexecsvc 255").Combined()
containerID := strings.TrimSpace(out) containerID := strings.TrimSpace(out)
cli.WaitExited(c, containerID, 60*time.Second) cli.WaitExited(c, containerID, 60*time.Second)

View file

@ -399,7 +399,7 @@ func runSleepingContainerInImage(c *check.C, image string, extraArgs ...string)
// minimalBaseImage returns the name of the minimal base image for the current // minimalBaseImage returns the name of the minimal base image for the current
// daemon platform. // daemon platform.
func minimalBaseImage() string { func minimalBaseImage() string {
return testEnv.MinimalBaseImage() return testEnv.PlatformDefaults.BaseImage
} }
func getGoroutineNumber() (int, error) { func getGoroutineNumber() (int, error) {

View file

@ -57,9 +57,3 @@ func New() (*Execution, error) {
func (e *Execution) DaemonPlatform() string { func (e *Execution) DaemonPlatform() string {
return e.OSType return e.OSType
} }
// MinimalBaseImage is the image used for minimal builds (it depends on the platform)
// Deprecated: use Execution.PlatformDefaults.BaseImage
func (e *Execution) MinimalBaseImage() string {
return e.PlatformDefaults.BaseImage
}