|
@@ -67,10 +67,10 @@ func (s *DockerSuite) TestRunLeakyFileDescriptors(c *check.C) {
|
|
// this will fail when Internet access is unavailable
|
|
// this will fail when Internet access is unavailable
|
|
func (s *DockerSuite) TestRunLookupGoogleDNS(c *check.C) {
|
|
func (s *DockerSuite) TestRunLookupGoogleDNS(c *check.C) {
|
|
testRequires(c, Network, NotArm)
|
|
testRequires(c, Network, NotArm)
|
|
- if 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", WindowsBaseImage, "powershell", "Resolve-DNSName", "google.com")
|
|
|
|
|
|
+ dockerCmd(c, "run", testEnv.MinimalBaseImage(), "powershell", "Resolve-DNSName", "google.com")
|
|
} else {
|
|
} else {
|
|
dockerCmd(c, "run", "busybox", "nslookup", "google.com")
|
|
dockerCmd(c, "run", "busybox", "nslookup", "google.com")
|
|
}
|
|
}
|
|
@@ -132,7 +132,7 @@ func (s *DockerSuite) TestRunDetachedContainerIDPrinting(c *check.C) {
|
|
func (s *DockerSuite) TestRunWorkingDirectory(c *check.C) {
|
|
func (s *DockerSuite) TestRunWorkingDirectory(c *check.C) {
|
|
dir := "/root"
|
|
dir := "/root"
|
|
image := "busybox"
|
|
image := "busybox"
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
dir = `C:/Windows`
|
|
dir = `C:/Windows`
|
|
}
|
|
}
|
|
|
|
|
|
@@ -155,9 +155,9 @@ func (s *DockerSuite) TestRunWorkingDirectory(c *check.C) {
|
|
func (s *DockerSuite) TestRunWithoutNetworking(c *check.C) {
|
|
func (s *DockerSuite) TestRunWithoutNetworking(c *check.C) {
|
|
count := "-c"
|
|
count := "-c"
|
|
image := "busybox"
|
|
image := "busybox"
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
count = "-n"
|
|
count = "-n"
|
|
- image = WindowsBaseImage
|
|
|
|
|
|
+ image = testEnv.MinimalBaseImage()
|
|
}
|
|
}
|
|
|
|
|
|
// First using the long form --net
|
|
// First using the long form --net
|
|
@@ -349,8 +349,8 @@ func (s *DockerSuite) TestRunWithVolumesFromExited(c *check.C) {
|
|
)
|
|
)
|
|
|
|
|
|
// Create a file in a volume
|
|
// Create a file in a volume
|
|
- if daemonPlatform == "windows" {
|
|
|
|
- out, exitCode = dockerCmd(c, "run", "--name", "test-data", "--volume", `c:\some\dir`, WindowsBaseImage, "cmd", "/c", `echo hello > c:\some\dir\file`)
|
|
|
|
|
|
+ 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`)
|
|
} 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")
|
|
}
|
|
}
|
|
@@ -359,8 +359,8 @@ 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 daemonPlatform == "windows" {
|
|
|
|
- out, exitCode = dockerCmd(c, "run", "--volumes-from", "test-data", WindowsBaseImage, "cmd", "/c", `type c:\some\dir\file`)
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
|
|
+ out, exitCode = dockerCmd(c, "run", "--volumes-from", "test-data", testEnv.MinimalBaseImage(), "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")
|
|
}
|
|
}
|
|
@@ -391,7 +391,7 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir(c *check.C) {
|
|
// In the case of Windows to Windows CI, if the machine is setup so that
|
|
// In the case of Windows to Windows CI, if the machine is setup so that
|
|
// the temp directory is not the C: drive, this test is invalid and will
|
|
// the temp directory is not the C: drive, this test is invalid and will
|
|
// not work.
|
|
// not work.
|
|
- if daemonPlatform == "windows" && strings.ToLower(dir[:1]) != "c" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" && strings.ToLower(dir[:1]) != "c" {
|
|
c.Skip("Requires TEMP to point to C: drive")
|
|
c.Skip("Requires TEMP to point to C: drive")
|
|
}
|
|
}
|
|
|
|
|
|
@@ -401,8 +401,8 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir(c *check.C) {
|
|
}
|
|
}
|
|
f.Close()
|
|
f.Close()
|
|
|
|
|
|
- if daemonPlatform == "windows" {
|
|
|
|
- dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir %s\nRUN mklink /D c:\\test %s", WindowsBaseImage, dir, dir)
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
|
|
+ dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir %s\nRUN mklink /D c:\\test %s", testEnv.MinimalBaseImage(), dir, dir)
|
|
containerPath = `c:\test\test`
|
|
containerPath = `c:\test\test`
|
|
cmd = "tasklist"
|
|
cmd = "tasklist"
|
|
} else {
|
|
} else {
|
|
@@ -429,8 +429,8 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir2(c *check.C) {
|
|
testRequires(c, SameHostDaemon, DaemonIsLinux)
|
|
testRequires(c, SameHostDaemon, DaemonIsLinux)
|
|
name := "test-volume-symlink2"
|
|
name := "test-volume-symlink2"
|
|
|
|
|
|
- if daemonPlatform == "windows" {
|
|
|
|
- dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir c:\\%s\nRUN mklink /D c:\\test c:\\%s", WindowsBaseImage, name, name)
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
|
|
+ dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir c:\\%s\nRUN mklink /D c:\\test c:\\%s", testEnv.MinimalBaseImage(), name, name)
|
|
containerPath = `c:\test\test`
|
|
containerPath = `c:\test\test`
|
|
cmd = "tasklist"
|
|
cmd = "tasklist"
|
|
} else {
|
|
} else {
|
|
@@ -456,7 +456,7 @@ func (s *DockerSuite) TestRunVolumesFromInReadonlyModeFails(c *check.C) {
|
|
volumeDir string
|
|
volumeDir string
|
|
fileInVol string
|
|
fileInVol string
|
|
)
|
|
)
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
volumeDir = `c:/test` // Forward-slash as using busybox
|
|
volumeDir = `c:/test` // Forward-slash as using busybox
|
|
fileInVol = `c:/test/file`
|
|
fileInVol = `c:/test/file`
|
|
} else {
|
|
} else {
|
|
@@ -477,7 +477,7 @@ func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *check.C) {
|
|
volumeDir string
|
|
volumeDir string
|
|
fileInVol string
|
|
fileInVol string
|
|
)
|
|
)
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
volumeDir = `c:/test` // Forward-slash as using busybox
|
|
volumeDir = `c:/test` // Forward-slash as using busybox
|
|
fileInVol = `c:/test/file`
|
|
fileInVol = `c:/test/file`
|
|
} else {
|
|
} else {
|
|
@@ -498,7 +498,7 @@ func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *check.C) {
|
|
func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) {
|
|
func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) {
|
|
testRequires(c, SameHostDaemon)
|
|
testRequires(c, SameHostDaemon)
|
|
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
|
prefix, slash := getPrefixAndSlashFromDaemonPlatform()
|
|
- hostpath := testutil.RandomTmpDirPath("test", daemonPlatform)
|
|
|
|
|
|
+ hostpath := testutil.RandomTmpDirPath("test", testEnv.DaemonPlatform())
|
|
if err := os.MkdirAll(hostpath, 0755); err != nil {
|
|
if err := os.MkdirAll(hostpath, 0755); err != nil {
|
|
c.Fatalf("Failed to create %s: %q", hostpath, err)
|
|
c.Fatalf("Failed to create %s: %q", hostpath, err)
|
|
}
|
|
}
|
|
@@ -521,11 +521,11 @@ func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) {
|
|
|
|
|
|
// Test for GH#10618
|
|
// Test for GH#10618
|
|
func (s *DockerSuite) TestRunNoDupVolumes(c *check.C) {
|
|
func (s *DockerSuite) TestRunNoDupVolumes(c *check.C) {
|
|
- path1 := testutil.RandomTmpDirPath("test1", daemonPlatform)
|
|
|
|
- path2 := testutil.RandomTmpDirPath("test2", daemonPlatform)
|
|
|
|
|
|
+ path1 := testutil.RandomTmpDirPath("test1", testEnv.DaemonPlatform())
|
|
|
|
+ path2 := testutil.RandomTmpDirPath("test2", testEnv.DaemonPlatform())
|
|
|
|
|
|
someplace := ":/someplace"
|
|
someplace := ":/someplace"
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
// Windows requires that the source directory exists before calling HCS
|
|
// Windows requires that the source directory exists before calling HCS
|
|
testRequires(c, SameHostDaemon)
|
|
testRequires(c, SameHostDaemon)
|
|
someplace = `:c:\someplace`
|
|
someplace = `:c:\someplace`
|
|
@@ -574,7 +574,7 @@ func (s *DockerSuite) TestRunNoDupVolumes(c *check.C) {
|
|
// Test for #1351
|
|
// Test for #1351
|
|
func (s *DockerSuite) TestRunApplyVolumesFromBeforeVolumes(c *check.C) {
|
|
func (s *DockerSuite) TestRunApplyVolumesFromBeforeVolumes(c *check.C) {
|
|
prefix := ""
|
|
prefix := ""
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
prefix = `c:`
|
|
prefix = `c:`
|
|
}
|
|
}
|
|
dockerCmd(c, "run", "--name", "parent", "-v", prefix+"/test", "busybox", "touch", prefix+"/test/foo")
|
|
dockerCmd(c, "run", "--name", "parent", "-v", prefix+"/test", "busybox", "touch", prefix+"/test/foo")
|
|
@@ -583,7 +583,7 @@ func (s *DockerSuite) TestRunApplyVolumesFromBeforeVolumes(c *check.C) {
|
|
|
|
|
|
func (s *DockerSuite) TestRunMultipleVolumesFrom(c *check.C) {
|
|
func (s *DockerSuite) TestRunMultipleVolumesFrom(c *check.C) {
|
|
prefix := ""
|
|
prefix := ""
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
prefix = `c:`
|
|
prefix = `c:`
|
|
}
|
|
}
|
|
dockerCmd(c, "run", "--name", "parent1", "-v", prefix+"/test", "busybox", "touch", prefix+"/test/foo")
|
|
dockerCmd(c, "run", "--name", "parent1", "-v", prefix+"/test", "busybox", "touch", prefix+"/test/foo")
|
|
@@ -613,7 +613,7 @@ func (s *DockerSuite) TestRunVerifyContainerID(c *check.C) {
|
|
// Test that creating a container with a volume doesn't crash. Regression test for #995.
|
|
// Test that creating a container with a volume doesn't crash. Regression test for #995.
|
|
func (s *DockerSuite) TestRunCreateVolume(c *check.C) {
|
|
func (s *DockerSuite) TestRunCreateVolume(c *check.C) {
|
|
prefix := ""
|
|
prefix := ""
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
prefix = `c:`
|
|
prefix = `c:`
|
|
}
|
|
}
|
|
dockerCmd(c, "run", "-v", prefix+"/var/lib/data", "busybox", "true")
|
|
dockerCmd(c, "run", "-v", prefix+"/var/lib/data", "busybox", "true")
|
|
@@ -669,9 +669,9 @@ func (s *DockerSuite) TestRunVolumesFromSymlinkPath(c *check.C) {
|
|
RUN ln -s home /foo
|
|
RUN ln -s home /foo
|
|
VOLUME ["/foo/bar"]`
|
|
VOLUME ["/foo/bar"]`
|
|
|
|
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
prefix = `c:`
|
|
prefix = `c:`
|
|
- dfContents = `FROM ` + WindowsBaseImage + `
|
|
|
|
|
|
+ dfContents = `FROM ` + testEnv.MinimalBaseImage() + `
|
|
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"]
|
|
@@ -715,7 +715,7 @@ func (s *DockerSuite) TestRunExitCode(c *check.C) {
|
|
|
|
|
|
func (s *DockerSuite) TestRunUserDefaults(c *check.C) {
|
|
func (s *DockerSuite) TestRunUserDefaults(c *check.C) {
|
|
expected := "uid=0(root) gid=0(root)"
|
|
expected := "uid=0(root) gid=0(root)"
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
expected = "uid=1000(ContainerAdministrator) gid=1000(ContainerAdministrator)"
|
|
expected = "uid=1000(ContainerAdministrator) gid=1000(ContainerAdministrator)"
|
|
}
|
|
}
|
|
out, _ := dockerCmd(c, "run", "busybox", "id")
|
|
out, _ := dockerCmd(c, "run", "busybox", "id")
|
|
@@ -921,9 +921,9 @@ func (s *DockerSuite) TestRunEnvironmentOverride(c *check.C) {
|
|
}
|
|
}
|
|
|
|
|
|
func (s *DockerSuite) TestRunContainerNetwork(c *check.C) {
|
|
func (s *DockerSuite) TestRunContainerNetwork(c *check.C) {
|
|
- if 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", WindowsBaseImage, "ping", "-n", "1", "127.0.0.1")
|
|
|
|
|
|
+ dockerCmd(c, "run", testEnv.MinimalBaseImage(), "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")
|
|
}
|
|
}
|
|
@@ -1221,7 +1221,7 @@ func (s *DockerSuite) TestRunModeHostname(c *check.C) {
|
|
func (s *DockerSuite) TestRunRootWorkdir(c *check.C) {
|
|
func (s *DockerSuite) TestRunRootWorkdir(c *check.C) {
|
|
out, _ := dockerCmd(c, "run", "--workdir", "/", "busybox", "pwd")
|
|
out, _ := dockerCmd(c, "run", "--workdir", "/", "busybox", "pwd")
|
|
expected := "/\n"
|
|
expected := "/\n"
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
expected = "C:" + expected
|
|
expected = "C:" + expected
|
|
}
|
|
}
|
|
if out != expected {
|
|
if out != expected {
|
|
@@ -1230,9 +1230,9 @@ func (s *DockerSuite) TestRunRootWorkdir(c *check.C) {
|
|
}
|
|
}
|
|
|
|
|
|
func (s *DockerSuite) TestRunAllowBindMountingRoot(c *check.C) {
|
|
func (s *DockerSuite) TestRunAllowBindMountingRoot(c *check.C) {
|
|
- if 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`, WindowsBaseImage, "cmd", "-c", "dir", `c:\host`)
|
|
|
|
|
|
+ dockerCmd(c, "run", "-v", `c:\:c:\host`, testEnv.MinimalBaseImage(), "cmd", "-c", "dir", `c:\host`)
|
|
} else {
|
|
} else {
|
|
dockerCmd(c, "run", "-v", "/:/host", "busybox", "ls", "/host")
|
|
dockerCmd(c, "run", "-v", "/:/host", "busybox", "ls", "/host")
|
|
}
|
|
}
|
|
@@ -1241,7 +1241,7 @@ func (s *DockerSuite) TestRunAllowBindMountingRoot(c *check.C) {
|
|
func (s *DockerSuite) TestRunDisallowBindMountingRootToRoot(c *check.C) {
|
|
func (s *DockerSuite) TestRunDisallowBindMountingRootToRoot(c *check.C) {
|
|
mount := "/:/"
|
|
mount := "/:/"
|
|
targetDir := "/host"
|
|
targetDir := "/host"
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
mount = `c:\:c\`
|
|
mount = `c:\:c\`
|
|
targetDir = "c:/host" // Forward slash as using busybox
|
|
targetDir = "c:/host" // Forward slash as using busybox
|
|
}
|
|
}
|
|
@@ -1753,15 +1753,15 @@ func (s *DockerSuite) TestRunCleanupCmdOnEntrypoint(c *check.C) {
|
|
}
|
|
}
|
|
out = strings.TrimSpace(out)
|
|
out = strings.TrimSpace(out)
|
|
expected := "root"
|
|
expected := "root"
|
|
- if daemonPlatform == "windows" {
|
|
|
|
- if strings.Contains(WindowsBaseImage, "windowsservercore") {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
|
|
+ if strings.Contains(testEnv.MinimalBaseImage(), "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, WindowsBaseImage)
|
|
|
|
|
|
+ c.Fatalf("Expected output %s, got %q. %s", expected, out, testEnv.MinimalBaseImage())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1769,7 +1769,7 @@ func (s *DockerSuite) TestRunCleanupCmdOnEntrypoint(c *check.C) {
|
|
func (s *DockerSuite) TestRunWorkdirExistsAndIsFile(c *check.C) {
|
|
func (s *DockerSuite) TestRunWorkdirExistsAndIsFile(c *check.C) {
|
|
existingFile := "/bin/cat"
|
|
existingFile := "/bin/cat"
|
|
expected := "not a directory"
|
|
expected := "not a directory"
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
existingFile = `\windows\system32\ntdll.dll`
|
|
existingFile = `\windows\system32\ntdll.dll`
|
|
expected = `Cannot mkdir: \windows\system32\ntdll.dll is not a directory.`
|
|
expected = `Cannot mkdir: \windows\system32\ntdll.dll is not a directory.`
|
|
}
|
|
}
|
|
@@ -1785,7 +1785,7 @@ func (s *DockerSuite) TestRunExitOnStdinClose(c *check.C) {
|
|
|
|
|
|
meow := "/bin/cat"
|
|
meow := "/bin/cat"
|
|
delay := 60
|
|
delay := 60
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
meow = "cat"
|
|
meow = "cat"
|
|
}
|
|
}
|
|
runCmd := exec.Command(dockerBinary, "run", "--name", name, "-i", "busybox", meow)
|
|
runCmd := exec.Command(dockerBinary, "run", "--name", name, "-i", "busybox", meow)
|
|
@@ -1932,7 +1932,7 @@ func (s *DockerSuite) TestRunEntrypoint(c *check.C) {
|
|
|
|
|
|
func (s *DockerSuite) TestRunBindMounts(c *check.C) {
|
|
func (s *DockerSuite) TestRunBindMounts(c *check.C) {
|
|
testRequires(c, SameHostDaemon)
|
|
testRequires(c, SameHostDaemon)
|
|
- if daemonPlatform == "linux" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "linux" {
|
|
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
|
testRequires(c, DaemonIsLinux, NotUserNamespace)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1953,7 +1953,7 @@ func (s *DockerSuite) TestRunBindMounts(c *check.C) {
|
|
}
|
|
}
|
|
|
|
|
|
// test writing to bind mount
|
|
// test writing to bind mount
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
dockerCmd(c, "run", "-v", fmt.Sprintf(`%s:c:\tmp:rw`, tmpDir), "busybox", "touch", "c:/tmp/holla")
|
|
dockerCmd(c, "run", "-v", fmt.Sprintf(`%s:c:\tmp:rw`, tmpDir), "busybox", "touch", "c:/tmp/holla")
|
|
} else {
|
|
} else {
|
|
dockerCmd(c, "run", "-v", fmt.Sprintf("%s:/tmp:rw", tmpDir), "busybox", "touch", "/tmp/holla")
|
|
dockerCmd(c, "run", "-v", fmt.Sprintf("%s:/tmp:rw", tmpDir), "busybox", "touch", "/tmp/holla")
|
|
@@ -1968,7 +1968,7 @@ func (s *DockerSuite) TestRunBindMounts(c *check.C) {
|
|
}
|
|
}
|
|
|
|
|
|
// Windows does not (and likely never will) support mounting a single file
|
|
// Windows does not (and likely never will) support mounting a single file
|
|
- if daemonPlatform != "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() != "windows" {
|
|
// test mount a file
|
|
// test mount a file
|
|
dockerCmd(c, "run", "-v", fmt.Sprintf("%s/holla:/tmp/holla:rw", tmpDir), "busybox", "sh", "-c", "echo -n 'yotta' > /tmp/holla")
|
|
dockerCmd(c, "run", "-v", fmt.Sprintf("%s/holla:/tmp/holla:rw", tmpDir), "busybox", "sh", "-c", "echo -n 'yotta' > /tmp/holla")
|
|
content := readFile(path.Join(tmpDir, "holla"), c) // Will fail if the file doesn't exist
|
|
content := readFile(path.Join(tmpDir, "holla"), c) // Will fail if the file doesn't exist
|
|
@@ -1993,9 +1993,9 @@ func (s *DockerSuite) TestRunCidFileCleanupIfEmpty(c *check.C) {
|
|
tmpCidFile := path.Join(tmpDir, "cid")
|
|
tmpCidFile := path.Join(tmpDir, "cid")
|
|
|
|
|
|
image := "emptyfs"
|
|
image := "emptyfs"
|
|
- if 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 = WindowsBaseImage
|
|
|
|
|
|
+ image = testEnv.MinimalBaseImage()
|
|
}
|
|
}
|
|
out, _, err := dockerCmdWithError("run", "--cidfile", tmpCidFile, image)
|
|
out, _, err := dockerCmdWithError("run", "--cidfile", tmpCidFile, image)
|
|
if err == nil {
|
|
if err == nil {
|
|
@@ -2039,7 +2039,7 @@ func (s *DockerSuite) TestRunCidFileCheckIDLength(c *check.C) {
|
|
func (s *DockerSuite) TestRunSetMacAddress(c *check.C) {
|
|
func (s *DockerSuite) TestRunSetMacAddress(c *check.C) {
|
|
mac := "12:34:56:78:9a:bc"
|
|
mac := "12:34:56:78:9a:bc"
|
|
var out string
|
|
var out string
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
out, _ = dockerCmd(c, "run", "-i", "--rm", fmt.Sprintf("--mac-address=%s", mac), "busybox", "sh", "-c", "ipconfig /all | grep 'Physical Address' | awk '{print $12}'")
|
|
out, _ = dockerCmd(c, "run", "-i", "--rm", fmt.Sprintf("--mac-address=%s", mac), "busybox", "sh", "-c", "ipconfig /all | grep 'Physical Address' | awk '{print $12}'")
|
|
mac = strings.Replace(strings.ToUpper(mac), ":", "-", -1) // To Windows-style MACs
|
|
mac = strings.Replace(strings.ToUpper(mac), ":", "-", -1) // To Windows-style MACs
|
|
} else {
|
|
} else {
|
|
@@ -2243,7 +2243,7 @@ func (s *DockerSuite) TestVolumesNoCopyData(c *check.C) {
|
|
c.Fatalf("Data was copied on volumes-from but shouldn't be:\n%q", out)
|
|
c.Fatalf("Data was copied on volumes-from but shouldn't be:\n%q", out)
|
|
}
|
|
}
|
|
|
|
|
|
- tmpDir := testutil.RandomTmpDirPath("docker_test_bind_mount_copy_data", daemonPlatform)
|
|
|
|
|
|
+ tmpDir := testutil.RandomTmpDirPath("docker_test_bind_mount_copy_data", testEnv.DaemonPlatform())
|
|
if out, _, err := dockerCmdWithError("run", "-v", tmpDir+":/foo", "dataimage", "ls", "-lh", "/foo/bar"); err == nil || !strings.Contains(out, "No such file or directory") {
|
|
if out, _, err := dockerCmdWithError("run", "-v", tmpDir+":/foo", "dataimage", "ls", "-lh", "/foo/bar"); err == nil || !strings.Contains(out, "No such file or directory") {
|
|
c.Fatalf("Data was copied on bind-mount but shouldn't be:\n%q", out)
|
|
c.Fatalf("Data was copied on bind-mount but shouldn't be:\n%q", out)
|
|
}
|
|
}
|
|
@@ -2281,7 +2281,7 @@ func (s *DockerSuite) TestRunVolumesCleanPaths(c *check.C) {
|
|
|
|
|
|
out, err = inspectMountSourceField("dark_helmet", prefix+slash+`foo`)
|
|
out, err = inspectMountSourceField("dark_helmet", prefix+slash+`foo`)
|
|
c.Assert(err, check.IsNil)
|
|
c.Assert(err, check.IsNil)
|
|
- if !strings.Contains(strings.ToLower(out), strings.ToLower(volumesConfigPath)) {
|
|
|
|
|
|
+ if !strings.Contains(strings.ToLower(out), strings.ToLower(testEnv.VolumesConfigPath())) {
|
|
c.Fatalf("Volume was not defined for %s/foo\n%q", prefix, out)
|
|
c.Fatalf("Volume was not defined for %s/foo\n%q", prefix, out)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2292,7 +2292,7 @@ func (s *DockerSuite) TestRunVolumesCleanPaths(c *check.C) {
|
|
|
|
|
|
out, err = inspectMountSourceField("dark_helmet", prefix+slash+"bar")
|
|
out, err = inspectMountSourceField("dark_helmet", prefix+slash+"bar")
|
|
c.Assert(err, check.IsNil)
|
|
c.Assert(err, check.IsNil)
|
|
- if !strings.Contains(strings.ToLower(out), strings.ToLower(volumesConfigPath)) {
|
|
|
|
|
|
+ if !strings.Contains(strings.ToLower(out), strings.ToLower(testEnv.VolumesConfigPath())) {
|
|
c.Fatalf("Volume was not defined for %s/bar\n%q", prefix, out)
|
|
c.Fatalf("Volume was not defined for %s/bar\n%q", prefix, out)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2662,10 +2662,10 @@ func (s *DockerSuite) TestRunNonLocalMacAddress(c *check.C) {
|
|
args := []string{"run", "--mac-address", addr}
|
|
args := []string{"run", "--mac-address", addr}
|
|
expected := addr
|
|
expected := addr
|
|
|
|
|
|
- if daemonPlatform != "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() != "windows" {
|
|
args = append(args, "busybox", "ifconfig")
|
|
args = append(args, "busybox", "ifconfig")
|
|
} else {
|
|
} else {
|
|
- args = append(args, WindowsBaseImage, "ipconfig", "/all")
|
|
|
|
|
|
+ args = append(args, testEnv.MinimalBaseImage(), "ipconfig", "/all")
|
|
expected = strings.Replace(strings.ToUpper(addr), ":", "-", -1)
|
|
expected = strings.Replace(strings.ToUpper(addr), ":", "-", -1)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2758,7 +2758,7 @@ func (s *DockerSuite) TestRunSetDefaultRestartPolicy(c *check.C) {
|
|
func (s *DockerSuite) TestRunRestartMaxRetries(c *check.C) {
|
|
func (s *DockerSuite) TestRunRestartMaxRetries(c *check.C) {
|
|
out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "false")
|
|
out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "false")
|
|
timeout := 10 * time.Second
|
|
timeout := 10 * time.Second
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
timeout = 120 * time.Second
|
|
timeout = 120 * time.Second
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3133,7 +3133,7 @@ func (s *DockerSuite) TestVolumeFromMixedRWOptions(c *check.C) {
|
|
dockerCmd(c, "run", "--volumes-from", "parent:ro", "--name", "test-volumes-1", "busybox", "true")
|
|
dockerCmd(c, "run", "--volumes-from", "parent:ro", "--name", "test-volumes-1", "busybox", "true")
|
|
dockerCmd(c, "run", "--volumes-from", "parent:rw", "--name", "test-volumes-2", "busybox", "true")
|
|
dockerCmd(c, "run", "--volumes-from", "parent:rw", "--name", "test-volumes-2", "busybox", "true")
|
|
|
|
|
|
- if daemonPlatform != "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() != "windows" {
|
|
mRO, err := inspectMountPoint("test-volumes-1", prefix+slash+"test")
|
|
mRO, err := inspectMountPoint("test-volumes-1", prefix+slash+"test")
|
|
c.Assert(err, checker.IsNil, check.Commentf("failed to inspect mount point"))
|
|
c.Assert(err, checker.IsNil, check.Commentf("failed to inspect mount point"))
|
|
if mRO.RW {
|
|
if mRO.RW {
|
|
@@ -3607,8 +3607,8 @@ 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 daemonPlatform == "windows" {
|
|
|
|
- dockerCmd(c, "run", "--net=none", WindowsBaseImage, "ping", "-n", "1", "127.0.0.1")
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
|
|
+ dockerCmd(c, "run", "--net=none", testEnv.MinimalBaseImage(), "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")
|
|
}
|
|
}
|
|
@@ -3874,7 +3874,7 @@ func (s *DockerSuite) TestRunNonExistingCmd(c *check.C) {
|
|
// as that's when the check is made (and yes, by its design...)
|
|
// as that's when the check is made (and yes, by its design...)
|
|
func (s *DockerSuite) TestCmdCannotBeInvoked(c *check.C) {
|
|
func (s *DockerSuite) TestCmdCannotBeInvoked(c *check.C) {
|
|
expected := 126
|
|
expected := 126
|
|
- if daemonPlatform == "windows" {
|
|
|
|
|
|
+ if testEnv.DaemonPlatform() == "windows" {
|
|
expected = 127
|
|
expected = 127
|
|
}
|
|
}
|
|
name := "testCmdCannotBeInvoked"
|
|
name := "testCmdCannotBeInvoked"
|
|
@@ -4311,7 +4311,7 @@ func (s *DockerSuite) TestRunCredentialSpecFailures(c *check.C) {
|
|
func (s *DockerSuite) TestRunCredentialSpecWellFormed(c *check.C) {
|
|
func (s *DockerSuite) TestRunCredentialSpecWellFormed(c *check.C) {
|
|
testRequires(c, DaemonIsWindows, SameHostDaemon)
|
|
testRequires(c, DaemonIsWindows, SameHostDaemon)
|
|
validCS := readFile(`fixtures\credentialspecs\valid.json`, c)
|
|
validCS := readFile(`fixtures\credentialspecs\valid.json`, c)
|
|
- writeFile(filepath.Join(dockerBasePath, `credentialspecs\valid.json`), validCS, c)
|
|
|
|
|
|
+ writeFile(filepath.Join(testEnv.DockerBasePath(), `credentialspecs\valid.json`), validCS, c)
|
|
dockerCmd(c, "run", `--security-opt=credentialspec=file://valid.json`, "busybox", "true")
|
|
dockerCmd(c, "run", `--security-opt=credentialspec=file://valid.json`, "busybox", "true")
|
|
}
|
|
}
|
|
|
|
|
|
@@ -4321,7 +4321,7 @@ func (s *DockerSuite) TestRunCredentialSpecWellFormed(c *check.C) {
|
|
func (s *DockerSuite) TestRunServicingContainer(c *check.C) {
|
|
func (s *DockerSuite) TestRunServicingContainer(c *check.C) {
|
|
testRequires(c, DaemonIsWindows, SameHostDaemon)
|
|
testRequires(c, DaemonIsWindows, SameHostDaemon)
|
|
|
|
|
|
- out, _ := dockerCmd(c, "run", "-d", WindowsBaseImage, "cmd", "/c", "mkdir c:\\programdata\\Microsoft\\Windows\\ContainerUpdates\\000_000_d99f45d0-ffc8-4af7-bd9c-ea6a62e035c9_200 && sc control cexecsvc 255")
|
|
|
|
|
|
+ out, _ := 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")
|
|
containerID := strings.TrimSpace(out)
|
|
containerID := strings.TrimSpace(out)
|
|
err := waitExited(containerID, 60*time.Second)
|
|
err := waitExited(containerID, 60*time.Second)
|
|
c.Assert(err, checker.IsNil)
|
|
c.Assert(err, checker.IsNil)
|