mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Windows: Get Integration CLI running
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
		
							parent
							
								
									bc915d0856
								
							
						
					
					
						commit
						f9a3558a9d
					
				
					 55 changed files with 723 additions and 68 deletions
				
			
		| 
						 | 
					@ -59,10 +59,12 @@ type DockerDaemonSuite struct {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerDaemonSuite) SetUpTest(c *check.C) {
 | 
					func (s *DockerDaemonSuite) SetUpTest(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	s.d = NewDaemon(c)
 | 
						s.d = NewDaemon(c)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerDaemonSuite) TearDownTest(c *check.C) {
 | 
					func (s *DockerDaemonSuite) TearDownTest(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	s.d.Stop()
 | 
						s.d.Stop()
 | 
				
			||||||
	s.ds.TearDownTest(c)
 | 
						s.ds.TearDownTest(c)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,6 +13,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestGetContainersAttachWebsocket(c *check.C) {
 | 
					func (s *DockerSuite) TestGetContainersAttachWebsocket(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-dit", "busybox", "cat")
 | 
						out, _ := dockerCmd(c, "run", "-dit", "busybox", "cat")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rwc, err := sockConn(time.Duration(10 * time.Second))
 | 
						rwc, err := sockConn(time.Duration(10 * time.Second))
 | 
				
			||||||
| 
						 | 
					@ -97,6 +98,7 @@ func (s *DockerSuite) TestGetContainersWsAttachContainerNotFound(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPostContainersAttach(c *check.C) {
 | 
					func (s *DockerSuite) TestPostContainersAttach(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-dit", "busybox", "cat")
 | 
						out, _ := dockerCmd(c, "run", "-dit", "busybox", "cat")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	r, w := io.Pipe()
 | 
						r, w := io.Pipe()
 | 
				
			||||||
| 
						 | 
					@ -160,6 +162,7 @@ func (s *DockerSuite) TestPostContainersAttach(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPostContainersAttachStderr(c *check.C) {
 | 
					func (s *DockerSuite) TestPostContainersAttachStderr(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-dit", "busybox", "/bin/sh", "-c", "cat >&2")
 | 
						out, _ := dockerCmd(c, "run", "-dit", "busybox", "/bin/sh", "-c", "cat >&2")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	r, w := io.Pipe()
 | 
						r, w := io.Pipe()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,6 +45,7 @@ func (s *DockerSuite) TestBuildApiDockerfilePath(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestBuildApiDockerFileRemote(c *check.C) {
 | 
					func (s *DockerSuite) TestBuildApiDockerFileRemote(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	server, err := fakeStorage(map[string]string{
 | 
						server, err := fakeStorage(map[string]string{
 | 
				
			||||||
		"testD": `FROM busybox
 | 
							"testD": `FROM busybox
 | 
				
			||||||
COPY * /tmp/
 | 
					COPY * /tmp/
 | 
				
			||||||
| 
						 | 
					@ -75,6 +76,7 @@ RUN find /tmp/`,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestBuildApiRemoteTarballContext(c *check.C) {
 | 
					func (s *DockerSuite) TestBuildApiRemoteTarballContext(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	buffer := new(bytes.Buffer)
 | 
						buffer := new(bytes.Buffer)
 | 
				
			||||||
	tw := tar.NewWriter(buffer)
 | 
						tw := tar.NewWriter(buffer)
 | 
				
			||||||
	defer tw.Close()
 | 
						defer tw.Close()
 | 
				
			||||||
| 
						 | 
					@ -107,6 +109,7 @@ func (s *DockerSuite) TestBuildApiRemoteTarballContext(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestBuildApiRemoteTarballContextWithCustomDockerfile(c *check.C) {
 | 
					func (s *DockerSuite) TestBuildApiRemoteTarballContextWithCustomDockerfile(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	buffer := new(bytes.Buffer)
 | 
						buffer := new(bytes.Buffer)
 | 
				
			||||||
	tw := tar.NewWriter(buffer)
 | 
						tw := tar.NewWriter(buffer)
 | 
				
			||||||
	defer tw.Close()
 | 
						defer tw.Close()
 | 
				
			||||||
| 
						 | 
					@ -161,6 +164,7 @@ RUN echo 'right'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestBuildApiLowerDockerfile(c *check.C) {
 | 
					func (s *DockerSuite) TestBuildApiLowerDockerfile(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	git, err := newFakeGit("repo", map[string]string{
 | 
						git, err := newFakeGit("repo", map[string]string{
 | 
				
			||||||
		"dockerfile": `FROM busybox
 | 
							"dockerfile": `FROM busybox
 | 
				
			||||||
RUN echo from dockerfile`,
 | 
					RUN echo from dockerfile`,
 | 
				
			||||||
| 
						 | 
					@ -186,6 +190,7 @@ RUN echo from dockerfile`,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestBuildApiBuildGitWithF(c *check.C) {
 | 
					func (s *DockerSuite) TestBuildApiBuildGitWithF(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	git, err := newFakeGit("repo", map[string]string{
 | 
						git, err := newFakeGit("repo", map[string]string{
 | 
				
			||||||
		"baz": `FROM busybox
 | 
							"baz": `FROM busybox
 | 
				
			||||||
RUN echo from baz`,
 | 
					RUN echo from baz`,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiGetAll(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiGetAll(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	startCount, err := getContainerCount()
 | 
						startCount, err := getContainerCount()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		c.Fatalf("Cannot query container count: %v", err)
 | 
							c.Fatalf("Cannot query container count: %v", err)
 | 
				
			||||||
| 
						 | 
					@ -51,6 +52,7 @@ func (s *DockerSuite) TestContainerApiGetAll(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// regression test for empty json field being omitted #13691
 | 
					// regression test for empty json field being omitted #13691
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiGetJSONNoFieldsOmitted(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiGetJSONNoFieldsOmitted(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "busybox", "true")
 | 
						dockerCmd(c, "run", "busybox", "true")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	status, body, err := sockRequest("GET", "/containers/json?all=1", nil)
 | 
						status, body, err := sockRequest("GET", "/containers/json?all=1", nil)
 | 
				
			||||||
| 
						 | 
					@ -87,6 +89,7 @@ type containerPs struct {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// regression test for non-empty fields from #13901
 | 
					// regression test for non-empty fields from #13901
 | 
				
			||||||
func (s *DockerSuite) TestContainerPsOmitFields(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerPsOmitFields(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "pstest"
 | 
						name := "pstest"
 | 
				
			||||||
	port := 80
 | 
						port := 80
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", name, "--expose", strconv.Itoa(port), "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", name, "--expose", strconv.Itoa(port), "busybox", "top")
 | 
				
			||||||
| 
						 | 
					@ -118,6 +121,7 @@ func (s *DockerSuite) TestContainerPsOmitFields(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiGetExport(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiGetExport(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "exportcontainer"
 | 
						name := "exportcontainer"
 | 
				
			||||||
	dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test")
 | 
						dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -146,6 +150,7 @@ func (s *DockerSuite) TestContainerApiGetExport(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiGetChanges(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiGetChanges(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "changescontainer"
 | 
						name := "changescontainer"
 | 
				
			||||||
	dockerCmd(c, "run", "--name", name, "busybox", "rm", "/etc/passwd")
 | 
						dockerCmd(c, "run", "--name", name, "busybox", "rm", "/etc/passwd")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -174,6 +179,7 @@ func (s *DockerSuite) TestContainerApiGetChanges(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiStartVolumeBinds(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiStartVolumeBinds(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "testing"
 | 
						name := "testing"
 | 
				
			||||||
	config := map[string]interface{}{
 | 
						config := map[string]interface{}{
 | 
				
			||||||
		"Image":   "busybox",
 | 
							"Image":   "busybox",
 | 
				
			||||||
| 
						 | 
					@ -204,6 +210,7 @@ func (s *DockerSuite) TestContainerApiStartVolumeBinds(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Test for GH#10618
 | 
					// Test for GH#10618
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiStartDupVolumeBinds(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiStartDupVolumeBinds(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "testdups"
 | 
						name := "testdups"
 | 
				
			||||||
	config := map[string]interface{}{
 | 
						config := map[string]interface{}{
 | 
				
			||||||
		"Image":   "busybox",
 | 
							"Image":   "busybox",
 | 
				
			||||||
| 
						 | 
					@ -230,6 +237,7 @@ func (s *DockerSuite) TestContainerApiStartDupVolumeBinds(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiStartVolumesFrom(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiStartVolumesFrom(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	volName := "voltst"
 | 
						volName := "voltst"
 | 
				
			||||||
	volPath := "/tmp"
 | 
						volPath := "/tmp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -267,6 +275,7 @@ func (s *DockerSuite) TestContainerApiStartVolumesFrom(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestGetContainerStats(c *check.C) {
 | 
					func (s *DockerSuite) TestGetContainerStats(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	var (
 | 
						var (
 | 
				
			||||||
		name = "statscontainer"
 | 
							name = "statscontainer"
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
| 
						 | 
					@ -306,6 +315,7 @@ func (s *DockerSuite) TestGetContainerStats(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestGetContainerStatsRmRunning(c *check.C) {
 | 
					func (s *DockerSuite) TestGetContainerStatsRmRunning(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -345,6 +355,7 @@ func (s *DockerSuite) TestGetContainerStatsRmRunning(c *check.C) {
 | 
				
			||||||
// previous test was just checking one stat entry so it didn't fail (stats with
 | 
					// previous test was just checking one stat entry so it didn't fail (stats with
 | 
				
			||||||
// stream false always return one stat)
 | 
					// stream false always return one stat)
 | 
				
			||||||
func (s *DockerSuite) TestGetContainerStatsStream(c *check.C) {
 | 
					func (s *DockerSuite) TestGetContainerStatsStream(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "statscontainer"
 | 
						name := "statscontainer"
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", name, "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", name, "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -381,6 +392,7 @@ func (s *DockerSuite) TestGetContainerStatsStream(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestGetContainerStatsNoStream(c *check.C) {
 | 
					func (s *DockerSuite) TestGetContainerStatsNoStream(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "statscontainer"
 | 
						name := "statscontainer"
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", name, "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", name, "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -417,6 +429,7 @@ func (s *DockerSuite) TestGetContainerStatsNoStream(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestGetStoppedContainerStats(c *check.C) {
 | 
					func (s *DockerSuite) TestGetStoppedContainerStats(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// TODO: this test does nothing because we are c.Assert'ing in goroutine
 | 
						// TODO: this test does nothing because we are c.Assert'ing in goroutine
 | 
				
			||||||
	var (
 | 
						var (
 | 
				
			||||||
		name = "statscontainer"
 | 
							name = "statscontainer"
 | 
				
			||||||
| 
						 | 
					@ -437,6 +450,7 @@ func (s *DockerSuite) TestGetStoppedContainerStats(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// #9981 - Allow a docker created volume (ie, one in /var/lib/docker/volumes) to be used to overwrite (via passing in Binds on api start) an existing volume
 | 
					// #9981 - Allow a docker created volume (ie, one in /var/lib/docker/volumes) to be used to overwrite (via passing in Binds on api start) an existing volume
 | 
				
			||||||
func (s *DockerSuite) TestPostContainerBindNormalVolume(c *check.C) {
 | 
					func (s *DockerSuite) TestPostContainerBindNormalVolume(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "create", "-v", "/foo", "--name=one", "busybox")
 | 
						dockerCmd(c, "create", "-v", "/foo", "--name=one", "busybox")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fooDir, err := inspectMountSourceField("one", "/foo")
 | 
						fooDir, err := inspectMountSourceField("one", "/foo")
 | 
				
			||||||
| 
						 | 
					@ -462,6 +476,7 @@ func (s *DockerSuite) TestPostContainerBindNormalVolume(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiPause(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiPause(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	defer unpauseAllContainers()
 | 
						defer unpauseAllContainers()
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "sleep", "30")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "sleep", "30")
 | 
				
			||||||
	ContainerID := strings.TrimSpace(out)
 | 
						ContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -496,6 +511,7 @@ func (s *DockerSuite) TestContainerApiPause(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiTop(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiTop(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "top")
 | 
				
			||||||
	id := strings.TrimSpace(string(out))
 | 
						id := strings.TrimSpace(string(out))
 | 
				
			||||||
	c.Assert(waitRun(id), check.IsNil)
 | 
						c.Assert(waitRun(id), check.IsNil)
 | 
				
			||||||
| 
						 | 
					@ -532,6 +548,7 @@ func (s *DockerSuite) TestContainerApiTop(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cName := "testapicommit"
 | 
						cName := "testapicommit"
 | 
				
			||||||
	dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
 | 
						dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -560,6 +577,7 @@ func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiCommitWithLabelInConfig(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiCommitWithLabelInConfig(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cName := "testapicommitwithconfig"
 | 
						cName := "testapicommitwithconfig"
 | 
				
			||||||
	dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
 | 
						dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -605,6 +623,7 @@ func (s *DockerSuite) TestContainerApiCommitWithLabelInConfig(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiBadPort(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiBadPort(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	config := map[string]interface{}{
 | 
						config := map[string]interface{}{
 | 
				
			||||||
		"Image": "busybox",
 | 
							"Image": "busybox",
 | 
				
			||||||
		"Cmd":   []string{"/bin/sh", "-c", "echo test"},
 | 
							"Cmd":   []string{"/bin/sh", "-c", "echo test"},
 | 
				
			||||||
| 
						 | 
					@ -631,6 +650,7 @@ func (s *DockerSuite) TestContainerApiBadPort(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiCreate(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiCreate(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	config := map[string]interface{}{
 | 
						config := map[string]interface{}{
 | 
				
			||||||
		"Image": "busybox",
 | 
							"Image": "busybox",
 | 
				
			||||||
		"Cmd":   []string{"/bin/sh", "-c", "touch /test && ls /test"},
 | 
							"Cmd":   []string{"/bin/sh", "-c", "touch /test && ls /test"},
 | 
				
			||||||
| 
						 | 
					@ -668,6 +688,7 @@ func (s *DockerSuite) TestContainerApiCreateEmptyConfig(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiCreateWithHostName(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiCreateWithHostName(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	hostName := "test-host"
 | 
						hostName := "test-host"
 | 
				
			||||||
	config := map[string]interface{}{
 | 
						config := map[string]interface{}{
 | 
				
			||||||
		"Image":    "busybox",
 | 
							"Image":    "busybox",
 | 
				
			||||||
| 
						 | 
					@ -698,6 +719,7 @@ func (s *DockerSuite) TestContainerApiCreateWithHostName(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiCreateWithDomainName(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiCreateWithDomainName(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	domainName := "test-domain"
 | 
						domainName := "test-domain"
 | 
				
			||||||
	config := map[string]interface{}{
 | 
						config := map[string]interface{}{
 | 
				
			||||||
		"Image":      "busybox",
 | 
							"Image":      "busybox",
 | 
				
			||||||
| 
						 | 
					@ -728,6 +750,7 @@ func (s *DockerSuite) TestContainerApiCreateWithDomainName(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiCreateNetworkMode(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiCreateNetworkMode(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	UtilCreateNetworkMode(c, "host")
 | 
						UtilCreateNetworkMode(c, "host")
 | 
				
			||||||
	UtilCreateNetworkMode(c, "bridge")
 | 
						UtilCreateNetworkMode(c, "bridge")
 | 
				
			||||||
	UtilCreateNetworkMode(c, "container:web1")
 | 
						UtilCreateNetworkMode(c, "container:web1")
 | 
				
			||||||
| 
						 | 
					@ -763,6 +786,7 @@ func UtilCreateNetworkMode(c *check.C, networkMode string) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiCreateWithCpuSharesCpuset(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiCreateWithCpuSharesCpuset(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	config := map[string]interface{}{
 | 
						config := map[string]interface{}{
 | 
				
			||||||
		"Image":      "busybox",
 | 
							"Image":      "busybox",
 | 
				
			||||||
		"CpuShares":  512,
 | 
							"CpuShares":  512,
 | 
				
			||||||
| 
						 | 
					@ -796,6 +820,7 @@ func (s *DockerSuite) TestContainerApiCreateWithCpuSharesCpuset(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiVerifyHeader(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiVerifyHeader(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	config := map[string]interface{}{
 | 
						config := map[string]interface{}{
 | 
				
			||||||
		"Image": "busybox",
 | 
							"Image": "busybox",
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -829,6 +854,7 @@ func (s *DockerSuite) TestContainerApiVerifyHeader(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//Issue 14230. daemon should return 500 for invalid port syntax
 | 
					//Issue 14230. daemon should return 500 for invalid port syntax
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiInvalidPortSyntax(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiInvalidPortSyntax(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	config := `{
 | 
						config := `{
 | 
				
			||||||
				  "Image": "busybox",
 | 
									  "Image": "busybox",
 | 
				
			||||||
				  "HostConfig": {
 | 
									  "HostConfig": {
 | 
				
			||||||
| 
						 | 
					@ -854,6 +880,7 @@ func (s *DockerSuite) TestContainerApiInvalidPortSyntax(c *check.C) {
 | 
				
			||||||
// Issue 7941 - test to make sure a "null" in JSON is just ignored.
 | 
					// Issue 7941 - test to make sure a "null" in JSON is just ignored.
 | 
				
			||||||
// W/o this fix a null in JSON would be parsed into a string var as "null"
 | 
					// W/o this fix a null in JSON would be parsed into a string var as "null"
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiPostCreateNull(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiPostCreateNull(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	config := `{
 | 
						config := `{
 | 
				
			||||||
		"Hostname":"",
 | 
							"Hostname":"",
 | 
				
			||||||
		"Domainname":"",
 | 
							"Domainname":"",
 | 
				
			||||||
| 
						 | 
					@ -914,6 +941,7 @@ func (s *DockerSuite) TestContainerApiPostCreateNull(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *check.C) {
 | 
					func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	config := `{
 | 
						config := `{
 | 
				
			||||||
		"Image":     "busybox",
 | 
							"Image":     "busybox",
 | 
				
			||||||
		"Cmd":       "ls",
 | 
							"Cmd":       "ls",
 | 
				
			||||||
| 
						 | 
					@ -934,6 +962,7 @@ func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestStartWithTooLowMemoryLimit(c *check.C) {
 | 
					func (s *DockerSuite) TestStartWithTooLowMemoryLimit(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "create", "busybox")
 | 
						out, _ := dockerCmd(c, "create", "busybox")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	containerID := strings.TrimSpace(out)
 | 
						containerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -955,6 +984,7 @@ func (s *DockerSuite) TestStartWithTooLowMemoryLimit(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiRename(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiRename(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "--name", "TestContainerApiRename", "-d", "busybox", "sh")
 | 
						out, _ := dockerCmd(c, "run", "--name", "TestContainerApiRename", "-d", "busybox", "sh")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	containerID := strings.TrimSpace(out)
 | 
						containerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -971,6 +1001,7 @@ func (s *DockerSuite) TestContainerApiRename(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiKill(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiKill(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-api-kill"
 | 
						name := "test-api-kill"
 | 
				
			||||||
	dockerCmd(c, "run", "-di", "--name", name, "busybox", "top")
 | 
						dockerCmd(c, "run", "-di", "--name", name, "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -988,6 +1019,7 @@ func (s *DockerSuite) TestContainerApiKill(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiRestart(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiRestart(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-api-restart"
 | 
						name := "test-api-restart"
 | 
				
			||||||
	dockerCmd(c, "run", "-di", "--name", name, "busybox", "top")
 | 
						dockerCmd(c, "run", "-di", "--name", name, "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1001,6 +1033,7 @@ func (s *DockerSuite) TestContainerApiRestart(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiRestartNotimeoutParam(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiRestartNotimeoutParam(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-api-restart-no-timeout-param"
 | 
						name := "test-api-restart-no-timeout-param"
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-di", "--name", name, "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-di", "--name", name, "busybox", "top")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -1016,6 +1049,7 @@ func (s *DockerSuite) TestContainerApiRestartNotimeoutParam(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiStart(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiStart(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "testing-start"
 | 
						name := "testing-start"
 | 
				
			||||||
	config := map[string]interface{}{
 | 
						config := map[string]interface{}{
 | 
				
			||||||
		"Image":     "busybox",
 | 
							"Image":     "busybox",
 | 
				
			||||||
| 
						 | 
					@ -1039,6 +1073,7 @@ func (s *DockerSuite) TestContainerApiStart(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiStop(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiStop(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-api-stop"
 | 
						name := "test-api-stop"
 | 
				
			||||||
	dockerCmd(c, "run", "-di", "--name", name, "busybox", "top")
 | 
						dockerCmd(c, "run", "-di", "--name", name, "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1057,6 +1092,7 @@ func (s *DockerSuite) TestContainerApiStop(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiWait(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiWait(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-api-wait"
 | 
						name := "test-api-wait"
 | 
				
			||||||
	dockerCmd(c, "run", "--name", name, "busybox", "sleep", "5")
 | 
						dockerCmd(c, "run", "--name", name, "busybox", "sleep", "5")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1079,6 +1115,7 @@ func (s *DockerSuite) TestContainerApiWait(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiCopy(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiCopy(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-container-api-copy"
 | 
						name := "test-container-api-copy"
 | 
				
			||||||
	dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
 | 
						dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1108,6 +1145,7 @@ func (s *DockerSuite) TestContainerApiCopy(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiCopyResourcePathEmpty(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiCopyResourcePathEmpty(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-container-api-copy-resource-empty"
 | 
						name := "test-container-api-copy-resource-empty"
 | 
				
			||||||
	dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
 | 
						dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1122,6 +1160,7 @@ func (s *DockerSuite) TestContainerApiCopyResourcePathEmpty(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiCopyResourcePathNotFound(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiCopyResourcePathNotFound(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-container-api-copy-resource-not-found"
 | 
						name := "test-container-api-copy-resource-not-found"
 | 
				
			||||||
	dockerCmd(c, "run", "--name", name, "busybox")
 | 
						dockerCmd(c, "run", "--name", name, "busybox")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1146,6 +1185,7 @@ func (s *DockerSuite) TestContainerApiCopyContainerNotFound(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiDelete(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiDelete(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -1166,6 +1206,7 @@ func (s *DockerSuite) TestContainerApiDeleteNotExist(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiDeleteForce(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiDeleteForce(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -1177,6 +1218,7 @@ func (s *DockerSuite) TestContainerApiDeleteForce(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiDeleteRemoveLinks(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiDeleteRemoveLinks(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "--name", "tlink1", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "--name", "tlink1", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -1207,6 +1249,7 @@ func (s *DockerSuite) TestContainerApiDeleteRemoveLinks(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiDeleteConflict(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiDeleteConflict(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -1218,6 +1261,7 @@ func (s *DockerSuite) TestContainerApiDeleteConflict(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestContainerApiDeleteRemoveVolume(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerApiDeleteRemoveVolume(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon)
 | 
						testRequires(c, SameHostDaemon)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "-v", "/testvolume", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "-v", "/testvolume", "busybox", "top")
 | 
				
			||||||
| 
						 | 
					@ -1240,6 +1284,7 @@ func (s *DockerSuite) TestContainerApiDeleteRemoveVolume(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Regression test for https://github.com/docker/docker/issues/6231
 | 
					// Regression test for https://github.com/docker/docker/issues/6231
 | 
				
			||||||
func (s *DockerSuite) TestContainersApiChunkedEncoding(c *check.C) {
 | 
					func (s *DockerSuite) TestContainersApiChunkedEncoding(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "create", "-v", "/foo", "busybox", "true")
 | 
						out, _ := dockerCmd(c, "create", "-v", "/foo", "busybox", "true")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1290,6 +1335,7 @@ func (s *DockerSuite) TestContainersApiChunkedEncoding(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPostContainerStop(c *check.C) {
 | 
					func (s *DockerSuite) TestPostContainerStop(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	containerID := strings.TrimSpace(out)
 | 
						containerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -1307,6 +1353,7 @@ func (s *DockerSuite) TestPostContainerStop(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// #14170
 | 
					// #14170
 | 
				
			||||||
func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceEntrypoint(c *check.C) {
 | 
					func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceEntrypoint(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	config := struct {
 | 
						config := struct {
 | 
				
			||||||
		Image      string
 | 
							Image      string
 | 
				
			||||||
		Entrypoint string
 | 
							Entrypoint string
 | 
				
			||||||
| 
						 | 
					@ -1330,6 +1377,7 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceEntrypoint(c *che
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// #14170
 | 
					// #14170
 | 
				
			||||||
func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *check.C) {
 | 
					func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	config := struct {
 | 
						config := struct {
 | 
				
			||||||
		Image      string
 | 
							Image      string
 | 
				
			||||||
		Entrypoint string
 | 
							Entrypoint string
 | 
				
			||||||
| 
						 | 
					@ -1352,6 +1400,7 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCmd(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// regression #14318
 | 
					// regression #14318
 | 
				
			||||||
func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *check.C) {
 | 
					func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	config := struct {
 | 
						config := struct {
 | 
				
			||||||
		Image   string
 | 
							Image   string
 | 
				
			||||||
		CapAdd  string
 | 
							CapAdd  string
 | 
				
			||||||
| 
						 | 
					@ -1373,6 +1422,7 @@ func (s *DockerSuite) TestPostContainersCreateWithStringOrSliceCapAddDrop(c *che
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// #14640
 | 
					// #14640
 | 
				
			||||||
func (s *DockerSuite) TestPostContainersStartWithoutLinksInHostConfig(c *check.C) {
 | 
					func (s *DockerSuite) TestPostContainersStartWithoutLinksInHostConfig(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-host-config-links"
 | 
						name := "test-host-config-links"
 | 
				
			||||||
	dockerCmd(c, "create", "--name", name, "busybox", "top")
 | 
						dockerCmd(c, "create", "--name", name, "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1388,6 +1438,7 @@ func (s *DockerSuite) TestPostContainersStartWithoutLinksInHostConfig(c *check.C
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// #14640
 | 
					// #14640
 | 
				
			||||||
func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfig(c *check.C) {
 | 
					func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfig(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-host-config-links"
 | 
						name := "test-host-config-links"
 | 
				
			||||||
	dockerCmd(c, "run", "--name", "foo", "-d", "busybox", "top")
 | 
						dockerCmd(c, "run", "--name", "foo", "-d", "busybox", "top")
 | 
				
			||||||
	dockerCmd(c, "create", "--name", name, "--link", "foo:bar", "busybox", "top")
 | 
						dockerCmd(c, "create", "--name", name, "--link", "foo:bar", "busybox", "top")
 | 
				
			||||||
| 
						 | 
					@ -1404,6 +1455,7 @@ func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfig(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// #14640
 | 
					// #14640
 | 
				
			||||||
func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfigIdLinked(c *check.C) {
 | 
					func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfigIdLinked(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-host-config-links"
 | 
						name := "test-host-config-links"
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "--name", "link0", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "--name", "link0", "-d", "busybox", "top")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -1421,6 +1473,7 @@ func (s *DockerSuite) TestPostContainersStartWithLinksInHostConfigIdLinked(c *ch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// #14915
 | 
					// #14915
 | 
				
			||||||
func (s *DockerSuite) TestContainersApiCreateNoHostConfig118(c *check.C) {
 | 
					func (s *DockerSuite) TestContainersApiCreateNoHostConfig118(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	config := struct {
 | 
						config := struct {
 | 
				
			||||||
		Image string
 | 
							Image string
 | 
				
			||||||
	}{"busybox"}
 | 
						}{"busybox"}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,6 +13,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecResizeApiHeightWidthNoInt(c *check.C) {
 | 
					func (s *DockerSuite) TestExecResizeApiHeightWidthNoInt(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,6 +25,7 @@ func (s *DockerSuite) TestExecResizeApiHeightWidthNoInt(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Part of #14845
 | 
					// Part of #14845
 | 
				
			||||||
func (s *DockerSuite) TestExecResizeImmediatelyAfterExecStart(c *check.C) {
 | 
					func (s *DockerSuite) TestExecResizeImmediatelyAfterExecStart(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, NativeExecDriver)
 | 
						testRequires(c, NativeExecDriver)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	name := "exec_resize_test"
 | 
						name := "exec_resize_test"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,6 +13,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Regression test for #9414
 | 
					// Regression test for #9414
 | 
				
			||||||
func (s *DockerSuite) TestExecApiCreateNoCmd(c *check.C) {
 | 
					func (s *DockerSuite) TestExecApiCreateNoCmd(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "exec_test"
 | 
						name := "exec_test"
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
 | 
						dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,6 +27,7 @@ func (s *DockerSuite) TestExecApiCreateNoCmd(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecApiCreateNoValidContentType(c *check.C) {
 | 
					func (s *DockerSuite) TestExecApiCreateNoValidContentType(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "exec_test"
 | 
						name := "exec_test"
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
 | 
						dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestApiImagesFilter(c *check.C) {
 | 
					func (s *DockerSuite) TestApiImagesFilter(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "utest:tag1"
 | 
						name := "utest:tag1"
 | 
				
			||||||
	name2 := "utest/docker:tag2"
 | 
						name2 := "utest/docker:tag2"
 | 
				
			||||||
	name3 := "utest:5000/docker:tag3"
 | 
						name3 := "utest:5000/docker:tag3"
 | 
				
			||||||
| 
						 | 
					@ -50,6 +51,7 @@ func (s *DockerSuite) TestApiImagesFilter(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestApiImagesSaveAndLoad(c *check.C) {
 | 
					func (s *DockerSuite) TestApiImagesSaveAndLoad(c *check.C) {
 | 
				
			||||||
	testRequires(c, Network)
 | 
						testRequires(c, Network)
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, err := buildImage("saveandload", "FROM hello-world\nENV FOO bar", false)
 | 
						out, err := buildImage("saveandload", "FROM hello-world\nENV FOO bar", false)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		c.Fatal(err)
 | 
							c.Fatal(err)
 | 
				
			||||||
| 
						 | 
					@ -78,6 +80,7 @@ func (s *DockerSuite) TestApiImagesSaveAndLoad(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestApiImagesDelete(c *check.C) {
 | 
					func (s *DockerSuite) TestApiImagesDelete(c *check.C) {
 | 
				
			||||||
	testRequires(c, Network)
 | 
						testRequires(c, Network)
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-api-images-delete"
 | 
						name := "test-api-images-delete"
 | 
				
			||||||
	out, err := buildImage(name, "FROM hello-world\nENV FOO bar", false)
 | 
						out, err := buildImage(name, "FROM hello-world\nENV FOO bar", false)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
| 
						 | 
					@ -102,6 +105,7 @@ func (s *DockerSuite) TestApiImagesDelete(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestApiImagesHistory(c *check.C) {
 | 
					func (s *DockerSuite) TestApiImagesHistory(c *check.C) {
 | 
				
			||||||
	testRequires(c, Network)
 | 
						testRequires(c, Network)
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-api-images-history"
 | 
						name := "test-api-images-history"
 | 
				
			||||||
	out, err := buildImage(name, "FROM hello-world\nENV FOO bar", false)
 | 
						out, err := buildImage(name, "FROM hello-world\nENV FOO bar", false)
 | 
				
			||||||
	c.Assert(err, check.IsNil)
 | 
						c.Assert(err, check.IsNil)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,6 +10,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectApiContainerResponse(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectApiContainerResponse(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,6 +12,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLogsApiWithStdout(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsApiWithStdout(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "-t", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 1; done")
 | 
						out, _ := dockerCmd(c, "run", "-d", "-t", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 1; done")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
	c.Assert(waitRun(id), check.IsNil)
 | 
						c.Assert(waitRun(id), check.IsNil)
 | 
				
			||||||
| 
						 | 
					@ -51,6 +52,7 @@ func (s *DockerSuite) TestLogsApiWithStdout(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLogsApiNoStdoutNorStderr(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsApiNoStdoutNorStderr(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "logs_test"
 | 
						name := "logs_test"
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
 | 
						dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,6 +68,7 @@ func (s *DockerSuite) TestLogsApiNoStdoutNorStderr(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Regression test for #12704
 | 
					// Regression test for #12704
 | 
				
			||||||
func (s *DockerSuite) TestLogsApiFollowEmptyOutput(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsApiFollowEmptyOutput(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "logs_test"
 | 
						name := "logs_test"
 | 
				
			||||||
	t0 := time.Now()
 | 
						t0 := time.Now()
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "sleep", "10")
 | 
						dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "sleep", "10")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestResizeApiResponse(c *check.C) {
 | 
					func (s *DockerSuite) TestResizeApiResponse(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,6 +19,7 @@ func (s *DockerSuite) TestResizeApiResponse(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestResizeApiHeightWidthNoInt(c *check.C) {
 | 
					func (s *DockerSuite) TestResizeApiHeightWidthNoInt(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,6 +30,7 @@ func (s *DockerSuite) TestResizeApiHeightWidthNoInt(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestResizeApiResponseWhenContainerNotStarted(c *check.C) {
 | 
					func (s *DockerSuite) TestResizeApiResponseWhenContainerNotStarted(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,6 +14,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCliStatsNoStreamGetCpu(c *check.C) {
 | 
					func (s *DockerSuite) TestCliStatsNoStreamGetCpu(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true;do echo 'Hello'; usleep 100000; done")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true;do echo 'Hello'; usleep 100000; done")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -39,6 +40,7 @@ func (s *DockerSuite) TestCliStatsNoStreamGetCpu(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestStoppedContainerStatsGoroutines(c *check.C) {
 | 
					func (s *DockerSuite) TestStoppedContainerStatsGoroutines(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo 1")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo 1")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,6 +77,7 @@ func (s *DockerSuite) TestStoppedContainerStatsGoroutines(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestApiNetworkStats(c *check.C) {
 | 
					func (s *DockerSuite) TestApiNetworkStats(c *check.C) {
 | 
				
			||||||
	testRequires(c, SameHostDaemon)
 | 
						testRequires(c, SameHostDaemon)
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// Run container for 30 secs
 | 
						// Run container for 30 secs
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,6 +10,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestVolumesApiList(c *check.C) {
 | 
					func (s *DockerSuite) TestVolumesApiList(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "-v", "/foo", "busybox")
 | 
						dockerCmd(c, "run", "-d", "-v", "/foo", "busybox")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	status, b, err := sockRequest("GET", "/volumes", nil)
 | 
						status, b, err := sockRequest("GET", "/volumes", nil)
 | 
				
			||||||
| 
						 | 
					@ -23,6 +24,7 @@ func (s *DockerSuite) TestVolumesApiList(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestVolumesApiCreate(c *check.C) {
 | 
					func (s *DockerSuite) TestVolumesApiCreate(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	config := types.VolumeCreateRequest{
 | 
						config := types.VolumeCreateRequest{
 | 
				
			||||||
		Name: "test",
 | 
							Name: "test",
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -38,6 +40,7 @@ func (s *DockerSuite) TestVolumesApiCreate(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestVolumesApiRemove(c *check.C) {
 | 
					func (s *DockerSuite) TestVolumesApiRemove(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "-v", "/foo", "--name=test", "busybox")
 | 
						dockerCmd(c, "run", "-d", "-v", "/foo", "--name=test", "busybox")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	status, b, err := sockRequest("GET", "/volumes", nil)
 | 
						status, b, err := sockRequest("GET", "/volumes", nil)
 | 
				
			||||||
| 
						 | 
					@ -61,6 +64,7 @@ func (s *DockerSuite) TestVolumesApiRemove(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestVolumesApiInspect(c *check.C) {
 | 
					func (s *DockerSuite) TestVolumesApiInspect(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	config := types.VolumeCreateRequest{
 | 
						config := types.VolumeCreateRequest{
 | 
				
			||||||
		Name: "test",
 | 
							Name: "test",
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,7 @@ import (
 | 
				
			||||||
const attachWait = 5 * time.Second
 | 
					const attachWait = 5 * time.Second
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestAttachMultipleAndRestart(c *check.C) {
 | 
					func (s *DockerSuite) TestAttachMultipleAndRestart(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	endGroup := &sync.WaitGroup{}
 | 
						endGroup := &sync.WaitGroup{}
 | 
				
			||||||
	startGroup := &sync.WaitGroup{}
 | 
						startGroup := &sync.WaitGroup{}
 | 
				
			||||||
| 
						 | 
					@ -87,6 +88,7 @@ func (s *DockerSuite) TestAttachMultipleAndRestart(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestAttachTtyWithoutStdin(c *check.C) {
 | 
					func (s *DockerSuite) TestAttachTtyWithoutStdin(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "-ti", "busybox")
 | 
						out, _ := dockerCmd(c, "run", "-d", "-ti", "busybox")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -128,6 +130,7 @@ func (s *DockerSuite) TestAttachTtyWithoutStdin(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestAttachDisconnect(c *check.C) {
 | 
					func (s *DockerSuite) TestAttachDisconnect(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-di", "busybox", "/bin/cat")
 | 
						out, _ := dockerCmd(c, "run", "-di", "busybox", "/bin/cat")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
					@ -60,6 +60,7 @@ func setupImageWithTag(c *check.C, tag string) (digest.Digest, error) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerRegistrySuite) TestPullByTagDisplaysDigest(c *check.C) {
 | 
					func (s *DockerRegistrySuite) TestPullByTagDisplaysDigest(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	pushDigest, err := setupImage(c)
 | 
						pushDigest, err := setupImage(c)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		c.Fatalf("error setting up image: %v", err)
 | 
							c.Fatalf("error setting up image: %v", err)
 | 
				
			||||||
| 
						 | 
					@ -82,6 +83,7 @@ func (s *DockerRegistrySuite) TestPullByTagDisplaysDigest(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerRegistrySuite) TestPullByDigest(c *check.C) {
 | 
					func (s *DockerRegistrySuite) TestPullByDigest(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	pushDigest, err := setupImage(c)
 | 
						pushDigest, err := setupImage(c)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		c.Fatalf("error setting up image: %v", err)
 | 
							c.Fatalf("error setting up image: %v", err)
 | 
				
			||||||
| 
						 | 
					@ -105,6 +107,7 @@ func (s *DockerRegistrySuite) TestPullByDigest(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerRegistrySuite) TestPullByDigestNoFallback(c *check.C) {
 | 
					func (s *DockerRegistrySuite) TestPullByDigestNoFallback(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// pull from the registry using the <name>@<digest> reference
 | 
						// pull from the registry using the <name>@<digest> reference
 | 
				
			||||||
	imageReference := fmt.Sprintf("%s@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", repoName)
 | 
						imageReference := fmt.Sprintf("%s@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", repoName)
 | 
				
			||||||
	out, _, err := dockerCmdWithError("pull", imageReference)
 | 
						out, _, err := dockerCmdWithError("pull", imageReference)
 | 
				
			||||||
| 
						 | 
					@ -446,6 +449,7 @@ func (s *DockerRegistrySuite) TestDeleteImageByIDOnlyPulledByDigest(c *check.C)
 | 
				
			||||||
// TestPullFailsWithAlteredManifest tests that a `docker pull` fails when
 | 
					// TestPullFailsWithAlteredManifest tests that a `docker pull` fails when
 | 
				
			||||||
// we have modified a manifest blob and its digest cannot be verified.
 | 
					// we have modified a manifest blob and its digest cannot be verified.
 | 
				
			||||||
func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) {
 | 
					func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	manifestDigest, err := setupImage(c)
 | 
						manifestDigest, err := setupImage(c)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		c.Fatalf("error setting up image: %v", err)
 | 
							c.Fatalf("error setting up image: %v", err)
 | 
				
			||||||
| 
						 | 
					@ -495,6 +499,7 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) {
 | 
				
			||||||
// TestPullFailsWithAlteredLayer tests that a `docker pull` fails when
 | 
					// TestPullFailsWithAlteredLayer tests that a `docker pull` fails when
 | 
				
			||||||
// we have modified a layer blob and its digest cannot be verified.
 | 
					// we have modified a layer blob and its digest cannot be verified.
 | 
				
			||||||
func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) {
 | 
					func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	manifestDigest, err := setupImage(c)
 | 
						manifestDigest, err := setupImage(c)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		c.Fatalf("error setting up image: %v", err)
 | 
							c.Fatalf("error setting up image: %v", err)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,6 +7,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCommitAfterContainerIsDone(c *check.C) {
 | 
					func (s *DockerSuite) TestCommitAfterContainerIsDone(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-i", "-a", "stdin", "busybox", "echo", "foo")
 | 
						out, _ := dockerCmd(c, "run", "-i", "-a", "stdin", "busybox", "echo", "foo")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -21,6 +22,7 @@ func (s *DockerSuite) TestCommitAfterContainerIsDone(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCommitWithoutPause(c *check.C) {
 | 
					func (s *DockerSuite) TestCommitWithoutPause(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-i", "-a", "stdin", "busybox", "echo", "foo")
 | 
						out, _ := dockerCmd(c, "run", "-i", "-a", "stdin", "busybox", "echo", "foo")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -36,6 +38,7 @@ func (s *DockerSuite) TestCommitWithoutPause(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//test commit a paused container should not unpause it after commit
 | 
					//test commit a paused container should not unpause it after commit
 | 
				
			||||||
func (s *DockerSuite) TestCommitPausedContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestCommitPausedContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	defer unpauseAllContainers()
 | 
						defer unpauseAllContainers()
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-i", "-d", "busybox")
 | 
						out, _ := dockerCmd(c, "run", "-i", "-d", "busybox")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,7 +56,7 @@ func (s *DockerSuite) TestCommitPausedContainer(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCommitNewFile(c *check.C) {
 | 
					func (s *DockerSuite) TestCommitNewFile(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "--name", "commiter", "busybox", "/bin/sh", "-c", "echo koye > /foo")
 | 
						dockerCmd(c, "run", "--name", "commiter", "busybox", "/bin/sh", "-c", "echo koye > /foo")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	imageID, _ := dockerCmd(c, "commit", "commiter")
 | 
						imageID, _ := dockerCmd(c, "commit", "commiter")
 | 
				
			||||||
| 
						 | 
					@ -68,7 +71,7 @@ func (s *DockerSuite) TestCommitNewFile(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCommitHardlink(c *check.C) {
 | 
					func (s *DockerSuite) TestCommitHardlink(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	firstOutput, _ := dockerCmd(c, "run", "-t", "--name", "hardlinks", "busybox", "sh", "-c", "touch file1 && ln file1 file2 && ls -di file1 file2")
 | 
						firstOutput, _ := dockerCmd(c, "run", "-t", "--name", "hardlinks", "busybox", "sh", "-c", "touch file1 && ln file1 file2 && ls -di file1 file2")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	chunks := strings.Split(strings.TrimSpace(firstOutput), " ")
 | 
						chunks := strings.Split(strings.TrimSpace(firstOutput), " ")
 | 
				
			||||||
| 
						 | 
					@ -105,7 +108,7 @@ func (s *DockerSuite) TestCommitHardlink(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCommitTTY(c *check.C) {
 | 
					func (s *DockerSuite) TestCommitTTY(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-t", "--name", "tty", "busybox", "/bin/ls")
 | 
						dockerCmd(c, "run", "-t", "--name", "tty", "busybox", "/bin/ls")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	imageID, _ := dockerCmd(c, "commit", "tty", "ttytest")
 | 
						imageID, _ := dockerCmd(c, "commit", "tty", "ttytest")
 | 
				
			||||||
| 
						 | 
					@ -116,7 +119,7 @@ func (s *DockerSuite) TestCommitTTY(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCommitWithHostBindMount(c *check.C) {
 | 
					func (s *DockerSuite) TestCommitWithHostBindMount(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "--name", "bind-commit", "-v", "/dev/null:/winning", "busybox", "true")
 | 
						dockerCmd(c, "run", "--name", "bind-commit", "-v", "/dev/null:/winning", "busybox", "true")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	imageID, _ := dockerCmd(c, "commit", "bind-commit", "bindtest")
 | 
						imageID, _ := dockerCmd(c, "commit", "bind-commit", "bindtest")
 | 
				
			||||||
| 
						 | 
					@ -127,7 +130,7 @@ func (s *DockerSuite) TestCommitWithHostBindMount(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCommitChange(c *check.C) {
 | 
					func (s *DockerSuite) TestCommitChange(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "--name", "test", "busybox", "true")
 | 
						dockerCmd(c, "run", "--name", "test", "busybox", "true")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	imageID, _ := dockerCmd(c, "commit",
 | 
						imageID, _ := dockerCmd(c, "commit",
 | 
				
			||||||
| 
						 | 
					@ -169,6 +172,7 @@ func (s *DockerSuite) TestCommitChange(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO: commit --run is deprecated, remove this once --run is removed
 | 
					// TODO: commit --run is deprecated, remove this once --run is removed
 | 
				
			||||||
func (s *DockerSuite) TestCommitMergeConfigRun(c *check.C) {
 | 
					func (s *DockerSuite) TestCommitMergeConfigRun(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "commit-test"
 | 
						name := "commit-test"
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "-e=FOO=bar", "busybox", "/bin/sh", "-c", "echo testing > /tmp/foo")
 | 
						out, _ := dockerCmd(c, "run", "-d", "-e=FOO=bar", "busybox", "/bin/sh", "-c", "echo testing > /tmp/foo")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,6 +23,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Test for error when SRC does not exist.
 | 
					// Test for error when SRC does not exist.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromErrSrcNotExists(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromErrSrcNotExists(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{})
 | 
						cID := makeTestContainer(c, testContainerOptions{})
 | 
				
			||||||
	defer deleteContainer(cID)
 | 
						defer deleteContainer(cID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,6 +43,7 @@ func (s *DockerSuite) TestCpFromErrSrcNotExists(c *check.C) {
 | 
				
			||||||
// Test for error when SRC ends in a trailing
 | 
					// Test for error when SRC ends in a trailing
 | 
				
			||||||
// path separator but it exists as a file.
 | 
					// path separator but it exists as a file.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromErrSrcNotDir(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromErrSrcNotDir(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
						cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
				
			||||||
	defer deleteContainer(cID)
 | 
						defer deleteContainer(cID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -61,6 +63,7 @@ func (s *DockerSuite) TestCpFromErrSrcNotDir(c *check.C) {
 | 
				
			||||||
// Test for error when SRC is a valid file or directory,
 | 
					// Test for error when SRC is a valid file or directory,
 | 
				
			||||||
// bu the DST parent directory does not exist.
 | 
					// bu the DST parent directory does not exist.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromErrDstParentNotExists(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromErrDstParentNotExists(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
						cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
				
			||||||
	defer deleteContainer(cID)
 | 
						defer deleteContainer(cID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -97,6 +100,7 @@ func (s *DockerSuite) TestCpFromErrDstParentNotExists(c *check.C) {
 | 
				
			||||||
// Test for error when DST ends in a trailing
 | 
					// Test for error when DST ends in a trailing
 | 
				
			||||||
// path separator but exists as a file.
 | 
					// path separator but exists as a file.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromErrDstNotDir(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromErrDstNotDir(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
						cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
				
			||||||
	defer deleteContainer(cID)
 | 
						defer deleteContainer(cID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -133,6 +137,7 @@ func (s *DockerSuite) TestCpFromErrDstNotDir(c *check.C) {
 | 
				
			||||||
// Check that copying from a container to a local symlink copies to the symlink
 | 
					// Check that copying from a container to a local symlink copies to the symlink
 | 
				
			||||||
// target and does not overwrite the local symlink itself.
 | 
					// target and does not overwrite the local symlink itself.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromSymlinkDestination(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromSymlinkDestination(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
						cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
				
			||||||
	defer deleteContainer(cID)
 | 
						defer deleteContainer(cID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -258,6 +263,7 @@ func (s *DockerSuite) TestCpFromSymlinkDestination(c *check.C) {
 | 
				
			||||||
//    exist. This should create a file with the name DST and copy the
 | 
					//    exist. This should create a file with the name DST and copy the
 | 
				
			||||||
//    contents of the source file into it.
 | 
					//    contents of the source file into it.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromCaseA(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromCaseA(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		addContent: true, workDir: "/root",
 | 
							addContent: true, workDir: "/root",
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
| 
						 | 
					@ -282,6 +288,7 @@ func (s *DockerSuite) TestCpFromCaseA(c *check.C) {
 | 
				
			||||||
//    exist. This should cause an error because the copy operation cannot
 | 
					//    exist. This should cause an error because the copy operation cannot
 | 
				
			||||||
//    create a directory when copying a single file.
 | 
					//    create a directory when copying a single file.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromCaseB(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromCaseB(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
						cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
				
			||||||
	defer deleteContainer(cID)
 | 
						defer deleteContainer(cID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -304,6 +311,7 @@ func (s *DockerSuite) TestCpFromCaseB(c *check.C) {
 | 
				
			||||||
// C. SRC specifies a file and DST exists as a file. This should overwrite
 | 
					// C. SRC specifies a file and DST exists as a file. This should overwrite
 | 
				
			||||||
//    the file at DST with the contents of the source file.
 | 
					//    the file at DST with the contents of the source file.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromCaseC(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromCaseC(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		addContent: true, workDir: "/root",
 | 
							addContent: true, workDir: "/root",
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
| 
						 | 
					@ -335,6 +343,7 @@ func (s *DockerSuite) TestCpFromCaseC(c *check.C) {
 | 
				
			||||||
//    a copy of the source file inside it using the basename from SRC. Ensure
 | 
					//    a copy of the source file inside it using the basename from SRC. Ensure
 | 
				
			||||||
//    this works whether DST has a trailing path separator or not.
 | 
					//    this works whether DST has a trailing path separator or not.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromCaseD(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromCaseD(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
						cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
				
			||||||
	defer deleteContainer(cID)
 | 
						defer deleteContainer(cID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -386,6 +395,7 @@ func (s *DockerSuite) TestCpFromCaseD(c *check.C) {
 | 
				
			||||||
//    directory. Ensure this works whether DST has a trailing path separator or
 | 
					//    directory. Ensure this works whether DST has a trailing path separator or
 | 
				
			||||||
//    not.
 | 
					//    not.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromCaseE(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromCaseE(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
						cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
				
			||||||
	defer deleteContainer(cID)
 | 
						defer deleteContainer(cID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -424,6 +434,7 @@ func (s *DockerSuite) TestCpFromCaseE(c *check.C) {
 | 
				
			||||||
// F. SRC specifies a directory and DST exists as a file. This should cause an
 | 
					// F. SRC specifies a directory and DST exists as a file. This should cause an
 | 
				
			||||||
//    error as it is not possible to overwrite a file with a directory.
 | 
					//    error as it is not possible to overwrite a file with a directory.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromCaseF(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromCaseF(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		addContent: true, workDir: "/root",
 | 
							addContent: true, workDir: "/root",
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
| 
						 | 
					@ -451,6 +462,7 @@ func (s *DockerSuite) TestCpFromCaseF(c *check.C) {
 | 
				
			||||||
//    the SRC directory and all its contents to the DST directory. Ensure this
 | 
					//    the SRC directory and all its contents to the DST directory. Ensure this
 | 
				
			||||||
//    works whether DST has a trailing path separator or not.
 | 
					//    works whether DST has a trailing path separator or not.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromCaseG(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromCaseG(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		addContent: true, workDir: "/root",
 | 
							addContent: true, workDir: "/root",
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
| 
						 | 
					@ -500,6 +512,7 @@ func (s *DockerSuite) TestCpFromCaseG(c *check.C) {
 | 
				
			||||||
//    directory (but not the directory itself) into the DST directory. Ensure
 | 
					//    directory (but not the directory itself) into the DST directory. Ensure
 | 
				
			||||||
//    this works whether DST has a trailing path separator or not.
 | 
					//    this works whether DST has a trailing path separator or not.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromCaseH(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromCaseH(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
						cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
				
			||||||
	defer deleteContainer(cID)
 | 
						defer deleteContainer(cID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -539,6 +552,7 @@ func (s *DockerSuite) TestCpFromCaseH(c *check.C) {
 | 
				
			||||||
//    should cause an error as it is not possible to overwrite a file with a
 | 
					//    should cause an error as it is not possible to overwrite a file with a
 | 
				
			||||||
//    directory.
 | 
					//    directory.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromCaseI(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromCaseI(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		addContent: true, workDir: "/root",
 | 
							addContent: true, workDir: "/root",
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
| 
						 | 
					@ -567,6 +581,7 @@ func (s *DockerSuite) TestCpFromCaseI(c *check.C) {
 | 
				
			||||||
//    itself) into the DST directory. Ensure this works whether DST has a
 | 
					//    itself) into the DST directory. Ensure this works whether DST has a
 | 
				
			||||||
//    trailing path separator or not.
 | 
					//    trailing path separator or not.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromCaseJ(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromCaseJ(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		addContent: true, workDir: "/root",
 | 
							addContent: true, workDir: "/root",
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,6 +38,7 @@ func (s *DockerSuite) TestCpLocalOnly(c *check.C) {
 | 
				
			||||||
// Test for #5656
 | 
					// Test for #5656
 | 
				
			||||||
// Check that garbage paths don't escape the container's rootfs
 | 
					// Check that garbage paths don't escape the container's rootfs
 | 
				
			||||||
func (s *DockerSuite) TestCpGarbagePath(c *check.C) {
 | 
					func (s *DockerSuite) TestCpGarbagePath(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath)
 | 
						out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath)
 | 
				
			||||||
	if exitCode != 0 {
 | 
						if exitCode != 0 {
 | 
				
			||||||
		c.Fatal("failed to create a container", out)
 | 
							c.Fatal("failed to create a container", out)
 | 
				
			||||||
| 
						 | 
					@ -95,6 +96,7 @@ func (s *DockerSuite) TestCpGarbagePath(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Check that relative paths are relative to the container's rootfs
 | 
					// Check that relative paths are relative to the container's rootfs
 | 
				
			||||||
func (s *DockerSuite) TestCpRelativePath(c *check.C) {
 | 
					func (s *DockerSuite) TestCpRelativePath(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath)
 | 
						out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath)
 | 
				
			||||||
	if exitCode != 0 {
 | 
						if exitCode != 0 {
 | 
				
			||||||
		c.Fatal("failed to create a container", out)
 | 
							c.Fatal("failed to create a container", out)
 | 
				
			||||||
| 
						 | 
					@ -160,6 +162,7 @@ func (s *DockerSuite) TestCpRelativePath(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Check that absolute paths are relative to the container's rootfs
 | 
					// Check that absolute paths are relative to the container's rootfs
 | 
				
			||||||
func (s *DockerSuite) TestCpAbsolutePath(c *check.C) {
 | 
					func (s *DockerSuite) TestCpAbsolutePath(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath)
 | 
						out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath)
 | 
				
			||||||
	if exitCode != 0 {
 | 
						if exitCode != 0 {
 | 
				
			||||||
		c.Fatal("failed to create a container", out)
 | 
							c.Fatal("failed to create a container", out)
 | 
				
			||||||
| 
						 | 
					@ -219,6 +222,7 @@ func (s *DockerSuite) TestCpAbsolutePath(c *check.C) {
 | 
				
			||||||
// Test for #5619
 | 
					// Test for #5619
 | 
				
			||||||
// Check that absolute symlinks are still relative to the container's rootfs
 | 
					// Check that absolute symlinks are still relative to the container's rootfs
 | 
				
			||||||
func (s *DockerSuite) TestCpAbsoluteSymlink(c *check.C) {
 | 
					func (s *DockerSuite) TestCpAbsoluteSymlink(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpFullPath+" container_path")
 | 
						out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpFullPath+" container_path")
 | 
				
			||||||
	if exitCode != 0 {
 | 
						if exitCode != 0 {
 | 
				
			||||||
		c.Fatal("failed to create a container", out)
 | 
							c.Fatal("failed to create a container", out)
 | 
				
			||||||
| 
						 | 
					@ -271,6 +275,7 @@ func (s *DockerSuite) TestCpAbsoluteSymlink(c *check.C) {
 | 
				
			||||||
// Check that symlinks to a directory behave as expected when copying one from
 | 
					// Check that symlinks to a directory behave as expected when copying one from
 | 
				
			||||||
// a container.
 | 
					// a container.
 | 
				
			||||||
func (s *DockerSuite) TestCpFromSymlinkToDirectory(c *check.C) {
 | 
					func (s *DockerSuite) TestCpFromSymlinkToDirectory(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpTestPathParent+" /dir_link")
 | 
						out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpTestPathParent+" /dir_link")
 | 
				
			||||||
	if exitCode != 0 {
 | 
						if exitCode != 0 {
 | 
				
			||||||
		c.Fatal("failed to create a container", out)
 | 
							c.Fatal("failed to create a container", out)
 | 
				
			||||||
| 
						 | 
					@ -330,6 +335,7 @@ func (s *DockerSuite) TestCpFromSymlinkToDirectory(c *check.C) {
 | 
				
			||||||
// Check that symlinks to a directory behave as expected when copying one to a
 | 
					// Check that symlinks to a directory behave as expected when copying one to a
 | 
				
			||||||
// container.
 | 
					// container.
 | 
				
			||||||
func (s *DockerSuite) TestCpToSymlinkToDirectory(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToSymlinkToDirectory(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon) // Requires local volume mount bind.
 | 
						testRequires(c, SameHostDaemon) // Requires local volume mount bind.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	testVol, err := ioutil.TempDir("", "test-cp-to-symlink-to-dir-")
 | 
						testVol, err := ioutil.TempDir("", "test-cp-to-symlink-to-dir-")
 | 
				
			||||||
| 
						 | 
					@ -434,6 +440,7 @@ func (s *DockerSuite) TestCpToSymlinkToDirectory(c *check.C) {
 | 
				
			||||||
// Test for #5619
 | 
					// Test for #5619
 | 
				
			||||||
// Check that symlinks which are part of the resource path are still relative to the container's rootfs
 | 
					// Check that symlinks which are part of the resource path are still relative to the container's rootfs
 | 
				
			||||||
func (s *DockerSuite) TestCpSymlinkComponent(c *check.C) {
 | 
					func (s *DockerSuite) TestCpSymlinkComponent(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpTestPath+" container_path")
 | 
						out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpTestPath+" container_path")
 | 
				
			||||||
	if exitCode != 0 {
 | 
						if exitCode != 0 {
 | 
				
			||||||
		c.Fatal("failed to create a container", out)
 | 
							c.Fatal("failed to create a container", out)
 | 
				
			||||||
| 
						 | 
					@ -492,6 +499,7 @@ func (s *DockerSuite) TestCpSymlinkComponent(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Check that cp with unprivileged user doesn't return any error
 | 
					// Check that cp with unprivileged user doesn't return any error
 | 
				
			||||||
func (s *DockerSuite) TestCpUnprivilegedUser(c *check.C) {
 | 
					func (s *DockerSuite) TestCpUnprivilegedUser(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, UnixCli) // uses chmod/su: not available on windows
 | 
						testRequires(c, UnixCli) // uses chmod/su: not available on windows
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "touch "+cpTestName)
 | 
						out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "touch "+cpTestName)
 | 
				
			||||||
| 
						 | 
					@ -527,6 +535,7 @@ func (s *DockerSuite) TestCpUnprivilegedUser(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCpSpecialFiles(c *check.C) {
 | 
					func (s *DockerSuite) TestCpSpecialFiles(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon)
 | 
						testRequires(c, SameHostDaemon)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	outDir, err := ioutil.TempDir("", "cp-test-special-files")
 | 
						outDir, err := ioutil.TempDir("", "cp-test-special-files")
 | 
				
			||||||
| 
						 | 
					@ -580,6 +589,7 @@ func (s *DockerSuite) TestCpSpecialFiles(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCpVolumePath(c *check.C) {
 | 
					func (s *DockerSuite) TestCpVolumePath(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon)
 | 
						testRequires(c, SameHostDaemon)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tmpDir, err := ioutil.TempDir("", "cp-test-volumepath")
 | 
						tmpDir, err := ioutil.TempDir("", "cp-test-volumepath")
 | 
				
			||||||
| 
						 | 
					@ -679,6 +689,7 @@ func (s *DockerSuite) TestCpVolumePath(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCpToDot(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToDot(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /test")
 | 
						out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /test")
 | 
				
			||||||
	if exitCode != 0 {
 | 
						if exitCode != 0 {
 | 
				
			||||||
		c.Fatal("failed to create a container", out)
 | 
							c.Fatal("failed to create a container", out)
 | 
				
			||||||
| 
						 | 
					@ -712,6 +723,7 @@ func (s *DockerSuite) TestCpToDot(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCpToStdout(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToStdout(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /test")
 | 
						out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /test")
 | 
				
			||||||
	if exitCode != 0 {
 | 
						if exitCode != 0 {
 | 
				
			||||||
		c.Fatalf("failed to create a container:%s\n", out)
 | 
							c.Fatalf("failed to create a container:%s\n", out)
 | 
				
			||||||
| 
						 | 
					@ -765,6 +777,7 @@ func (s *DockerSuite) TestCpNameHasColon(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCopyAndRestart(c *check.C) {
 | 
					func (s *DockerSuite) TestCopyAndRestart(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	expectedMsg := "hello"
 | 
						expectedMsg := "hello"
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", expectedMsg)
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", expectedMsg)
 | 
				
			||||||
	id := strings.TrimSpace(string(out))
 | 
						id := strings.TrimSpace(string(out))
 | 
				
			||||||
| 
						 | 
					@ -793,6 +806,7 @@ func (s *DockerSuite) TestCopyAndRestart(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCopyCreatedContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestCopyCreatedContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "create", "--name", "test_cp", "-v", "/test", "busybox")
 | 
						dockerCmd(c, "create", "--name", "test_cp", "-v", "/test", "busybox")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tmpDir, err := ioutil.TempDir("", "test")
 | 
						tmpDir, err := ioutil.TempDir("", "test")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,6 +22,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Test for error when SRC does not exist.
 | 
					// Test for error when SRC does not exist.
 | 
				
			||||||
func (s *DockerSuite) TestCpToErrSrcNotExists(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToErrSrcNotExists(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{})
 | 
						cID := makeTestContainer(c, testContainerOptions{})
 | 
				
			||||||
	defer deleteContainer(cID)
 | 
						defer deleteContainer(cID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,6 +45,7 @@ func (s *DockerSuite) TestCpToErrSrcNotExists(c *check.C) {
 | 
				
			||||||
// Test for error when SRC ends in a trailing
 | 
					// Test for error when SRC ends in a trailing
 | 
				
			||||||
// path separator but it exists as a file.
 | 
					// path separator but it exists as a file.
 | 
				
			||||||
func (s *DockerSuite) TestCpToErrSrcNotDir(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToErrSrcNotDir(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{})
 | 
						cID := makeTestContainer(c, testContainerOptions{})
 | 
				
			||||||
	defer deleteContainer(cID)
 | 
						defer deleteContainer(cID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -68,6 +70,7 @@ func (s *DockerSuite) TestCpToErrSrcNotDir(c *check.C) {
 | 
				
			||||||
// Test for error when SRC is a valid file or directory,
 | 
					// Test for error when SRC is a valid file or directory,
 | 
				
			||||||
// bu the DST parent directory does not exist.
 | 
					// bu the DST parent directory does not exist.
 | 
				
			||||||
func (s *DockerSuite) TestCpToErrDstParentNotExists(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToErrDstParentNotExists(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
						cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
				
			||||||
	defer deleteContainer(cID)
 | 
						defer deleteContainer(cID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -105,6 +108,7 @@ func (s *DockerSuite) TestCpToErrDstParentNotExists(c *check.C) {
 | 
				
			||||||
// file. Also test that we cannot overwirite an existing directory with a
 | 
					// file. Also test that we cannot overwirite an existing directory with a
 | 
				
			||||||
// non-directory and cannot overwrite an existing
 | 
					// non-directory and cannot overwrite an existing
 | 
				
			||||||
func (s *DockerSuite) TestCpToErrDstNotDir(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToErrDstNotDir(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
						cID := makeTestContainer(c, testContainerOptions{addContent: true})
 | 
				
			||||||
	defer deleteContainer(cID)
 | 
						defer deleteContainer(cID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -149,6 +153,7 @@ func (s *DockerSuite) TestCpToErrDstNotDir(c *check.C) {
 | 
				
			||||||
// Check that copying from a local path to a symlink in a container copies to
 | 
					// Check that copying from a local path to a symlink in a container copies to
 | 
				
			||||||
// the symlink target and does not overwrite the container symlink itself.
 | 
					// the symlink target and does not overwrite the container symlink itself.
 | 
				
			||||||
func (s *DockerSuite) TestCpToSymlinkDestination(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToSymlinkDestination(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon) // Requires local volume mount bind.
 | 
						testRequires(c, SameHostDaemon) // Requires local volume mount bind.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	testVol := getTestDir(c, "test-cp-to-symlink-destination-")
 | 
						testVol := getTestDir(c, "test-cp-to-symlink-destination-")
 | 
				
			||||||
| 
						 | 
					@ -278,6 +283,7 @@ func (s *DockerSuite) TestCpToSymlinkDestination(c *check.C) {
 | 
				
			||||||
//    exist. This should create a file with the name DST and copy the
 | 
					//    exist. This should create a file with the name DST and copy the
 | 
				
			||||||
//    contents of the source file into it.
 | 
					//    contents of the source file into it.
 | 
				
			||||||
func (s *DockerSuite) TestCpToCaseA(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToCaseA(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		workDir: "/root", command: makeCatFileCommand("itWorks.txt"),
 | 
							workDir: "/root", command: makeCatFileCommand("itWorks.txt"),
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
| 
						 | 
					@ -304,6 +310,7 @@ func (s *DockerSuite) TestCpToCaseA(c *check.C) {
 | 
				
			||||||
//    exist. This should cause an error because the copy operation cannot
 | 
					//    exist. This should cause an error because the copy operation cannot
 | 
				
			||||||
//    create a directory when copying a single file.
 | 
					//    create a directory when copying a single file.
 | 
				
			||||||
func (s *DockerSuite) TestCpToCaseB(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToCaseB(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		command: makeCatFileCommand("testDir/file1"),
 | 
							command: makeCatFileCommand("testDir/file1"),
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
| 
						 | 
					@ -330,6 +337,7 @@ func (s *DockerSuite) TestCpToCaseB(c *check.C) {
 | 
				
			||||||
// C. SRC specifies a file and DST exists as a file. This should overwrite
 | 
					// C. SRC specifies a file and DST exists as a file. This should overwrite
 | 
				
			||||||
//    the file at DST with the contents of the source file.
 | 
					//    the file at DST with the contents of the source file.
 | 
				
			||||||
func (s *DockerSuite) TestCpToCaseC(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToCaseC(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		addContent: true, workDir: "/root",
 | 
							addContent: true, workDir: "/root",
 | 
				
			||||||
		command: makeCatFileCommand("file2"),
 | 
							command: makeCatFileCommand("file2"),
 | 
				
			||||||
| 
						 | 
					@ -363,6 +371,7 @@ func (s *DockerSuite) TestCpToCaseC(c *check.C) {
 | 
				
			||||||
//    a copy of the source file inside it using the basename from SRC. Ensure
 | 
					//    a copy of the source file inside it using the basename from SRC. Ensure
 | 
				
			||||||
//    this works whether DST has a trailing path separator or not.
 | 
					//    this works whether DST has a trailing path separator or not.
 | 
				
			||||||
func (s *DockerSuite) TestCpToCaseD(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToCaseD(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		addContent: true,
 | 
							addContent: true,
 | 
				
			||||||
		command:    makeCatFileCommand("/dir1/file1"),
 | 
							command:    makeCatFileCommand("/dir1/file1"),
 | 
				
			||||||
| 
						 | 
					@ -422,6 +431,7 @@ func (s *DockerSuite) TestCpToCaseD(c *check.C) {
 | 
				
			||||||
//    directory. Ensure this works whether DST has a trailing path separator or
 | 
					//    directory. Ensure this works whether DST has a trailing path separator or
 | 
				
			||||||
//    not.
 | 
					//    not.
 | 
				
			||||||
func (s *DockerSuite) TestCpToCaseE(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToCaseE(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		command: makeCatFileCommand("/testDir/file1-1"),
 | 
							command: makeCatFileCommand("/testDir/file1-1"),
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
| 
						 | 
					@ -468,6 +478,7 @@ func (s *DockerSuite) TestCpToCaseE(c *check.C) {
 | 
				
			||||||
// F. SRC specifies a directory and DST exists as a file. This should cause an
 | 
					// F. SRC specifies a directory and DST exists as a file. This should cause an
 | 
				
			||||||
//    error as it is not possible to overwrite a file with a directory.
 | 
					//    error as it is not possible to overwrite a file with a directory.
 | 
				
			||||||
func (s *DockerSuite) TestCpToCaseF(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToCaseF(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		addContent: true, workDir: "/root",
 | 
							addContent: true, workDir: "/root",
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
| 
						 | 
					@ -495,6 +506,7 @@ func (s *DockerSuite) TestCpToCaseF(c *check.C) {
 | 
				
			||||||
//    the SRC directory and all its contents to the DST directory. Ensure this
 | 
					//    the SRC directory and all its contents to the DST directory. Ensure this
 | 
				
			||||||
//    works whether DST has a trailing path separator or not.
 | 
					//    works whether DST has a trailing path separator or not.
 | 
				
			||||||
func (s *DockerSuite) TestCpToCaseG(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToCaseG(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		addContent: true, workDir: "/root",
 | 
							addContent: true, workDir: "/root",
 | 
				
			||||||
		command: makeCatFileCommand("dir2/dir1/file1-1"),
 | 
							command: makeCatFileCommand("dir2/dir1/file1-1"),
 | 
				
			||||||
| 
						 | 
					@ -554,6 +566,7 @@ func (s *DockerSuite) TestCpToCaseG(c *check.C) {
 | 
				
			||||||
//    directory (but not the directory itself) into the DST directory. Ensure
 | 
					//    directory (but not the directory itself) into the DST directory. Ensure
 | 
				
			||||||
//    this works whether DST has a trailing path separator or not.
 | 
					//    this works whether DST has a trailing path separator or not.
 | 
				
			||||||
func (s *DockerSuite) TestCpToCaseH(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToCaseH(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		command: makeCatFileCommand("/testDir/file1-1"),
 | 
							command: makeCatFileCommand("/testDir/file1-1"),
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
| 
						 | 
					@ -600,6 +613,7 @@ func (s *DockerSuite) TestCpToCaseH(c *check.C) {
 | 
				
			||||||
//    should cause an error as it is not possible to overwrite a file with a
 | 
					//    should cause an error as it is not possible to overwrite a file with a
 | 
				
			||||||
//    directory.
 | 
					//    directory.
 | 
				
			||||||
func (s *DockerSuite) TestCpToCaseI(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToCaseI(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		addContent: true, workDir: "/root",
 | 
							addContent: true, workDir: "/root",
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
| 
						 | 
					@ -628,6 +642,7 @@ func (s *DockerSuite) TestCpToCaseI(c *check.C) {
 | 
				
			||||||
//    itself) into the DST directory. Ensure this works whether DST has a
 | 
					//    itself) into the DST directory. Ensure this works whether DST has a
 | 
				
			||||||
//    trailing path separator or not.
 | 
					//    trailing path separator or not.
 | 
				
			||||||
func (s *DockerSuite) TestCpToCaseJ(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToCaseJ(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	cID := makeTestContainer(c, testContainerOptions{
 | 
						cID := makeTestContainer(c, testContainerOptions{
 | 
				
			||||||
		addContent: true, workDir: "/root",
 | 
							addContent: true, workDir: "/root",
 | 
				
			||||||
		command: makeCatFileCommand("/dir2/file1-1"),
 | 
							command: makeCatFileCommand("/dir2/file1-1"),
 | 
				
			||||||
| 
						 | 
					@ -684,6 +699,7 @@ func (s *DockerSuite) TestCpToCaseJ(c *check.C) {
 | 
				
			||||||
// The `docker cp` command should also ensure that you cannot
 | 
					// The `docker cp` command should also ensure that you cannot
 | 
				
			||||||
// write to a container rootfs that is marked as read-only.
 | 
					// write to a container rootfs that is marked as read-only.
 | 
				
			||||||
func (s *DockerSuite) TestCpToErrReadOnlyRootfs(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToErrReadOnlyRootfs(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	tmpDir := getTestDir(c, "test-cp-to-err-read-only-rootfs")
 | 
						tmpDir := getTestDir(c, "test-cp-to-err-read-only-rootfs")
 | 
				
			||||||
	defer os.RemoveAll(tmpDir)
 | 
						defer os.RemoveAll(tmpDir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -716,6 +732,7 @@ func (s *DockerSuite) TestCpToErrReadOnlyRootfs(c *check.C) {
 | 
				
			||||||
// The `docker cp` command should also ensure that you
 | 
					// The `docker cp` command should also ensure that you
 | 
				
			||||||
// cannot write to a volume that is mounted as read-only.
 | 
					// cannot write to a volume that is mounted as read-only.
 | 
				
			||||||
func (s *DockerSuite) TestCpToErrReadOnlyVolume(c *check.C) {
 | 
					func (s *DockerSuite) TestCpToErrReadOnlyVolume(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	tmpDir := getTestDir(c, "test-cp-to-err-read-only-volume")
 | 
						tmpDir := getTestDir(c, "test-cp-to-err-read-only-volume")
 | 
				
			||||||
	defer os.RemoveAll(tmpDir)
 | 
						defer os.RemoveAll(tmpDir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,6 +18,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Make sure we can create a simple container with some args
 | 
					// Make sure we can create a simple container with some args
 | 
				
			||||||
func (s *DockerSuite) TestCreateArgs(c *check.C) {
 | 
					func (s *DockerSuite) TestCreateArgs(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "create", "busybox", "command", "arg1", "arg2", "arg with space")
 | 
						out, _ := dockerCmd(c, "create", "busybox", "command", "arg1", "arg2", "arg with space")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -59,7 +60,7 @@ func (s *DockerSuite) TestCreateArgs(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Make sure we can set hostconfig options too
 | 
					// Make sure we can set hostconfig options too
 | 
				
			||||||
func (s *DockerSuite) TestCreateHostConfig(c *check.C) {
 | 
					func (s *DockerSuite) TestCreateHostConfig(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "create", "-P", "busybox", "echo")
 | 
						out, _ := dockerCmd(c, "create", "-P", "busybox", "echo")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -90,7 +91,7 @@ func (s *DockerSuite) TestCreateHostConfig(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCreateWithPortRange(c *check.C) {
 | 
					func (s *DockerSuite) TestCreateWithPortRange(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "create", "-p", "3300-3303:3300-3303/tcp", "busybox", "echo")
 | 
						out, _ := dockerCmd(c, "create", "-p", "3300-3303:3300-3303/tcp", "busybox", "echo")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -129,7 +130,7 @@ func (s *DockerSuite) TestCreateWithPortRange(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCreateWithiLargePortRange(c *check.C) {
 | 
					func (s *DockerSuite) TestCreateWithiLargePortRange(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "create", "-p", "1-65535:1-65535/tcp", "busybox", "echo")
 | 
						out, _ := dockerCmd(c, "create", "-p", "1-65535:1-65535/tcp", "busybox", "echo")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -169,6 +170,7 @@ func (s *DockerSuite) TestCreateWithiLargePortRange(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// "test123" should be printed by docker create + start
 | 
					// "test123" should be printed by docker create + start
 | 
				
			||||||
func (s *DockerSuite) TestCreateEchoStdout(c *check.C) {
 | 
					func (s *DockerSuite) TestCreateEchoStdout(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, _ := dockerCmd(c, "create", "busybox", "echo", "test123")
 | 
						out, _ := dockerCmd(c, "create", "busybox", "echo", "test123")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -183,6 +185,7 @@ func (s *DockerSuite) TestCreateEchoStdout(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCreateVolumesCreated(c *check.C) {
 | 
					func (s *DockerSuite) TestCreateVolumesCreated(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon)
 | 
						testRequires(c, SameHostDaemon)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	name := "test_create_volume"
 | 
						name := "test_create_volume"
 | 
				
			||||||
| 
						 | 
					@ -203,6 +206,7 @@ func (s *DockerSuite) TestCreateVolumesCreated(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCreateLabels(c *check.C) {
 | 
					func (s *DockerSuite) TestCreateLabels(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test_create_labels"
 | 
						name := "test_create_labels"
 | 
				
			||||||
	expected := map[string]string{"k1": "v1", "k2": "v2"}
 | 
						expected := map[string]string{"k1": "v1", "k2": "v2"}
 | 
				
			||||||
	dockerCmd(c, "create", "--name", name, "-l", "k1=v1", "--label", "k2=v2", "busybox")
 | 
						dockerCmd(c, "create", "--name", name, "-l", "k1=v1", "--label", "k2=v2", "busybox")
 | 
				
			||||||
| 
						 | 
					@ -219,6 +223,7 @@ func (s *DockerSuite) TestCreateLabels(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCreateLabelFromImage(c *check.C) {
 | 
					func (s *DockerSuite) TestCreateLabelFromImage(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	imageName := "testcreatebuildlabel"
 | 
						imageName := "testcreatebuildlabel"
 | 
				
			||||||
	_, err := buildImage(imageName,
 | 
						_, err := buildImage(imageName,
 | 
				
			||||||
		`FROM busybox
 | 
							`FROM busybox
 | 
				
			||||||
| 
						 | 
					@ -244,6 +249,7 @@ func (s *DockerSuite) TestCreateLabelFromImage(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCreateHostnameWithNumber(c *check.C) {
 | 
					func (s *DockerSuite) TestCreateHostnameWithNumber(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-h", "web.0", "busybox", "hostname")
 | 
						out, _ := dockerCmd(c, "run", "-h", "web.0", "busybox", "hostname")
 | 
				
			||||||
	if strings.TrimSpace(out) != "web.0" {
 | 
						if strings.TrimSpace(out) != "web.0" {
 | 
				
			||||||
		c.Fatalf("hostname not set, expected `web.0`, got: %s", out)
 | 
							c.Fatalf("hostname not set, expected `web.0`, got: %s", out)
 | 
				
			||||||
| 
						 | 
					@ -251,6 +257,7 @@ func (s *DockerSuite) TestCreateHostnameWithNumber(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCreateRM(c *check.C) {
 | 
					func (s *DockerSuite) TestCreateRM(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// Test to make sure we can 'rm' a new container that is in
 | 
						// Test to make sure we can 'rm' a new container that is in
 | 
				
			||||||
	// "Created" state, and has ever been run. Test "rm -f" too.
 | 
						// "Created" state, and has ever been run. Test "rm -f" too.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -268,6 +275,7 @@ func (s *DockerSuite) TestCreateRM(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCreateModeIpcContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestCreateModeIpcContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon)
 | 
						testRequires(c, SameHostDaemon)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, _ := dockerCmd(c, "create", "busybox")
 | 
						out, _ := dockerCmd(c, "create", "busybox")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ensure that an added file shows up in docker diff
 | 
					// ensure that an added file shows up in docker diff
 | 
				
			||||||
func (s *DockerSuite) TestDiffFilenameShownInOutput(c *check.C) {
 | 
					func (s *DockerSuite) TestDiffFilenameShownInOutput(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	containerCmd := `echo foo > /root/bar`
 | 
						containerCmd := `echo foo > /root/bar`
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", containerCmd)
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", containerCmd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,6 +29,7 @@ func (s *DockerSuite) TestDiffFilenameShownInOutput(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// test to ensure GH #3840 doesn't occur any more
 | 
					// test to ensure GH #3840 doesn't occur any more
 | 
				
			||||||
func (s *DockerSuite) TestDiffEnsureDockerinitFilesAreIgnored(c *check.C) {
 | 
					func (s *DockerSuite) TestDiffEnsureDockerinitFilesAreIgnored(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// this is a list of files which shouldn't show up in `docker diff`
 | 
						// this is a list of files which shouldn't show up in `docker diff`
 | 
				
			||||||
	dockerinitFiles := []string{"/etc/resolv.conf", "/etc/hostname", "/etc/hosts", "/.dockerinit", "/.dockerenv"}
 | 
						dockerinitFiles := []string{"/etc/resolv.conf", "/etc/hostname", "/etc/hosts", "/.dockerinit", "/.dockerenv"}
 | 
				
			||||||
	containerCount := 5
 | 
						containerCount := 5
 | 
				
			||||||
| 
						 | 
					@ -49,6 +51,7 @@ func (s *DockerSuite) TestDiffEnsureDockerinitFilesAreIgnored(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestDiffEnsureOnlyKmsgAndPtmx(c *check.C) {
 | 
					func (s *DockerSuite) TestDiffEnsureOnlyKmsgAndPtmx(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "sleep", "0")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "sleep", "0")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanCID := strings.TrimSpace(out)
 | 
						cleanCID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,6 +17,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	image := "busybox"
 | 
						image := "busybox"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Start stopwatch, generate an event
 | 
						// Start stopwatch, generate an event
 | 
				
			||||||
| 
						 | 
					@ -48,6 +49,7 @@ func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsUntag(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsUntag(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	image := "busybox"
 | 
						image := "busybox"
 | 
				
			||||||
	dockerCmd(c, "tag", image, "utest:tag1")
 | 
						dockerCmd(c, "tag", image, "utest:tag1")
 | 
				
			||||||
	dockerCmd(c, "tag", image, "utest:tag2")
 | 
						dockerCmd(c, "tag", image, "utest:tag2")
 | 
				
			||||||
| 
						 | 
					@ -97,7 +99,7 @@ func (s *DockerSuite) TestEventsContainerFailStartDie(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsLimit(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsLimit(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	var waitGroup sync.WaitGroup
 | 
						var waitGroup sync.WaitGroup
 | 
				
			||||||
	errChan := make(chan error, 17)
 | 
						errChan := make(chan error, 17)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -128,6 +130,7 @@ func (s *DockerSuite) TestEventsLimit(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsContainerEvents(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsContainerEvents(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "--rm", "busybox", "true")
 | 
						dockerCmd(c, "run", "--rm", "busybox", "true")
 | 
				
			||||||
	out, _ := dockerCmd(c, "events", "--since=0", fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
 | 
						out, _ := dockerCmd(c, "events", "--since=0", fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
 | 
				
			||||||
	events := strings.Split(out, "\n")
 | 
						events := strings.Split(out, "\n")
 | 
				
			||||||
| 
						 | 
					@ -159,6 +162,7 @@ func (s *DockerSuite) TestEventsContainerEvents(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "--rm", "busybox", "true")
 | 
						dockerCmd(c, "run", "--rm", "busybox", "true")
 | 
				
			||||||
	timeBeginning := time.Unix(0, 0).Format(time.RFC3339Nano)
 | 
						timeBeginning := time.Unix(0, 0).Format(time.RFC3339Nano)
 | 
				
			||||||
	timeBeginning = strings.Replace(timeBeginning, "Z", ".000000000Z", -1)
 | 
						timeBeginning = strings.Replace(timeBeginning, "Z", ".000000000Z", -1)
 | 
				
			||||||
| 
						 | 
					@ -193,6 +197,7 @@ func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsImageUntagDelete(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsImageUntagDelete(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "testimageevents"
 | 
						name := "testimageevents"
 | 
				
			||||||
	_, err := buildImage(name,
 | 
						_, err := buildImage(name,
 | 
				
			||||||
		`FROM scratch
 | 
							`FROM scratch
 | 
				
			||||||
| 
						 | 
					@ -222,6 +227,7 @@ func (s *DockerSuite) TestEventsImageUntagDelete(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsImageTag(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsImageTag(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	time.Sleep(1 * time.Second) // because API has seconds granularity
 | 
						time.Sleep(1 * time.Second) // because API has seconds granularity
 | 
				
			||||||
	since := daemonTime(c).Unix()
 | 
						since := daemonTime(c).Unix()
 | 
				
			||||||
	image := "testimageevents:tag"
 | 
						image := "testimageevents:tag"
 | 
				
			||||||
| 
						 | 
					@ -245,6 +251,7 @@ func (s *DockerSuite) TestEventsImageTag(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsImagePull(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsImagePull(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	since := daemonTime(c).Unix()
 | 
						since := daemonTime(c).Unix()
 | 
				
			||||||
	testRequires(c, Network)
 | 
						testRequires(c, Network)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -264,6 +271,7 @@ func (s *DockerSuite) TestEventsImagePull(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsImageImport(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsImageImport(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	since := daemonTime(c).Unix()
 | 
						since := daemonTime(c).Unix()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	id := make(chan string)
 | 
						id := make(chan string)
 | 
				
			||||||
| 
						 | 
					@ -312,6 +320,7 @@ func (s *DockerSuite) TestEventsImageImport(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsFilters(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsFilters(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	parseEvents := func(out, match string) {
 | 
						parseEvents := func(out, match string) {
 | 
				
			||||||
		events := strings.Split(out, "\n")
 | 
							events := strings.Split(out, "\n")
 | 
				
			||||||
		events = events[:len(events)-1]
 | 
							events = events[:len(events)-1]
 | 
				
			||||||
| 
						 | 
					@ -342,6 +351,7 @@ func (s *DockerSuite) TestEventsFilters(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsFilterImageName(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsFilterImageName(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	since := daemonTime(c).Unix()
 | 
						since := daemonTime(c).Unix()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "--name", "container_1", "-d", "busybox:latest", "true")
 | 
						out, _ := dockerCmd(c, "run", "--name", "container_1", "-d", "busybox:latest", "true")
 | 
				
			||||||
| 
						 | 
					@ -374,6 +384,7 @@ func (s *DockerSuite) TestEventsFilterImageName(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsFilterContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsFilterContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	since := fmt.Sprintf("%d", daemonTime(c).Unix())
 | 
						since := fmt.Sprintf("%d", daemonTime(c).Unix())
 | 
				
			||||||
	nameID := make(map[string]string)
 | 
						nameID := make(map[string]string)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -425,6 +436,7 @@ func (s *DockerSuite) TestEventsFilterContainer(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsStreaming(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsStreaming(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	start := daemonTime(c).Unix()
 | 
						start := daemonTime(c).Unix()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	id := make(chan string)
 | 
						id := make(chan string)
 | 
				
			||||||
| 
						 | 
					@ -502,6 +514,7 @@ func (s *DockerSuite) TestEventsStreaming(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsCommit(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsCommit(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	since := daemonTime(c).Unix()
 | 
						since := daemonTime(c).Unix()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
| 
						 | 
					@ -518,6 +531,7 @@ func (s *DockerSuite) TestEventsCommit(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsCopy(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsCopy(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	since := daemonTime(c).Unix()
 | 
						since := daemonTime(c).Unix()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Build a test image.
 | 
						// Build a test image.
 | 
				
			||||||
| 
						 | 
					@ -557,6 +571,7 @@ func (s *DockerSuite) TestEventsCopy(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsResize(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsResize(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	since := daemonTime(c).Unix()
 | 
						since := daemonTime(c).Unix()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
| 
						 | 
					@ -577,6 +592,7 @@ func (s *DockerSuite) TestEventsResize(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsAttach(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsAttach(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	since := daemonTime(c).Unix()
 | 
						since := daemonTime(c).Unix()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-di", "busybox", "/bin/cat")
 | 
						out, _ := dockerCmd(c, "run", "-di", "busybox", "/bin/cat")
 | 
				
			||||||
| 
						 | 
					@ -613,6 +629,7 @@ func (s *DockerSuite) TestEventsAttach(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsRename(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsRename(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	since := daemonTime(c).Unix()
 | 
						since := daemonTime(c).Unix()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dockerCmd(c, "run", "--name", "oldName", "busybox", "true")
 | 
						dockerCmd(c, "run", "--name", "oldName", "busybox", "true")
 | 
				
			||||||
| 
						 | 
					@ -625,6 +642,7 @@ func (s *DockerSuite) TestEventsRename(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestEventsTop(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsTop(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	since := daemonTime(c).Unix()
 | 
						since := daemonTime(c).Unix()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
| 
						 | 
					@ -642,6 +660,7 @@ func (s *DockerSuite) TestEventsTop(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// #13753
 | 
					// #13753
 | 
				
			||||||
func (s *DockerSuite) TestEventsDefaultEmpty(c *check.C) {
 | 
					func (s *DockerSuite) TestEventsDefaultEmpty(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "busybox")
 | 
						dockerCmd(c, "run", "busybox")
 | 
				
			||||||
	out, _ := dockerCmd(c, "events", fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
 | 
						out, _ := dockerCmd(c, "events", fmt.Sprintf("--until=%d", daemonTime(c).Unix()))
 | 
				
			||||||
	c.Assert(strings.TrimSpace(out), check.Equals, "")
 | 
						c.Assert(strings.TrimSpace(out), check.Equals, "")
 | 
				
			||||||
| 
						 | 
					@ -649,6 +668,7 @@ func (s *DockerSuite) TestEventsDefaultEmpty(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// #14316
 | 
					// #14316
 | 
				
			||||||
func (s *DockerRegistrySuite) TestEventsImageFilterPush(c *check.C) {
 | 
					func (s *DockerRegistrySuite) TestEventsImageFilterPush(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, Network)
 | 
						testRequires(c, Network)
 | 
				
			||||||
	since := daemonTime(c).Unix()
 | 
						since := daemonTime(c).Unix()
 | 
				
			||||||
	repoName := fmt.Sprintf("%v/dockercli/testf", privateRegistryURL)
 | 
						repoName := fmt.Sprintf("%v/dockercli/testf", privateRegistryURL)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,6 +19,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExec(c *check.C) {
 | 
					func (s *DockerSuite) TestExec(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "sh", "-c", "echo test > /tmp/file && top")
 | 
						dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "sh", "-c", "echo test > /tmp/file && top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, _ := dockerCmd(c, "exec", "testing", "cat", "/tmp/file")
 | 
						out, _ := dockerCmd(c, "exec", "testing", "cat", "/tmp/file")
 | 
				
			||||||
| 
						 | 
					@ -30,6 +31,7 @@ func (s *DockerSuite) TestExec(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecInteractive(c *check.C) {
 | 
					func (s *DockerSuite) TestExecInteractive(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "sh", "-c", "echo test > /tmp/file && top")
 | 
						dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "sh", "-c", "echo test > /tmp/file && top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	execCmd := exec.Command(dockerBinary, "exec", "-i", "testing", "sh")
 | 
						execCmd := exec.Command(dockerBinary, "exec", "-i", "testing", "sh")
 | 
				
			||||||
| 
						 | 
					@ -76,6 +78,7 @@ func (s *DockerSuite) TestExecInteractive(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecAfterContainerRestart(c *check.C) {
 | 
					func (s *DockerSuite) TestExecAfterContainerRestart(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
	dockerCmd(c, "restart", cleanedContainerID)
 | 
						dockerCmd(c, "restart", cleanedContainerID)
 | 
				
			||||||
| 
						 | 
					@ -88,6 +91,7 @@ func (s *DockerSuite) TestExecAfterContainerRestart(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerDaemonSuite) TestExecAfterDaemonRestart(c *check.C) {
 | 
					func (s *DockerDaemonSuite) TestExecAfterDaemonRestart(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon)
 | 
						testRequires(c, SameHostDaemon)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err := s.d.StartWithBusybox(); err != nil {
 | 
						if err := s.d.StartWithBusybox(); err != nil {
 | 
				
			||||||
| 
						 | 
					@ -119,6 +123,7 @@ func (s *DockerDaemonSuite) TestExecAfterDaemonRestart(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Regression test for #9155, #9044
 | 
					// Regression test for #9155, #9044
 | 
				
			||||||
func (s *DockerSuite) TestExecEnv(c *check.C) {
 | 
					func (s *DockerSuite) TestExecEnv(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-e", "LALA=value1", "-e", "LALA=value2",
 | 
						dockerCmd(c, "run", "-e", "LALA=value1", "-e", "LALA=value2",
 | 
				
			||||||
		"-d", "--name", "testing", "busybox", "top")
 | 
							"-d", "--name", "testing", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -131,6 +136,7 @@ func (s *DockerSuite) TestExecEnv(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecExitStatus(c *check.C) {
 | 
					func (s *DockerSuite) TestExecExitStatus(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "top", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", "top", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Test normal (non-detached) case first
 | 
						// Test normal (non-detached) case first
 | 
				
			||||||
| 
						 | 
					@ -142,6 +148,7 @@ func (s *DockerSuite) TestExecExitStatus(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecPausedContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestExecPausedContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	defer unpauseAllContainers()
 | 
						defer unpauseAllContainers()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "top")
 | 
				
			||||||
| 
						 | 
					@ -161,6 +168,7 @@ func (s *DockerSuite) TestExecPausedContainer(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// regression test for #9476
 | 
					// regression test for #9476
 | 
				
			||||||
func (s *DockerSuite) TestExecTtyCloseStdin(c *check.C) {
 | 
					func (s *DockerSuite) TestExecTtyCloseStdin(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "-it", "--name", "exec_tty_stdin", "busybox")
 | 
						dockerCmd(c, "run", "-d", "-it", "--name", "exec_tty_stdin", "busybox")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cmd := exec.Command(dockerBinary, "exec", "-i", "exec_tty_stdin", "cat")
 | 
						cmd := exec.Command(dockerBinary, "exec", "-i", "exec_tty_stdin", "cat")
 | 
				
			||||||
| 
						 | 
					@ -184,6 +192,7 @@ func (s *DockerSuite) TestExecTtyCloseStdin(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecTtyWithoutStdin(c *check.C) {
 | 
					func (s *DockerSuite) TestExecTtyWithoutStdin(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "-ti", "busybox")
 | 
						out, _ := dockerCmd(c, "run", "-d", "-ti", "busybox")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
	c.Assert(waitRun(id), check.IsNil)
 | 
						c.Assert(waitRun(id), check.IsNil)
 | 
				
			||||||
| 
						 | 
					@ -217,6 +226,7 @@ func (s *DockerSuite) TestExecTtyWithoutStdin(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecParseError(c *check.C) {
 | 
					func (s *DockerSuite) TestExecParseError(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "top", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", "top", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Test normal (non-detached) case first
 | 
						// Test normal (non-detached) case first
 | 
				
			||||||
| 
						 | 
					@ -227,6 +237,7 @@ func (s *DockerSuite) TestExecParseError(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecStopNotHanging(c *check.C) {
 | 
					func (s *DockerSuite) TestExecStopNotHanging(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err := exec.Command(dockerBinary, "exec", "testing", "top").Start(); err != nil {
 | 
						if err := exec.Command(dockerBinary, "exec", "testing", "top").Start(); err != nil {
 | 
				
			||||||
| 
						 | 
					@ -253,6 +264,7 @@ func (s *DockerSuite) TestExecStopNotHanging(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecCgroup(c *check.C) {
 | 
					func (s *DockerSuite) TestExecCgroup(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, _ := dockerCmd(c, "exec", "testing", "cat", "/proc/1/cgroup")
 | 
						out, _ := dockerCmd(c, "exec", "testing", "cat", "/proc/1/cgroup")
 | 
				
			||||||
| 
						 | 
					@ -303,6 +315,7 @@ func (s *DockerSuite) TestExecCgroup(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectExecID(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectExecID(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
	id := strings.TrimSuffix(out, "\n")
 | 
						id := strings.TrimSuffix(out, "\n")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -388,6 +401,7 @@ func (s *DockerSuite) TestInspectExecID(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLinksPingLinkedContainersOnRename(c *check.C) {
 | 
					func (s *DockerSuite) TestLinksPingLinkedContainersOnRename(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	var out string
 | 
						var out string
 | 
				
			||||||
	out, _ = dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top")
 | 
						out, _ = dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top")
 | 
				
			||||||
	idA := strings.TrimSpace(out)
 | 
						idA := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -517,6 +531,7 @@ func (s *DockerSuite) TestRunMutableNetworkFiles(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecWithUser(c *check.C) {
 | 
					func (s *DockerSuite) TestExecWithUser(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "parent", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", "parent", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, _ := dockerCmd(c, "exec", "-u", "1", "parent", "id")
 | 
						out, _ := dockerCmd(c, "exec", "-u", "1", "parent", "id")
 | 
				
			||||||
| 
						 | 
					@ -531,7 +546,7 @@ func (s *DockerSuite) TestExecWithUser(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecWithPrivileged(c *check.C) {
 | 
					func (s *DockerSuite) TestExecWithPrivileged(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// Start main loop which attempts mknod repeatedly
 | 
						// Start main loop which attempts mknod repeatedly
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "parent", "--cap-drop=ALL", "busybox", "sh", "-c", `while (true); do if [ -e /exec_priv ]; then cat /exec_priv && mknod /tmp/sda b 8 0 && echo "Success"; else echo "Privileged exec has not run yet"; fi; usleep 10000; done`)
 | 
						dockerCmd(c, "run", "-d", "--name", "parent", "--cap-drop=ALL", "busybox", "sh", "-c", `while (true); do if [ -e /exec_priv ]; then cat /exec_priv && mknod /tmp/sda b 8 0 && echo "Success"; else echo "Privileged exec has not run yet"; fi; usleep 10000; done`)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -569,6 +584,7 @@ func (s *DockerSuite) TestExecWithPrivileged(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecWithImageUser(c *check.C) {
 | 
					func (s *DockerSuite) TestExecWithImageUser(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "testbuilduser"
 | 
						name := "testbuilduser"
 | 
				
			||||||
	_, err := buildImage(name,
 | 
						_, err := buildImage(name,
 | 
				
			||||||
		`FROM busybox
 | 
							`FROM busybox
 | 
				
			||||||
| 
						 | 
					@ -588,6 +604,7 @@ func (s *DockerSuite) TestExecWithImageUser(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecOnReadonlyContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestExecOnReadonlyContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--read-only", "--name", "parent", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--read-only", "--name", "parent", "busybox", "top")
 | 
				
			||||||
	if _, status := dockerCmd(c, "exec", "parent", "true"); status != 0 {
 | 
						if _, status := dockerCmd(c, "exec", "parent", "true"); status != 0 {
 | 
				
			||||||
		c.Fatalf("exec into a read-only container failed with exit status %d", status)
 | 
							c.Fatalf("exec into a read-only container failed with exit status %d", status)
 | 
				
			||||||
| 
						 | 
					@ -596,6 +613,7 @@ func (s *DockerSuite) TestExecOnReadonlyContainer(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// #15750
 | 
					// #15750
 | 
				
			||||||
func (s *DockerSuite) TestExecStartFails(c *check.C) {
 | 
					func (s *DockerSuite) TestExecStartFails(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "exec-15750"
 | 
						name := "exec-15750"
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", name, "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", name, "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// regression test for #12546
 | 
					// regression test for #12546
 | 
				
			||||||
func (s *DockerSuite) TestExecInteractiveStdinClose(c *check.C) {
 | 
					func (s *DockerSuite) TestExecInteractiveStdinClose(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-itd", "busybox", "/bin/cat")
 | 
						out, _ := dockerCmd(c, "run", "-itd", "busybox", "/bin/cat")
 | 
				
			||||||
	contID := strings.TrimSpace(out)
 | 
						contID := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,6 +45,7 @@ func (s *DockerSuite) TestExecInteractiveStdinClose(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestExecTTY(c *check.C) {
 | 
					func (s *DockerSuite) TestExecTTY(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name=test", "busybox", "sh", "-c", "echo hello > /foo && top")
 | 
						dockerCmd(c, "run", "-d", "--name=test", "busybox", "sh", "-c", "echo hello > /foo && top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cmd := exec.Command(dockerBinary, "exec", "-it", "test", "sh")
 | 
						cmd := exec.Command(dockerBinary, "exec", "-it", "test", "sh")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,6 +10,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// export an image and try to import it into a new one
 | 
					// export an image and try to import it into a new one
 | 
				
			||||||
func (s *DockerSuite) TestExportContainerAndImportImage(c *check.C) {
 | 
					func (s *DockerSuite) TestExportContainerAndImportImage(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	containerID := "testexportcontainerandimportimage"
 | 
						containerID := "testexportcontainerandimportimage"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dockerCmd(c, "run", "--name", containerID, "busybox", "true")
 | 
						dockerCmd(c, "run", "--name", containerID, "busybox", "true")
 | 
				
			||||||
| 
						 | 
					@ -31,6 +32,7 @@ func (s *DockerSuite) TestExportContainerAndImportImage(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Used to test output flag in the export command
 | 
					// Used to test output flag in the export command
 | 
				
			||||||
func (s *DockerSuite) TestExportContainerWithOutputAndImportImage(c *check.C) {
 | 
					func (s *DockerSuite) TestExportContainerWithOutputAndImportImage(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	containerID := "testexportcontainerwithoutputandimportimage"
 | 
						containerID := "testexportcontainerwithoutputandimportimage"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dockerCmd(c, "run", "--name", containerID, "busybox", "true")
 | 
						dockerCmd(c, "run", "--name", containerID, "busybox", "true")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,6 +12,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestHelpTextVerify(c *check.C) {
 | 
					func (s *DockerSuite) TestHelpTextVerify(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// Make sure main help text fits within 80 chars and that
 | 
						// Make sure main help text fits within 80 chars and that
 | 
				
			||||||
	// on non-windows system we use ~ when possible (to shorten things).
 | 
						// on non-windows system we use ~ when possible (to shorten things).
 | 
				
			||||||
	// Test for HOME set to its default value and set to "/" on linux
 | 
						// Test for HOME set to its default value and set to "/" on linux
 | 
				
			||||||
| 
						 | 
					@ -251,6 +252,7 @@ func (s *DockerSuite) TestHelpTextVerify(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestHelpExitCodesHelpOutput(c *check.C) {
 | 
					func (s *DockerSuite) TestHelpExitCodesHelpOutput(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// Test to make sure the exit code and output (stdout vs stderr) of
 | 
						// Test to make sure the exit code and output (stdout vs stderr) of
 | 
				
			||||||
	// various good and bad cases are what we expect
 | 
						// various good and bad cases are what we expect
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,6 +12,7 @@ import (
 | 
				
			||||||
// This is a heisen-test.  Because the created timestamp of images and the behavior of
 | 
					// This is a heisen-test.  Because the created timestamp of images and the behavior of
 | 
				
			||||||
// sort is not predictable it doesn't always fail.
 | 
					// sort is not predictable it doesn't always fail.
 | 
				
			||||||
func (s *DockerSuite) TestBuildHistory(c *check.C) {
 | 
					func (s *DockerSuite) TestBuildHistory(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "testbuildhistory"
 | 
						name := "testbuildhistory"
 | 
				
			||||||
	_, err := buildImage(name, `FROM busybox
 | 
						_, err := buildImage(name, `FROM busybox
 | 
				
			||||||
RUN echo "A"
 | 
					RUN echo "A"
 | 
				
			||||||
| 
						 | 
					@ -62,6 +63,7 @@ RUN echo "Z"`,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestHistoryExistentImage(c *check.C) {
 | 
					func (s *DockerSuite) TestHistoryExistentImage(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "history", "busybox")
 | 
						dockerCmd(c, "history", "busybox")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,6 +75,7 @@ func (s *DockerSuite) TestHistoryNonExistentImage(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestHistoryImageWithComment(c *check.C) {
 | 
					func (s *DockerSuite) TestHistoryImageWithComment(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "testhistoryimagewithcomment"
 | 
						name := "testhistoryimagewithcomment"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// make a image through docker commit <container id> [ -m messages ]
 | 
						// make a image through docker commit <container id> [ -m messages ]
 | 
				
			||||||
| 
						 | 
					@ -95,6 +98,7 @@ func (s *DockerSuite) TestHistoryImageWithComment(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestHistoryHumanOptionFalse(c *check.C) {
 | 
					func (s *DockerSuite) TestHistoryHumanOptionFalse(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "history", "--human=false", "busybox")
 | 
						out, _ := dockerCmd(c, "history", "--human=false", "busybox")
 | 
				
			||||||
	lines := strings.Split(out, "\n")
 | 
						lines := strings.Split(out, "\n")
 | 
				
			||||||
	sizeColumnRegex, _ := regexp.Compile("SIZE +")
 | 
						sizeColumnRegex, _ := regexp.Compile("SIZE +")
 | 
				
			||||||
| 
						 | 
					@ -113,6 +117,7 @@ func (s *DockerSuite) TestHistoryHumanOptionFalse(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestHistoryHumanOptionTrue(c *check.C) {
 | 
					func (s *DockerSuite) TestHistoryHumanOptionTrue(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "history", "--human=true", "busybox")
 | 
						out, _ := dockerCmd(c, "history", "--human=true", "busybox")
 | 
				
			||||||
	lines := strings.Split(out, "\n")
 | 
						lines := strings.Split(out, "\n")
 | 
				
			||||||
	sizeColumnRegex, _ := regexp.Compile("SIZE +")
 | 
						sizeColumnRegex, _ := regexp.Compile("SIZE +")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,6 +12,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestImagesEnsureImageIsListed(c *check.C) {
 | 
					func (s *DockerSuite) TestImagesEnsureImageIsListed(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "images")
 | 
						out, _ := dockerCmd(c, "images")
 | 
				
			||||||
	if !strings.Contains(out, "busybox") {
 | 
						if !strings.Contains(out, "busybox") {
 | 
				
			||||||
		c.Fatal("images should've listed busybox")
 | 
							c.Fatal("images should've listed busybox")
 | 
				
			||||||
| 
						 | 
					@ -19,6 +20,7 @@ func (s *DockerSuite) TestImagesEnsureImageIsListed(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestImagesEnsureImageWithTagIsListed(c *check.C) {
 | 
					func (s *DockerSuite) TestImagesEnsureImageWithTagIsListed(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	_, err := buildImage("imagewithtag:v1",
 | 
						_, err := buildImage("imagewithtag:v1",
 | 
				
			||||||
		`FROM scratch
 | 
							`FROM scratch
 | 
				
			||||||
		MAINTAINER dockerio1`, true)
 | 
							MAINTAINER dockerio1`, true)
 | 
				
			||||||
| 
						 | 
					@ -52,6 +54,7 @@ func (s *DockerSuite) TestImagesEnsureImageWithBadTagIsNotListed(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestImagesOrderedByCreationDate(c *check.C) {
 | 
					func (s *DockerSuite) TestImagesOrderedByCreationDate(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	id1, err := buildImage("order:test_a",
 | 
						id1, err := buildImage("order:test_a",
 | 
				
			||||||
		`FROM scratch
 | 
							`FROM scratch
 | 
				
			||||||
		MAINTAINER dockerio1`, true)
 | 
							MAINTAINER dockerio1`, true)
 | 
				
			||||||
| 
						 | 
					@ -94,6 +97,7 @@ func (s *DockerSuite) TestImagesErrorWithInvalidFilterNameTest(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestImagesFilterLabel(c *check.C) {
 | 
					func (s *DockerSuite) TestImagesFilterLabel(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	imageName1 := "images_filter_test1"
 | 
						imageName1 := "images_filter_test1"
 | 
				
			||||||
	imageName2 := "images_filter_test2"
 | 
						imageName2 := "images_filter_test2"
 | 
				
			||||||
	imageName3 := "images_filter_test3"
 | 
						imageName3 := "images_filter_test3"
 | 
				
			||||||
| 
						 | 
					@ -132,6 +136,7 @@ func (s *DockerSuite) TestImagesFilterLabel(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestImagesFilterSpaceTrimCase(c *check.C) {
 | 
					func (s *DockerSuite) TestImagesFilterSpaceTrimCase(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	imageName := "images_filter_test"
 | 
						imageName := "images_filter_test"
 | 
				
			||||||
	buildImage(imageName,
 | 
						buildImage(imageName,
 | 
				
			||||||
		`FROM scratch
 | 
							`FROM scratch
 | 
				
			||||||
| 
						 | 
					@ -170,6 +175,7 @@ func (s *DockerSuite) TestImagesFilterSpaceTrimCase(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *check.C) {
 | 
					func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// create container 1
 | 
						// create container 1
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
 | 
				
			||||||
	containerID1 := strings.TrimSpace(out)
 | 
						containerID1 := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,6 +12,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestImportDisplay(c *check.C) {
 | 
					func (s *DockerSuite) TestImportDisplay(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,6 +36,7 @@ func (s *DockerSuite) TestImportDisplay(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestImportBadURL(c *check.C) {
 | 
					func (s *DockerSuite) TestImportBadURL(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _, err := dockerCmdWithError("import", "http://nourl/bad")
 | 
						out, _, err := dockerCmdWithError("import", "http://nourl/bad")
 | 
				
			||||||
	if err == nil {
 | 
						if err == nil {
 | 
				
			||||||
		c.Fatal("import was supposed to fail but didn't")
 | 
							c.Fatal("import was supposed to fail but didn't")
 | 
				
			||||||
| 
						 | 
					@ -45,6 +47,7 @@ func (s *DockerSuite) TestImportBadURL(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestImportFile(c *check.C) {
 | 
					func (s *DockerSuite) TestImportFile(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "--name", "test-import", "busybox", "true")
 | 
						dockerCmd(c, "run", "--name", "test-import", "busybox", "true")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	temporaryFile, err := ioutil.TempFile("", "exportImportTest")
 | 
						temporaryFile, err := ioutil.TempFile("", "exportImportTest")
 | 
				
			||||||
| 
						 | 
					@ -74,6 +77,7 @@ func (s *DockerSuite) TestImportFile(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestImportFileWithMessage(c *check.C) {
 | 
					func (s *DockerSuite) TestImportFileWithMessage(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "--name", "test-import", "busybox", "true")
 | 
						dockerCmd(c, "run", "--name", "test-import", "busybox", "true")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	temporaryFile, err := ioutil.TempFile("", "exportImportTest")
 | 
						temporaryFile, err := ioutil.TempFile("", "exportImportTest")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectNamedMountPoint(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectNamedMountPoint(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "test", "-v", "data:/data", "busybox", "cat")
 | 
						dockerCmd(c, "run", "-d", "--name", "test", "-v", "data:/data", "busybox", "cat")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vol, err := inspectFieldJSON("test", "Mounts")
 | 
						vol, err := inspectFieldJSON("test", "Mounts")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,6 +14,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectImage(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectImage(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	imageTest := "emptyfs"
 | 
						imageTest := "emptyfs"
 | 
				
			||||||
	imageTestID := "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158"
 | 
						imageTestID := "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158"
 | 
				
			||||||
	id, err := inspectField(imageTest, "Id")
 | 
						id, err := inspectField(imageTest, "Id")
 | 
				
			||||||
| 
						 | 
					@ -25,6 +26,7 @@ func (s *DockerSuite) TestInspectImage(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectInt64(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectInt64(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	runCmd := exec.Command(dockerBinary, "run", "-d", "-m=300M", "busybox", "true")
 | 
						runCmd := exec.Command(dockerBinary, "run", "-d", "-m=300M", "busybox", "true")
 | 
				
			||||||
	out, _, _, err := runCommandWithStdoutStderr(runCmd)
 | 
						out, _, _, err := runCommandWithStdoutStderr(runCmd)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
| 
						 | 
					@ -41,7 +43,7 @@ func (s *DockerSuite) TestInspectInt64(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectDefault(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectDefault(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	//Both the container and image are named busybox. docker inspect will fetch the container JSON.
 | 
						//Both the container and image are named busybox. docker inspect will fetch the container JSON.
 | 
				
			||||||
	//If the container JSON is not available, it will go for the image JSON.
 | 
						//If the container JSON is not available, it will go for the image JSON.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,6 +52,7 @@ func (s *DockerSuite) TestInspectDefault(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectStatus(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectStatus(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
	out = strings.TrimSpace(out)
 | 
						out = strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -82,7 +85,7 @@ func (s *DockerSuite) TestInspectStatus(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	//Both the container and image are named busybox. docker inspect will fetch container
 | 
						//Both the container and image are named busybox. docker inspect will fetch container
 | 
				
			||||||
	//JSON State.Running field. If the field is true, it's a container.
 | 
						//JSON State.Running field. If the field is true, it's a container.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -100,7 +103,7 @@ func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	//Run this test on an image named busybox. docker inspect will try to fetch container
 | 
						//Run this test on an image named busybox. docker inspect will try to fetch container
 | 
				
			||||||
	//JSON. Since there is no container named busybox and --type=container, docker inspect will
 | 
						//JSON. Since there is no container named busybox and --type=container, docker inspect will
 | 
				
			||||||
	//not try to get the image JSON. It will throw an error.
 | 
						//not try to get the image JSON. It will throw an error.
 | 
				
			||||||
| 
						 | 
					@ -114,7 +117,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	//Both the container and image are named busybox. docker inspect will fetch image
 | 
						//Both the container and image are named busybox. docker inspect will fetch image
 | 
				
			||||||
	//JSON as --type=image. if there is no image with name busybox, docker inspect
 | 
						//JSON as --type=image. if there is no image with name busybox, docker inspect
 | 
				
			||||||
	//will throw an error.
 | 
						//will throw an error.
 | 
				
			||||||
| 
						 | 
					@ -132,7 +135,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	//Both the container and image are named busybox. docker inspect will fail
 | 
						//Both the container and image are named busybox. docker inspect will fail
 | 
				
			||||||
	//as --type=foobar is not a valid value for the flag.
 | 
						//as --type=foobar is not a valid value for the flag.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -147,6 +150,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	imageTest := "emptyfs"
 | 
						imageTest := "emptyfs"
 | 
				
			||||||
	out, err := inspectField(imageTest, "Size")
 | 
						out, err := inspectField(imageTest, "Size")
 | 
				
			||||||
	c.Assert(err, check.IsNil)
 | 
						c.Assert(err, check.IsNil)
 | 
				
			||||||
| 
						 | 
					@ -168,6 +172,7 @@ func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	runCmd := exec.Command(dockerBinary, "run", "-i", "-a", "stdin", "busybox", "cat")
 | 
						runCmd := exec.Command(dockerBinary, "run", "-i", "-a", "stdin", "busybox", "cat")
 | 
				
			||||||
	runCmd.Stdin = strings.NewReader("blahblah")
 | 
						runCmd.Stdin = strings.NewReader("blahblah")
 | 
				
			||||||
	out, _, _, err := runCommandWithStdoutStderr(runCmd)
 | 
						out, _, _, err := runCommandWithStdoutStderr(runCmd)
 | 
				
			||||||
| 
						 | 
					@ -194,6 +199,7 @@ func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectImageGraphDriver(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectImageGraphDriver(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	imageTest := "emptyfs"
 | 
						imageTest := "emptyfs"
 | 
				
			||||||
	name, err := inspectField(imageTest, "GraphDriver.Name")
 | 
						name, err := inspectField(imageTest, "GraphDriver.Name")
 | 
				
			||||||
	c.Assert(err, check.IsNil)
 | 
						c.Assert(err, check.IsNil)
 | 
				
			||||||
| 
						 | 
					@ -224,6 +230,7 @@ func (s *DockerSuite) TestInspectImageGraphDriver(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectContainerGraphDriver(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectContainerGraphDriver(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
 | 
				
			||||||
	out = strings.TrimSpace(out)
 | 
						out = strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -256,6 +263,7 @@ func (s *DockerSuite) TestInspectContainerGraphDriver(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "test", "-v", "/data:/data:ro,z", "busybox", "cat")
 | 
						dockerCmd(c, "run", "-d", "--name", "test", "-v", "/data:/data:ro,z", "busybox", "cat")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vol, err := inspectFieldJSON("test", "Mounts")
 | 
						vol, err := inspectFieldJSON("test", "Mounts")
 | 
				
			||||||
| 
						 | 
					@ -298,6 +306,7 @@ func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// #14947
 | 
					// #14947
 | 
				
			||||||
func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
	startedAt, err := inspectField(id, "State.StartedAt")
 | 
						startedAt, err := inspectField(id, "State.StartedAt")
 | 
				
			||||||
| 
						 | 
					@ -323,6 +332,7 @@ func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// #15633
 | 
					// #15633
 | 
				
			||||||
func (s *DockerSuite) TestInspectLogConfigNoType(c *check.C) {
 | 
					func (s *DockerSuite) TestInspectLogConfigNoType(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "create", "--name=test", "--log-opt", "max-file=42", "busybox")
 | 
						dockerCmd(c, "create", "--name=test", "--log-opt", "max-file=42", "busybox")
 | 
				
			||||||
	var logConfig runconfig.LogConfig
 | 
						var logConfig runconfig.LogConfig
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,6 +9,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestKillContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestKillContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
	c.Assert(waitRun(cleanedContainerID), check.IsNil)
 | 
						c.Assert(waitRun(cleanedContainerID), check.IsNil)
 | 
				
			||||||
| 
						 | 
					@ -22,6 +23,7 @@ func (s *DockerSuite) TestKillContainer(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestKillofStoppedContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestKillofStoppedContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,6 +34,7 @@ func (s *DockerSuite) TestKillofStoppedContainer(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestKillDifferentUserContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestKillDifferentUserContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-u", "daemon", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-u", "daemon", "-d", "busybox", "top")
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
	c.Assert(waitRun(cleanedContainerID), check.IsNil)
 | 
						c.Assert(waitRun(cleanedContainerID), check.IsNil)
 | 
				
			||||||
| 
						 | 
					@ -46,6 +49,7 @@ func (s *DockerSuite) TestKillDifferentUserContainer(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// regression test about correct signal parsing see #13665
 | 
					// regression test about correct signal parsing see #13665
 | 
				
			||||||
func (s *DockerSuite) TestKillWithSignal(c *check.C) {
 | 
					func (s *DockerSuite) TestKillWithSignal(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
	cid := strings.TrimSpace(out)
 | 
						cid := strings.TrimSpace(out)
 | 
				
			||||||
	c.Assert(waitRun(cid), check.IsNil)
 | 
						c.Assert(waitRun(cid), check.IsNil)
 | 
				
			||||||
| 
						 | 
					@ -59,6 +63,7 @@ func (s *DockerSuite) TestKillWithSignal(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) {
 | 
					func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
	cid := strings.TrimSpace(out)
 | 
						cid := strings.TrimSpace(out)
 | 
				
			||||||
	c.Assert(waitRun(cid), check.IsNil)
 | 
						c.Assert(waitRun(cid), check.IsNil)
 | 
				
			||||||
| 
						 | 
					@ -91,6 +96,7 @@ func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestKillofStoppedContainerAPIPre120(c *check.C) {
 | 
					func (s *DockerSuite) TestKillofStoppedContainerAPIPre120(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "--name", "docker-kill-test-api", "-d", "busybox", "top")
 | 
						dockerCmd(c, "run", "--name", "docker-kill-test-api", "-d", "busybox", "top")
 | 
				
			||||||
	dockerCmd(c, "stop", "docker-kill-test-api")
 | 
						dockerCmd(c, "stop", "docker-kill-test-api")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *check.C) {
 | 
					func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	_, exitCode, err := dockerCmdWithError("run", "--rm", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1")
 | 
						_, exitCode, err := dockerCmdWithError("run", "--rm", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if exitCode == 0 {
 | 
						if exitCode == 0 {
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@ func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Test for appropriate error when calling --link with an invalid target container
 | 
					// Test for appropriate error when calling --link with an invalid target container
 | 
				
			||||||
func (s *DockerSuite) TestLinksInvalidContainerTarget(c *check.C) {
 | 
					func (s *DockerSuite) TestLinksInvalidContainerTarget(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _, err := dockerCmdWithError("run", "--link", "bogus:alias", "busybox", "true")
 | 
						out, _, err := dockerCmdWithError("run", "--link", "bogus:alias", "busybox", "true")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err == nil {
 | 
						if err == nil {
 | 
				
			||||||
| 
						 | 
					@ -35,7 +35,7 @@ func (s *DockerSuite) TestLinksInvalidContainerTarget(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLinksPingLinkedContainers(c *check.C) {
 | 
					func (s *DockerSuite) TestLinksPingLinkedContainers(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "container1", "--hostname", "fred", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", "container1", "--hostname", "fred", "busybox", "top")
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "container2", "--hostname", "wilma", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", "container2", "--hostname", "wilma", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,7 +53,7 @@ func (s *DockerSuite) TestLinksPingLinkedContainers(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLinksPingLinkedContainersAfterRename(c *check.C) {
 | 
					func (s *DockerSuite) TestLinksPingLinkedContainersAfterRename(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top")
 | 
				
			||||||
	idA := strings.TrimSpace(out)
 | 
						idA := strings.TrimSpace(out)
 | 
				
			||||||
	out, _ = dockerCmd(c, "run", "-d", "--name", "container2", "busybox", "top")
 | 
						out, _ = dockerCmd(c, "run", "-d", "--name", "container2", "busybox", "top")
 | 
				
			||||||
| 
						 | 
					@ -66,6 +66,7 @@ func (s *DockerSuite) TestLinksPingLinkedContainersAfterRename(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLinksInspectLinksStarted(c *check.C) {
 | 
					func (s *DockerSuite) TestLinksInspectLinksStarted(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	var (
 | 
						var (
 | 
				
			||||||
		expected = map[string]struct{}{"/container1:/testinspectlink/alias1": {}, "/container2:/testinspectlink/alias2": {}}
 | 
							expected = map[string]struct{}{"/container1:/testinspectlink/alias1": {}, "/container2:/testinspectlink/alias2": {}}
 | 
				
			||||||
		result   []string
 | 
							result   []string
 | 
				
			||||||
| 
						 | 
					@ -93,6 +94,7 @@ func (s *DockerSuite) TestLinksInspectLinksStarted(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLinksInspectLinksStopped(c *check.C) {
 | 
					func (s *DockerSuite) TestLinksInspectLinksStopped(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	var (
 | 
						var (
 | 
				
			||||||
		expected = map[string]struct{}{"/container1:/testinspectlink/alias1": {}, "/container2:/testinspectlink/alias2": {}}
 | 
							expected = map[string]struct{}{"/container1:/testinspectlink/alias1": {}, "/container2:/testinspectlink/alias2": {}}
 | 
				
			||||||
		result   []string
 | 
							result   []string
 | 
				
			||||||
| 
						 | 
					@ -121,7 +123,7 @@ func (s *DockerSuite) TestLinksInspectLinksStopped(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLinksNotStartedParentNotFail(c *check.C) {
 | 
					func (s *DockerSuite) TestLinksNotStartedParentNotFail(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "create", "--name=first", "busybox", "top")
 | 
						dockerCmd(c, "create", "--name=first", "busybox", "top")
 | 
				
			||||||
	dockerCmd(c, "create", "--name=second", "--link=first:first", "busybox", "top")
 | 
						dockerCmd(c, "create", "--name=second", "--link=first:first", "busybox", "top")
 | 
				
			||||||
	dockerCmd(c, "start", "first")
 | 
						dockerCmd(c, "start", "first")
 | 
				
			||||||
| 
						 | 
					@ -129,6 +131,7 @@ func (s *DockerSuite) TestLinksNotStartedParentNotFail(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLinksHostsFilesInject(c *check.C) {
 | 
					func (s *DockerSuite) TestLinksHostsFilesInject(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon, ExecSupport)
 | 
						testRequires(c, SameHostDaemon, ExecSupport)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-itd", "--name", "one", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-itd", "--name", "one", "busybox", "top")
 | 
				
			||||||
| 
						 | 
					@ -156,6 +159,7 @@ func (s *DockerSuite) TestLinksHostsFilesInject(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLinksUpdateOnRestart(c *check.C) {
 | 
					func (s *DockerSuite) TestLinksUpdateOnRestart(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon, ExecSupport)
 | 
						testRequires(c, SameHostDaemon, ExecSupport)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "one", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", "one", "busybox", "top")
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "--name", "two", "--link", "one:onetwo", "--link", "one:one", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "--name", "two", "--link", "one:onetwo", "--link", "one:one", "busybox", "top")
 | 
				
			||||||
| 
						 | 
					@ -201,6 +205,7 @@ func (s *DockerSuite) TestLinksUpdateOnRestart(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLinksEnvs(c *check.C) {
 | 
					func (s *DockerSuite) TestLinksEnvs(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "-e", "e1=", "-e", "e2=v2", "-e", "e3=v3=v3", "--name=first", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "-e", "e1=", "-e", "e2=v2", "-e", "e3=v3=v3", "--name=first", "busybox", "top")
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "--name=second", "--link=first:first", "busybox", "env")
 | 
						out, _ := dockerCmd(c, "run", "--name=second", "--link=first:first", "busybox", "env")
 | 
				
			||||||
	if !strings.Contains(out, "FIRST_ENV_e1=\n") ||
 | 
						if !strings.Contains(out, "FIRST_ENV_e1=\n") ||
 | 
				
			||||||
| 
						 | 
					@ -211,6 +216,7 @@ func (s *DockerSuite) TestLinksEnvs(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLinkShortDefinition(c *check.C) {
 | 
					func (s *DockerSuite) TestLinkShortDefinition(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "--name", "shortlinkdef", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "--name", "shortlinkdef", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cid := strings.TrimSpace(out)
 | 
						cid := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -227,6 +233,7 @@ func (s *DockerSuite) TestLinkShortDefinition(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--net", "host", "--name", "host_container", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--net", "host", "--name", "host_container", "busybox", "top")
 | 
				
			||||||
	out, _, err := dockerCmdWithError("run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true")
 | 
						out, _, err := dockerCmdWithError("run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true")
 | 
				
			||||||
	if err == nil || !strings.Contains(out, "--net=host can't be used with links. This would result in undefined behavior") {
 | 
						if err == nil || !strings.Contains(out, "--net=host can't be used with links. This would result in undefined behavior") {
 | 
				
			||||||
| 
						 | 
					@ -235,6 +242,7 @@ func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *check.C) {
 | 
					func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ls", "-la", "/etc/hosts")
 | 
						out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ls", "-la", "/etc/hosts")
 | 
				
			||||||
	if !strings.HasPrefix(out, "-") {
 | 
						if !strings.HasPrefix(out, "-") {
 | 
				
			||||||
		c.Errorf("/etc/hosts should be a regular file")
 | 
							c.Errorf("/etc/hosts should be a regular file")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,6 +16,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// This used to work, it test a log of PageSize-1 (gh#4851)
 | 
					// This used to work, it test a log of PageSize-1 (gh#4851)
 | 
				
			||||||
func (s *DockerSuite) TestLogsContainerSmallerThanPage(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsContainerSmallerThanPage(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testLen := 32767
 | 
						testLen := 32767
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -29,6 +30,7 @@ func (s *DockerSuite) TestLogsContainerSmallerThanPage(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Regression test: When going over the PageSize, it used to panic (gh#4851)
 | 
					// Regression test: When going over the PageSize, it used to panic (gh#4851)
 | 
				
			||||||
func (s *DockerSuite) TestLogsContainerBiggerThanPage(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsContainerBiggerThanPage(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testLen := 32768
 | 
						testLen := 32768
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,6 +46,7 @@ func (s *DockerSuite) TestLogsContainerBiggerThanPage(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Regression test: When going much over the PageSize, it used to block (gh#4851)
 | 
					// Regression test: When going much over the PageSize, it used to block (gh#4851)
 | 
				
			||||||
func (s *DockerSuite) TestLogsContainerMuchBiggerThanPage(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsContainerMuchBiggerThanPage(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testLen := 33000
 | 
						testLen := 33000
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo -n =; done; echo", testLen))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -58,6 +61,7 @@ func (s *DockerSuite) TestLogsContainerMuchBiggerThanPage(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLogsTimestamps(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsTimestamps(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testLen := 100
 | 
						testLen := 100
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo =; done;", testLen))
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo =; done;", testLen))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -88,6 +92,7 @@ func (s *DockerSuite) TestLogsTimestamps(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLogsSeparateStderr(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsSeparateStderr(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	msg := "stderr_log"
 | 
						msg := "stderr_log"
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("echo %s 1>&2", msg))
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("echo %s 1>&2", msg))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,6 +112,7 @@ func (s *DockerSuite) TestLogsSeparateStderr(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLogsStderrInStdout(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsStderrInStdout(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	msg := "stderr_log"
 | 
						msg := "stderr_log"
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "-t", "busybox", "sh", "-c", fmt.Sprintf("echo %s 1>&2", msg))
 | 
						out, _ := dockerCmd(c, "run", "-d", "-t", "busybox", "sh", "-c", fmt.Sprintf("echo %s 1>&2", msg))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -125,6 +131,7 @@ func (s *DockerSuite) TestLogsStderrInStdout(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLogsTail(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsTail(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testLen := 100
 | 
						testLen := 100
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo =; done;", testLen))
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", fmt.Sprintf("for i in $(seq 1 %d); do echo =; done;", testLen))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -155,6 +162,7 @@ func (s *DockerSuite) TestLogsTail(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLogsFollowStopped(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsFollowStopped(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", "hello")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", "hello")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -180,6 +188,7 @@ func (s *DockerSuite) TestLogsFollowStopped(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLogsSince(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsSince(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "testlogssince"
 | 
						name := "testlogssince"
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "--name="+name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do sleep 2; echo `date +%s` log$i; done")
 | 
						out, _ := dockerCmd(c, "run", "--name="+name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do sleep 2; echo `date +%s` log$i; done")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -215,6 +224,7 @@ func (s *DockerSuite) TestLogsSince(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", `for i in $(seq 1 5); do date +%s; sleep 1; done`)
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", `for i in $(seq 1 5); do date +%s; sleep 1; done`)
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -238,6 +248,7 @@ func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Regression test for #8832
 | 
					// Regression test for #8832
 | 
				
			||||||
func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", `usleep 200000;yes X | head -c 200000`)
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", `usleep 200000;yes X | head -c 200000`)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -271,6 +282,7 @@ func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 2; done")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 2; done")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
	c.Assert(waitRun(id), check.IsNil)
 | 
						c.Assert(waitRun(id), check.IsNil)
 | 
				
			||||||
| 
						 | 
					@ -322,6 +334,7 @@ func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *check.C) {
 | 
					func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true; do sleep 2; done")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true; do sleep 2; done")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
	c.Assert(waitRun(id), check.IsNil)
 | 
						c.Assert(waitRun(id), check.IsNil)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,6 +54,7 @@ func getContainerStatus(c *check.C, containerID string) string {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestNetworkNat(c *check.C) {
 | 
					func (s *DockerSuite) TestNetworkNat(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon, NativeExecDriver)
 | 
						testRequires(c, SameHostDaemon, NativeExecDriver)
 | 
				
			||||||
	msg := "it works"
 | 
						msg := "it works"
 | 
				
			||||||
	startServerContainer(c, msg, 8080)
 | 
						startServerContainer(c, msg, 8080)
 | 
				
			||||||
| 
						 | 
					@ -74,6 +75,7 @@ func (s *DockerSuite) TestNetworkNat(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestNetworkLocalhostTCPNat(c *check.C) {
 | 
					func (s *DockerSuite) TestNetworkLocalhostTCPNat(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon, NativeExecDriver)
 | 
						testRequires(c, SameHostDaemon, NativeExecDriver)
 | 
				
			||||||
	var (
 | 
						var (
 | 
				
			||||||
		msg = "hi yall"
 | 
							msg = "hi yall"
 | 
				
			||||||
| 
						 | 
					@ -95,6 +97,7 @@ func (s *DockerSuite) TestNetworkLocalhostTCPNat(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestNetworkLoopbackNat(c *check.C) {
 | 
					func (s *DockerSuite) TestNetworkLoopbackNat(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon, NativeExecDriver)
 | 
						testRequires(c, SameHostDaemon, NativeExecDriver)
 | 
				
			||||||
	msg := "it works"
 | 
						msg := "it works"
 | 
				
			||||||
	startServerContainer(c, msg, 8080)
 | 
						startServerContainer(c, msg, 8080)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,6 +23,7 @@ func checkContains(expected string, out string, c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestNetHostname(c *check.C) {
 | 
					func (s *DockerSuite) TestNetHostname(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var (
 | 
						var (
 | 
				
			||||||
		out    string
 | 
							out    string
 | 
				
			||||||
| 
						 | 
					@ -80,6 +81,7 @@ func (s *DockerSuite) TestNetHostname(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestConflictContainerNetworkAndLinks(c *check.C) {
 | 
					func (s *DockerSuite) TestConflictContainerNetworkAndLinks(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	var (
 | 
						var (
 | 
				
			||||||
		out    string
 | 
							out    string
 | 
				
			||||||
		err    error
 | 
							err    error
 | 
				
			||||||
| 
						 | 
					@ -100,6 +102,7 @@ func (s *DockerSuite) TestConflictContainerNetworkAndLinks(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestConflictNetworkModeAndOptions(c *check.C) {
 | 
					func (s *DockerSuite) TestConflictNetworkModeAndOptions(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	var (
 | 
						var (
 | 
				
			||||||
		out    string
 | 
							out    string
 | 
				
			||||||
		err    error
 | 
							err    error
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPause(c *check.C) {
 | 
					func (s *DockerSuite) TestPause(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	defer unpauseAllContainers()
 | 
						defer unpauseAllContainers()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	name := "testeventpause"
 | 
						name := "testeventpause"
 | 
				
			||||||
| 
						 | 
					@ -43,6 +44,7 @@ func (s *DockerSuite) TestPause(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPauseMultipleContainers(c *check.C) {
 | 
					func (s *DockerSuite) TestPauseMultipleContainers(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	defer unpauseAllContainers()
 | 
						defer unpauseAllContainers()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	containers := []string{
 | 
						containers := []string{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPortList(c *check.C) {
 | 
					func (s *DockerSuite) TestPortList(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// one port
 | 
						// one port
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "-p", "9876:80", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "-p", "9876:80", "busybox", "top")
 | 
				
			||||||
	firstID := strings.TrimSpace(out)
 | 
						firstID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -181,6 +181,7 @@ func stopRemoveContainer(id string, c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *check.C) {
 | 
					func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// Run busybox with command line expose (equivalent to EXPOSE in image's Dockerfile) for the following ports
 | 
						// Run busybox with command line expose (equivalent to EXPOSE in image's Dockerfile) for the following ports
 | 
				
			||||||
	port1 := 80
 | 
						port1 := 80
 | 
				
			||||||
	port2 := 443
 | 
						port2 := 443
 | 
				
			||||||
| 
						 | 
					@ -248,6 +249,7 @@ func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPortHostBinding(c *check.C) {
 | 
					func (s *DockerSuite) TestPortHostBinding(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "-p", "9876:80", "busybox",
 | 
						out, _ := dockerCmd(c, "run", "-d", "-p", "9876:80", "busybox",
 | 
				
			||||||
		"nc", "-l", "-p", "80")
 | 
							"nc", "-l", "-p", "80")
 | 
				
			||||||
	firstID := strings.TrimSpace(out)
 | 
						firstID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -270,6 +272,7 @@ func (s *DockerSuite) TestPortHostBinding(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPortExposeHostBinding(c *check.C) {
 | 
					func (s *DockerSuite) TestPortExposeHostBinding(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "-P", "--expose", "80", "busybox",
 | 
						out, _ := dockerCmd(c, "run", "-d", "-P", "--expose", "80", "busybox",
 | 
				
			||||||
		"nc", "-l", "-p", "80")
 | 
							"nc", "-l", "-p", "80")
 | 
				
			||||||
	firstID := strings.TrimSpace(out)
 | 
						firstID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,6 +9,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCliProxyDisableProxyUnixSock(c *check.C) {
 | 
					func (s *DockerSuite) TestCliProxyDisableProxyUnixSock(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon) // test is valid when DOCKER_HOST=unix://..
 | 
						testRequires(c, SameHostDaemon) // test is valid when DOCKER_HOST=unix://..
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cmd := exec.Command(dockerBinary, "info")
 | 
						cmd := exec.Command(dockerBinary, "info")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,6 +18,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsListContainersBase(c *check.C) {
 | 
					func (s *DockerSuite) TestPsListContainersBase(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
	firstID := strings.TrimSpace(out)
 | 
						firstID := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -158,6 +159,7 @@ func assertContainerList(out string, expected []string) bool {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsListContainersSize(c *check.C) {
 | 
					func (s *DockerSuite) TestPsListContainersSize(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "busybox", "echo", "hello")
 | 
						dockerCmd(c, "run", "-d", "busybox", "echo", "hello")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	baseOut, _ := dockerCmd(c, "ps", "-s", "-n=1")
 | 
						baseOut, _ := dockerCmd(c, "ps", "-s", "-n=1")
 | 
				
			||||||
| 
						 | 
					@ -210,6 +212,7 @@ func (s *DockerSuite) TestPsListContainersSize(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) {
 | 
					func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// FIXME: this should test paused, but it makes things hang and its wonky
 | 
						// FIXME: this should test paused, but it makes things hang and its wonky
 | 
				
			||||||
	// this is because paused containers can't be controlled by signals
 | 
						// this is because paused containers can't be controlled by signals
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -245,7 +248,7 @@ func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsListContainersFilterID(c *check.C) {
 | 
					func (s *DockerSuite) TestPsListContainersFilterID(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// start container
 | 
						// start container
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox")
 | 
				
			||||||
	firstID := strings.TrimSpace(out)
 | 
						firstID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -263,7 +266,7 @@ func (s *DockerSuite) TestPsListContainersFilterID(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsListContainersFilterName(c *check.C) {
 | 
					func (s *DockerSuite) TestPsListContainersFilterName(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// start container
 | 
						// start container
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "--name=a_name_to_match", "busybox")
 | 
						out, _ := dockerCmd(c, "run", "-d", "--name=a_name_to_match", "busybox")
 | 
				
			||||||
	firstID := strings.TrimSpace(out)
 | 
						firstID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -289,6 +292,7 @@ func (s *DockerSuite) TestPsListContainersFilterName(c *check.C) {
 | 
				
			||||||
// - Run containers for each of those image (busybox, images_ps_filter_test1, images_ps_filter_test2)
 | 
					// - Run containers for each of those image (busybox, images_ps_filter_test1, images_ps_filter_test2)
 | 
				
			||||||
// - Filter them out :P
 | 
					// - Filter them out :P
 | 
				
			||||||
func (s *DockerSuite) TestPsListContainersFilterAncestorImage(c *check.C) {
 | 
					func (s *DockerSuite) TestPsListContainersFilterAncestorImage(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// Build images
 | 
						// Build images
 | 
				
			||||||
	imageName1 := "images_ps_filter_test1"
 | 
						imageName1 := "images_ps_filter_test1"
 | 
				
			||||||
	imageID1, err := buildImage(imageName1,
 | 
						imageID1, err := buildImage(imageName1,
 | 
				
			||||||
| 
						 | 
					@ -388,6 +392,7 @@ func checkPsAncestorFilterOutput(c *check.C, out string, filterName string, expe
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsListContainersFilterLabel(c *check.C) {
 | 
					func (s *DockerSuite) TestPsListContainersFilterLabel(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// start container
 | 
						// start container
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "-l", "match=me", "-l", "second=tag", "busybox")
 | 
						out, _ := dockerCmd(c, "run", "-d", "-l", "match=me", "-l", "second=tag", "busybox")
 | 
				
			||||||
	firstID := strings.TrimSpace(out)
 | 
						firstID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -430,7 +435,7 @@ func (s *DockerSuite) TestPsListContainersFilterLabel(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsListContainersFilterExited(c *check.C) {
 | 
					func (s *DockerSuite) TestPsListContainersFilterExited(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "top", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", "top", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dockerCmd(c, "run", "--name", "zero1", "busybox", "true")
 | 
						dockerCmd(c, "run", "--name", "zero1", "busybox", "true")
 | 
				
			||||||
| 
						 | 
					@ -490,6 +495,7 @@ func (s *DockerSuite) TestPsListContainersFilterExited(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsRightTagName(c *check.C) {
 | 
					func (s *DockerSuite) TestPsRightTagName(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	tag := "asybox:shmatest"
 | 
						tag := "asybox:shmatest"
 | 
				
			||||||
	dockerCmd(c, "tag", "busybox", tag)
 | 
						dockerCmd(c, "tag", "busybox", tag)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -538,6 +544,7 @@ func (s *DockerSuite) TestPsRightTagName(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsLinkedWithNoTrunc(c *check.C) {
 | 
					func (s *DockerSuite) TestPsLinkedWithNoTrunc(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "--name=first", "-d", "busybox", "top")
 | 
						dockerCmd(c, "run", "--name=first", "-d", "busybox", "top")
 | 
				
			||||||
	dockerCmd(c, "run", "--name=second", "--link=first:first", "-d", "busybox", "top")
 | 
						dockerCmd(c, "run", "--name=second", "--link=first:first", "-d", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -557,7 +564,7 @@ func (s *DockerSuite) TestPsLinkedWithNoTrunc(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsGroupPortRange(c *check.C) {
 | 
					func (s *DockerSuite) TestPsGroupPortRange(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	portRange := "3800-3900"
 | 
						portRange := "3800-3900"
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "porttest", "-p", portRange+":"+portRange, "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", "porttest", "-p", portRange+":"+portRange, "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -571,6 +578,7 @@ func (s *DockerSuite) TestPsGroupPortRange(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsWithSize(c *check.C) {
 | 
					func (s *DockerSuite) TestPsWithSize(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "sizetest", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", "sizetest", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, _ := dockerCmd(c, "ps", "--size")
 | 
						out, _ := dockerCmd(c, "ps", "--size")
 | 
				
			||||||
| 
						 | 
					@ -580,6 +588,7 @@ func (s *DockerSuite) TestPsWithSize(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsListContainersFilterCreated(c *check.C) {
 | 
					func (s *DockerSuite) TestPsListContainersFilterCreated(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// create a container
 | 
						// create a container
 | 
				
			||||||
	out, _ := dockerCmd(c, "create", "busybox")
 | 
						out, _ := dockerCmd(c, "create", "busybox")
 | 
				
			||||||
	cID := strings.TrimSpace(out)
 | 
						cID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -618,6 +627,7 @@ func (s *DockerSuite) TestPsListContainersFilterCreated(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsFormatMultiNames(c *check.C) {
 | 
					func (s *DockerSuite) TestPsFormatMultiNames(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	//create 2 containers and link them
 | 
						//create 2 containers and link them
 | 
				
			||||||
	dockerCmd(c, "run", "--name=child", "-d", "busybox", "top")
 | 
						dockerCmd(c, "run", "--name=child", "-d", "busybox", "top")
 | 
				
			||||||
	dockerCmd(c, "run", "--name=parent", "--link=child:linkedone", "-d", "busybox", "top")
 | 
						dockerCmd(c, "run", "--name=parent", "--link=child:linkedone", "-d", "busybox", "top")
 | 
				
			||||||
| 
						 | 
					@ -649,6 +659,7 @@ func (s *DockerSuite) TestPsFormatMultiNames(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsFormatHeaders(c *check.C) {
 | 
					func (s *DockerSuite) TestPsFormatHeaders(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// make sure no-container "docker ps" still prints the header row
 | 
						// make sure no-container "docker ps" still prints the header row
 | 
				
			||||||
	out, _ := dockerCmd(c, "ps", "--format", "table {{.ID}}")
 | 
						out, _ := dockerCmd(c, "ps", "--format", "table {{.ID}}")
 | 
				
			||||||
	if out != "CONTAINER ID\n" {
 | 
						if out != "CONTAINER ID\n" {
 | 
				
			||||||
| 
						 | 
					@ -664,6 +675,7 @@ func (s *DockerSuite) TestPsFormatHeaders(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestPsDefaultFormatAndQuiet(c *check.C) {
 | 
					func (s *DockerSuite) TestPsDefaultFormatAndQuiet(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	config := `{
 | 
						config := `{
 | 
				
			||||||
		"psFormat": "{{ .ID }} default"
 | 
							"psFormat": "{{ .ID }} default"
 | 
				
			||||||
}`
 | 
					}`
 | 
				
			||||||
| 
						 | 
					@ -685,6 +697,7 @@ func (s *DockerSuite) TestPsDefaultFormatAndQuiet(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Test for GitHub issue #12595
 | 
					// Test for GitHub issue #12595
 | 
				
			||||||
func (s *DockerSuite) TestPsImageIDAfterUpdate(c *check.C) {
 | 
					func (s *DockerSuite) TestPsImageIDAfterUpdate(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	originalImageName := "busybox:TestPsImageIDAfterUpdate-original"
 | 
						originalImageName := "busybox:TestPsImageIDAfterUpdate-original"
 | 
				
			||||||
	updatedImageName := "busybox:TestPsImageIDAfterUpdate-updated"
 | 
						updatedImageName := "busybox:TestPsImageIDAfterUpdate-updated"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,6 +14,7 @@ import (
 | 
				
			||||||
// TestPullFromCentralRegistry pulls an image from the central registry and verifies that the client
 | 
					// TestPullFromCentralRegistry pulls an image from the central registry and verifies that the client
 | 
				
			||||||
// prints all expected output.
 | 
					// prints all expected output.
 | 
				
			||||||
func (s *DockerHubPullSuite) TestPullFromCentralRegistry(c *check.C) {
 | 
					func (s *DockerHubPullSuite) TestPullFromCentralRegistry(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out := s.Cmd(c, "pull", "hello-world")
 | 
						out := s.Cmd(c, "pull", "hello-world")
 | 
				
			||||||
	defer deleteImages("hello-world")
 | 
						defer deleteImages("hello-world")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,6 +40,7 @@ func (s *DockerHubPullSuite) TestPullFromCentralRegistry(c *check.C) {
 | 
				
			||||||
// TestPullNonExistingImage pulls non-existing images from the central registry, with different
 | 
					// TestPullNonExistingImage pulls non-existing images from the central registry, with different
 | 
				
			||||||
// combinations of implicit tag and library prefix.
 | 
					// combinations of implicit tag and library prefix.
 | 
				
			||||||
func (s *DockerHubPullSuite) TestPullNonExistingImage(c *check.C) {
 | 
					func (s *DockerHubPullSuite) TestPullNonExistingImage(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	for _, e := range []struct {
 | 
						for _, e := range []struct {
 | 
				
			||||||
		Image string
 | 
							Image string
 | 
				
			||||||
		Alias string
 | 
							Alias string
 | 
				
			||||||
| 
						 | 
					@ -61,6 +63,7 @@ func (s *DockerHubPullSuite) TestPullNonExistingImage(c *check.C) {
 | 
				
			||||||
// reference (tag, repository, central registry url, ...) doesn't trigger a new pull nor leads to
 | 
					// reference (tag, repository, central registry url, ...) doesn't trigger a new pull nor leads to
 | 
				
			||||||
// multiple images.
 | 
					// multiple images.
 | 
				
			||||||
func (s *DockerHubPullSuite) TestPullFromCentralRegistryImplicitRefParts(c *check.C) {
 | 
					func (s *DockerHubPullSuite) TestPullFromCentralRegistryImplicitRefParts(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	s.Cmd(c, "pull", "hello-world")
 | 
						s.Cmd(c, "pull", "hello-world")
 | 
				
			||||||
	defer deleteImages("hello-world")
 | 
						defer deleteImages("hello-world")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -87,6 +90,7 @@ func (s *DockerHubPullSuite) TestPullFromCentralRegistryImplicitRefParts(c *chec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TestPullScratchNotAllowed verifies that pulling 'scratch' is rejected.
 | 
					// TestPullScratchNotAllowed verifies that pulling 'scratch' is rejected.
 | 
				
			||||||
func (s *DockerHubPullSuite) TestPullScratchNotAllowed(c *check.C) {
 | 
					func (s *DockerHubPullSuite) TestPullScratchNotAllowed(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, err := s.CmdWithError("pull", "scratch")
 | 
						out, err := s.CmdWithError("pull", "scratch")
 | 
				
			||||||
	c.Assert(err, checker.NotNil, check.Commentf("expected pull of scratch to fail"))
 | 
						c.Assert(err, checker.NotNil, check.Commentf("expected pull of scratch to fail"))
 | 
				
			||||||
	c.Assert(out, checker.Contains, "'scratch' is a reserved name")
 | 
						c.Assert(out, checker.Contains, "'scratch' is a reserved name")
 | 
				
			||||||
| 
						 | 
					@ -96,6 +100,7 @@ func (s *DockerHubPullSuite) TestPullScratchNotAllowed(c *check.C) {
 | 
				
			||||||
// TestPullAllTagsFromCentralRegistry pulls using `all-tags` for a given image and verifies that it
 | 
					// TestPullAllTagsFromCentralRegistry pulls using `all-tags` for a given image and verifies that it
 | 
				
			||||||
// results in more images than a naked pull.
 | 
					// results in more images than a naked pull.
 | 
				
			||||||
func (s *DockerHubPullSuite) TestPullAllTagsFromCentralRegistry(c *check.C) {
 | 
					func (s *DockerHubPullSuite) TestPullAllTagsFromCentralRegistry(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	s.Cmd(c, "pull", "busybox")
 | 
						s.Cmd(c, "pull", "busybox")
 | 
				
			||||||
	outImageCmd := s.Cmd(c, "images", "busybox")
 | 
						outImageCmd := s.Cmd(c, "images", "busybox")
 | 
				
			||||||
	splitOutImageCmd := strings.Split(strings.TrimSpace(outImageCmd), "\n")
 | 
						splitOutImageCmd := strings.Split(strings.TrimSpace(outImageCmd), "\n")
 | 
				
			||||||
| 
						 | 
					@ -126,6 +131,7 @@ func (s *DockerHubPullSuite) TestPullAllTagsFromCentralRegistry(c *check.C) {
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Ref: docker/docker#15589
 | 
					// Ref: docker/docker#15589
 | 
				
			||||||
func (s *DockerHubPullSuite) TestPullClientDisconnect(c *check.C) {
 | 
					func (s *DockerHubPullSuite) TestPullClientDisconnect(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	repoName := "hello-world:latest"
 | 
						repoName := "hello-world:latest"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pullCmd := s.MakeCmd("pull", repoName)
 | 
						pullCmd := s.MakeCmd("pull", repoName)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRenameStoppedContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestRenameStoppedContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "--name", "first_name", "-d", "busybox", "sh")
 | 
						out, _ := dockerCmd(c, "run", "--name", "first_name", "-d", "busybox", "sh")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -28,6 +29,7 @@ func (s *DockerSuite) TestRenameStoppedContainer(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRenameRunningContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestRenameRunningContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "--name", "first_name", "-d", "busybox", "sh")
 | 
						out, _ := dockerCmd(c, "run", "--name", "first_name", "-d", "busybox", "sh")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	newName := "new_name" + stringid.GenerateNonCryptoID()
 | 
						newName := "new_name" + stringid.GenerateNonCryptoID()
 | 
				
			||||||
| 
						 | 
					@ -44,6 +46,7 @@ func (s *DockerSuite) TestRenameRunningContainer(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRenameCheckNames(c *check.C) {
 | 
					func (s *DockerSuite) TestRenameCheckNames(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "--name", "first_name", "-d", "busybox", "sh")
 | 
						dockerCmd(c, "run", "--name", "first_name", "-d", "busybox", "sh")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	newName := "new_name" + stringid.GenerateNonCryptoID()
 | 
						newName := "new_name" + stringid.GenerateNonCryptoID()
 | 
				
			||||||
| 
						 | 
					@ -64,6 +67,7 @@ func (s *DockerSuite) TestRenameCheckNames(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRenameInvalidName(c *check.C) {
 | 
					func (s *DockerSuite) TestRenameInvalidName(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "--name", "myname", "-d", "busybox", "top")
 | 
						dockerCmd(c, "run", "--name", "myname", "-d", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if out, _, err := dockerCmdWithError("rename", "myname", "new:invalid"); err == nil || !strings.Contains(out, "Invalid container name") {
 | 
						if out, _, err := dockerCmdWithError("rename", "myname", "new:invalid"); err == nil || !strings.Contains(out, "Invalid container name") {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,6 +7,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRestartStoppedContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestRestartStoppedContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", "foobar")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "echo", "foobar")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -26,6 +27,7 @@ func (s *DockerSuite) TestRestartStoppedContainer(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRestartRunningContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestRestartRunningContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", "echo foobar && sleep 30 && echo 'should not print this'")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", "echo foobar && sleep 30 && echo 'should not print this'")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -50,6 +52,7 @@ func (s *DockerSuite) TestRestartRunningContainer(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Test that restarting a container with a volume does not create a new volume on restart. Regression test for #819.
 | 
					// Test that restarting a container with a volume does not create a new volume on restart. Regression test for #819.
 | 
				
			||||||
func (s *DockerSuite) TestRestartWithVolumes(c *check.C) {
 | 
					func (s *DockerSuite) TestRestartWithVolumes(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "-v", "/test", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "-v", "/test", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -78,6 +81,7 @@ func (s *DockerSuite) TestRestartWithVolumes(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRestartPolicyNO(c *check.C) {
 | 
					func (s *DockerSuite) TestRestartPolicyNO(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "--restart=no", "busybox", "false")
 | 
						out, _ := dockerCmd(c, "run", "-d", "--restart=no", "busybox", "false")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	id := strings.TrimSpace(string(out))
 | 
						id := strings.TrimSpace(string(out))
 | 
				
			||||||
| 
						 | 
					@ -89,6 +93,7 @@ func (s *DockerSuite) TestRestartPolicyNO(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRestartPolicyAlways(c *check.C) {
 | 
					func (s *DockerSuite) TestRestartPolicyAlways(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "--restart=always", "busybox", "false")
 | 
						out, _ := dockerCmd(c, "run", "-d", "--restart=always", "busybox", "false")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	id := strings.TrimSpace(string(out))
 | 
						id := strings.TrimSpace(string(out))
 | 
				
			||||||
| 
						 | 
					@ -108,6 +113,7 @@ func (s *DockerSuite) TestRestartPolicyAlways(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRestartPolicyOnFailure(c *check.C) {
 | 
					func (s *DockerSuite) TestRestartPolicyOnFailure(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:1", "busybox", "false")
 | 
						out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:1", "busybox", "false")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	id := strings.TrimSpace(string(out))
 | 
						id := strings.TrimSpace(string(out))
 | 
				
			||||||
| 
						 | 
					@ -122,6 +128,7 @@ func (s *DockerSuite) TestRestartPolicyOnFailure(c *check.C) {
 | 
				
			||||||
// a good container with --restart=on-failure:3
 | 
					// a good container with --restart=on-failure:3
 | 
				
			||||||
// MaximumRetryCount!=0; RestartCount=0
 | 
					// MaximumRetryCount!=0; RestartCount=0
 | 
				
			||||||
func (s *DockerSuite) TestContainerRestartwithGoodContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestContainerRestartwithGoodContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "true")
 | 
						out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "true")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	id := strings.TrimSpace(string(out))
 | 
						id := strings.TrimSpace(string(out))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRmContainerWithRemovedVolume(c *check.C) {
 | 
					func (s *DockerSuite) TestRmContainerWithRemovedVolume(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	testRequires(c, SameHostDaemon)
 | 
						testRequires(c, SameHostDaemon)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dockerCmd(c, "run", "--name", "losemyvolumes", "-v", "/tmp/testing:/test", "busybox", "true")
 | 
						dockerCmd(c, "run", "--name", "losemyvolumes", "-v", "/tmp/testing:/test", "busybox", "true")
 | 
				
			||||||
| 
						 | 
					@ -20,12 +21,14 @@ func (s *DockerSuite) TestRmContainerWithRemovedVolume(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRmContainerWithVolume(c *check.C) {
 | 
					func (s *DockerSuite) TestRmContainerWithVolume(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "--name", "foo", "-v", "/srv", "busybox", "true")
 | 
						dockerCmd(c, "run", "--name", "foo", "-v", "/srv", "busybox", "true")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dockerCmd(c, "rm", "-v", "foo")
 | 
						dockerCmd(c, "rm", "-v", "foo")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRmRunningContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestRmRunningContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	createRunningContainer(c, "foo")
 | 
						createRunningContainer(c, "foo")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if _, _, err := dockerCmdWithError("rm", "foo"); err == nil {
 | 
						if _, _, err := dockerCmdWithError("rm", "foo"); err == nil {
 | 
				
			||||||
| 
						 | 
					@ -34,6 +37,7 @@ func (s *DockerSuite) TestRmRunningContainer(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRmForceRemoveRunningContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestRmForceRemoveRunningContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	createRunningContainer(c, "foo")
 | 
						createRunningContainer(c, "foo")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Stop then remove with -s
 | 
						// Stop then remove with -s
 | 
				
			||||||
| 
						 | 
					@ -41,7 +45,7 @@ func (s *DockerSuite) TestRmForceRemoveRunningContainer(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRmContainerOrphaning(c *check.C) {
 | 
					func (s *DockerSuite) TestRmContainerOrphaning(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerfile1 := `FROM busybox:latest
 | 
						dockerfile1 := `FROM busybox:latest
 | 
				
			||||||
	ENTRYPOINT ["/bin/true"]`
 | 
						ENTRYPOINT ["/bin/true"]`
 | 
				
			||||||
	img := "test-container-orphaning"
 | 
						img := "test-container-orphaning"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,6 +9,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRmiWithContainerFails(c *check.C) {
 | 
					func (s *DockerSuite) TestRmiWithContainerFails(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	errSubstr := "is using it"
 | 
						errSubstr := "is using it"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// create a container
 | 
						// create a container
 | 
				
			||||||
| 
						 | 
					@ -36,6 +37,7 @@ func (s *DockerSuite) TestRmiWithContainerFails(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRmiTag(c *check.C) {
 | 
					func (s *DockerSuite) TestRmiTag(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	imagesBefore, _ := dockerCmd(c, "images", "-a")
 | 
						imagesBefore, _ := dockerCmd(c, "images", "-a")
 | 
				
			||||||
	dockerCmd(c, "tag", "busybox", "utest:tag1")
 | 
						dockerCmd(c, "tag", "busybox", "utest:tag1")
 | 
				
			||||||
	dockerCmd(c, "tag", "busybox", "utest/docker:tag2")
 | 
						dockerCmd(c, "tag", "busybox", "utest/docker:tag2")
 | 
				
			||||||
| 
						 | 
					@ -73,6 +75,7 @@ func (s *DockerSuite) TestRmiTag(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) {
 | 
					func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _, err := dockerCmdWithError("run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-one'")
 | 
						out, _, err := dockerCmdWithError("run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-one'")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		c.Fatalf("failed to create a container:%s, %v", out, err)
 | 
							c.Fatalf("failed to create a container:%s, %v", out, err)
 | 
				
			||||||
| 
						 | 
					@ -121,6 +124,7 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRmiImgIDForce(c *check.C) {
 | 
					func (s *DockerSuite) TestRmiImgIDForce(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _, err := dockerCmdWithError("run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-test'")
 | 
						out, _, err := dockerCmdWithError("run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-test'")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		c.Fatalf("failed to create a container:%s, %v", out, err)
 | 
							c.Fatalf("failed to create a container:%s, %v", out, err)
 | 
				
			||||||
| 
						 | 
					@ -163,6 +167,7 @@ func (s *DockerSuite) TestRmiImgIDForce(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// See https://github.com/docker/docker/issues/14116
 | 
					// See https://github.com/docker/docker/issues/14116
 | 
				
			||||||
func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c *check.C) {
 | 
					func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerfile := "FROM busybox\nRUN echo test 14116\n"
 | 
						dockerfile := "FROM busybox\nRUN echo test 14116\n"
 | 
				
			||||||
	imgID, err := buildImage("test-14116", dockerfile, false)
 | 
						imgID, err := buildImage("test-14116", dockerfile, false)
 | 
				
			||||||
	c.Assert(err, check.IsNil)
 | 
						c.Assert(err, check.IsNil)
 | 
				
			||||||
| 
						 | 
					@ -179,6 +184,7 @@ func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRmiTagWithExistingContainers(c *check.C) {
 | 
					func (s *DockerSuite) TestRmiTagWithExistingContainers(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	container := "test-delete-tag"
 | 
						container := "test-delete-tag"
 | 
				
			||||||
	newtag := "busybox:newtag"
 | 
						newtag := "busybox:newtag"
 | 
				
			||||||
	bb := "busybox:latest"
 | 
						bb := "busybox:latest"
 | 
				
			||||||
| 
						 | 
					@ -198,6 +204,7 @@ func (s *DockerSuite) TestRmiTagWithExistingContainers(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRmiForceWithExistingContainers(c *check.C) {
 | 
					func (s *DockerSuite) TestRmiForceWithExistingContainers(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	image := "busybox-clone"
 | 
						image := "busybox-clone"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cmd := exec.Command(dockerBinary, "build", "--no-cache", "-t", image, "-")
 | 
						cmd := exec.Command(dockerBinary, "build", "--no-cache", "-t", image, "-")
 | 
				
			||||||
| 
						 | 
					@ -218,6 +225,7 @@ MAINTAINER foo`)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRmiWithMultipleRepositories(c *check.C) {
 | 
					func (s *DockerSuite) TestRmiWithMultipleRepositories(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	newRepo := "127.0.0.1:5000/busybox"
 | 
						newRepo := "127.0.0.1:5000/busybox"
 | 
				
			||||||
	oldRepo := "busybox"
 | 
						oldRepo := "busybox"
 | 
				
			||||||
	newTag := "busybox:test"
 | 
						newTag := "busybox:test"
 | 
				
			||||||
| 
						 | 
					@ -246,6 +254,7 @@ func (s *DockerSuite) TestRmiWithMultipleRepositories(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRmiBlank(c *check.C) {
 | 
					func (s *DockerSuite) TestRmiBlank(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// try to delete a blank image name
 | 
						// try to delete a blank image name
 | 
				
			||||||
	out, _, err := dockerCmdWithError("rmi", "")
 | 
						out, _, err := dockerCmdWithError("rmi", "")
 | 
				
			||||||
	if err == nil {
 | 
						if err == nil {
 | 
				
			||||||
| 
						 | 
					@ -268,6 +277,7 @@ func (s *DockerSuite) TestRmiBlank(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestRmiContainerImageNotFound(c *check.C) {
 | 
					func (s *DockerSuite) TestRmiContainerImageNotFound(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// Build 2 images for testing.
 | 
						// Build 2 images for testing.
 | 
				
			||||||
	imageNames := []string{"test1", "test2"}
 | 
						imageNames := []string{"test1", "test2"}
 | 
				
			||||||
	imageIds := make([]string, 2)
 | 
						imageIds := make([]string, 2)
 | 
				
			||||||
| 
						 | 
					@ -295,6 +305,7 @@ func (s *DockerSuite) TestRmiContainerImageNotFound(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// #13422
 | 
					// #13422
 | 
				
			||||||
func (s *DockerSuite) TestRmiUntagHistoryLayer(c *check.C) {
 | 
					func (s *DockerSuite) TestRmiUntagHistoryLayer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	image := "tmp1"
 | 
						image := "tmp1"
 | 
				
			||||||
	// Build a image for testing.
 | 
						// Build a image for testing.
 | 
				
			||||||
	dockerfile := `FROM busybox
 | 
						dockerfile := `FROM busybox
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
					@ -15,6 +15,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// save a repo using gz compression and try to load it using stdout
 | 
					// save a repo using gz compression and try to load it using stdout
 | 
				
			||||||
func (s *DockerSuite) TestSaveXzAndLoadRepoStdout(c *check.C) {
 | 
					func (s *DockerSuite) TestSaveXzAndLoadRepoStdout(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-save-xz-and-load-repo-stdout"
 | 
						name := "test-save-xz-and-load-repo-stdout"
 | 
				
			||||||
	dockerCmd(c, "run", "--name", name, "busybox", "true")
 | 
						dockerCmd(c, "run", "--name", name, "busybox", "true")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,6 +48,7 @@ func (s *DockerSuite) TestSaveXzAndLoadRepoStdout(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// save a repo using xz+gz compression and try to load it using stdout
 | 
					// save a repo using xz+gz compression and try to load it using stdout
 | 
				
			||||||
func (s *DockerSuite) TestSaveXzGzAndLoadRepoStdout(c *check.C) {
 | 
					func (s *DockerSuite) TestSaveXzGzAndLoadRepoStdout(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-save-xz-gz-and-load-repo-stdout"
 | 
						name := "test-save-xz-gz-and-load-repo-stdout"
 | 
				
			||||||
	dockerCmd(c, "run", "--name", name, "busybox", "true")
 | 
						dockerCmd(c, "run", "--name", name, "busybox", "true")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -79,6 +81,7 @@ func (s *DockerSuite) TestSaveXzGzAndLoadRepoStdout(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestSaveSingleTag(c *check.C) {
 | 
					func (s *DockerSuite) TestSaveSingleTag(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	repoName := "foobar-save-single-tag-test"
 | 
						repoName := "foobar-save-single-tag-test"
 | 
				
			||||||
	dockerCmd(c, "tag", "busybox:latest", fmt.Sprintf("%v:latest", repoName))
 | 
						dockerCmd(c, "tag", "busybox:latest", fmt.Sprintf("%v:latest", repoName))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -95,6 +98,7 @@ func (s *DockerSuite) TestSaveSingleTag(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestSaveImageId(c *check.C) {
 | 
					func (s *DockerSuite) TestSaveImageId(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	repoName := "foobar-save-image-id-test"
 | 
						repoName := "foobar-save-image-id-test"
 | 
				
			||||||
	dockerCmd(c, "tag", "emptyfs:latest", fmt.Sprintf("%v:latest", repoName))
 | 
						dockerCmd(c, "tag", "emptyfs:latest", fmt.Sprintf("%v:latest", repoName))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -136,6 +140,7 @@ func (s *DockerSuite) TestSaveImageId(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// save a repo and try to load it using flags
 | 
					// save a repo and try to load it using flags
 | 
				
			||||||
func (s *DockerSuite) TestSaveAndLoadRepoFlags(c *check.C) {
 | 
					func (s *DockerSuite) TestSaveAndLoadRepoFlags(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "test-save-and-load-repo-flags"
 | 
						name := "test-save-and-load-repo-flags"
 | 
				
			||||||
	dockerCmd(c, "run", "--name", name, "busybox", "true")
 | 
						dockerCmd(c, "run", "--name", name, "busybox", "true")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -160,6 +165,7 @@ func (s *DockerSuite) TestSaveAndLoadRepoFlags(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestSaveMultipleNames(c *check.C) {
 | 
					func (s *DockerSuite) TestSaveMultipleNames(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	repoName := "foobar-save-multi-name-test"
 | 
						repoName := "foobar-save-multi-name-test"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Make one image
 | 
						// Make one image
 | 
				
			||||||
| 
						 | 
					@ -179,7 +185,7 @@ func (s *DockerSuite) TestSaveMultipleNames(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestSaveRepoWithMultipleImages(c *check.C) {
 | 
					func (s *DockerSuite) TestSaveRepoWithMultipleImages(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	makeImage := func(from string, tag string) string {
 | 
						makeImage := func(from string, tag string) string {
 | 
				
			||||||
		var (
 | 
							var (
 | 
				
			||||||
			out string
 | 
								out string
 | 
				
			||||||
| 
						 | 
					@ -225,6 +231,7 @@ func (s *DockerSuite) TestSaveRepoWithMultipleImages(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Issue #6722 #5892 ensure directories are included in changes
 | 
					// Issue #6722 #5892 ensure directories are included in changes
 | 
				
			||||||
func (s *DockerSuite) TestSaveDirectoryPermissions(c *check.C) {
 | 
					func (s *DockerSuite) TestSaveDirectoryPermissions(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	layerEntries := []string{"opt/", "opt/a/", "opt/a/b/", "opt/a/b/c"}
 | 
						layerEntries := []string{"opt/", "opt/a/", "opt/a/b/", "opt/a/b/c"}
 | 
				
			||||||
	layerEntriesAUFS := []string{"./", ".wh..wh.aufs", ".wh..wh.orph/", ".wh..wh.plnk/", "opt/", "opt/a/", "opt/a/b/", "opt/a/b/c"}
 | 
						layerEntriesAUFS := []string{"./", ".wh..wh.aufs", ".wh..wh.orph/", ".wh..wh.plnk/", "opt/", "opt/a/", "opt/a/b/", "opt/a/b/c"}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// search for repos named  "registry" on the central registry
 | 
					// search for repos named  "registry" on the central registry
 | 
				
			||||||
func (s *DockerSuite) TestSearchOnCentralRegistry(c *check.C) {
 | 
					func (s *DockerSuite) TestSearchOnCentralRegistry(c *check.C) {
 | 
				
			||||||
	testRequires(c, Network)
 | 
						testRequires(c, Network, DaemonIsLinux)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	out, exitCode := dockerCmd(c, "search", "busybox")
 | 
						out, exitCode := dockerCmd(c, "search", "busybox")
 | 
				
			||||||
	if exitCode != 0 {
 | 
						if exitCode != 0 {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,6 +10,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Regression test for https://github.com/docker/docker/issues/7843
 | 
					// Regression test for https://github.com/docker/docker/issues/7843
 | 
				
			||||||
func (s *DockerSuite) TestStartAttachReturnsOnError(c *check.C) {
 | 
					func (s *DockerSuite) TestStartAttachReturnsOnError(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "test", "busybox")
 | 
						dockerCmd(c, "run", "-d", "--name", "test", "busybox")
 | 
				
			||||||
	dockerCmd(c, "wait", "test")
 | 
						dockerCmd(c, "wait", "test")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,6 +39,7 @@ func (s *DockerSuite) TestStartAttachReturnsOnError(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// gh#8555: Exit code should be passed through when using start -a
 | 
					// gh#8555: Exit code should be passed through when using start -a
 | 
				
			||||||
func (s *DockerSuite) TestStartAttachCorrectExitCode(c *check.C) {
 | 
					func (s *DockerSuite) TestStartAttachCorrectExitCode(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _, _ := dockerCmdWithStdoutStderr(c, "run", "-d", "busybox", "sh", "-c", "sleep 2; exit 1")
 | 
						out, _, _ := dockerCmdWithStdoutStderr(c, "run", "-d", "busybox", "sh", "-c", "sleep 2; exit 1")
 | 
				
			||||||
	out = strings.TrimSpace(out)
 | 
						out = strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -55,6 +57,7 @@ func (s *DockerSuite) TestStartAttachCorrectExitCode(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestStartAttachSilent(c *check.C) {
 | 
					func (s *DockerSuite) TestStartAttachSilent(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	name := "teststartattachcorrectexitcode"
 | 
						name := "teststartattachcorrectexitcode"
 | 
				
			||||||
	dockerCmd(c, "run", "--name", name, "busybox", "echo", "test")
 | 
						dockerCmd(c, "run", "--name", name, "busybox", "echo", "test")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -68,7 +71,7 @@ func (s *DockerSuite) TestStartAttachSilent(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestStartRecordError(c *check.C) {
 | 
					func (s *DockerSuite) TestStartRecordError(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// when container runs successfully, we should not have state.Error
 | 
						// when container runs successfully, we should not have state.Error
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "-p", "9999:9999", "--name", "test", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "-p", "9999:9999", "--name", "test", "busybox", "top")
 | 
				
			||||||
	stateErr, err := inspectField("test", "State.Error")
 | 
						stateErr, err := inspectField("test", "State.Error")
 | 
				
			||||||
| 
						 | 
					@ -101,6 +104,7 @@ func (s *DockerSuite) TestStartRecordError(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestStartPausedContainer(c *check.C) {
 | 
					func (s *DockerSuite) TestStartPausedContainer(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	defer unpauseAllContainers()
 | 
						defer unpauseAllContainers()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "top")
 | 
				
			||||||
| 
						 | 
					@ -113,6 +117,7 @@ func (s *DockerSuite) TestStartPausedContainer(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestStartMultipleContainers(c *check.C) {
 | 
					func (s *DockerSuite) TestStartMultipleContainers(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// run a container named 'parent' and create two container link to `parent`
 | 
						// run a container named 'parent' and create two container link to `parent`
 | 
				
			||||||
	dockerCmd(c, "run", "-d", "--name", "parent", "busybox", "top")
 | 
						dockerCmd(c, "run", "-d", "--name", "parent", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -147,6 +152,7 @@ func (s *DockerSuite) TestStartMultipleContainers(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestStartAttachMultipleContainers(c *check.C) {
 | 
					func (s *DockerSuite) TestStartAttachMultipleContainers(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	// run  multiple containers to test
 | 
						// run  multiple containers to test
 | 
				
			||||||
	for _, container := range []string{"test1", "test2", "test3"} {
 | 
						for _, container := range []string{"test1", "test2", "test3"} {
 | 
				
			||||||
		dockerCmd(c, "run", "-d", "--name", container, "busybox", "top")
 | 
							dockerCmd(c, "run", "-d", "--name", container, "busybox", "top")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,6 +9,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestCliStatsNoStream(c *check.C) {
 | 
					func (s *DockerSuite) TestCliStatsNoStream(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
	c.Assert(waitRun(id), check.IsNil)
 | 
						c.Assert(waitRun(id), check.IsNil)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,6 +9,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// tagging a named image in a new unprefixed repo should work
 | 
					// tagging a named image in a new unprefixed repo should work
 | 
				
			||||||
func (s *DockerSuite) TestTagUnprefixedRepoByName(c *check.C) {
 | 
					func (s *DockerSuite) TestTagUnprefixedRepoByName(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	if err := pullImageIfNotExist("busybox:latest"); err != nil {
 | 
						if err := pullImageIfNotExist("busybox:latest"); err != nil {
 | 
				
			||||||
		c.Fatal("couldn't find the busybox:latest image locally and failed to pull it")
 | 
							c.Fatal("couldn't find the busybox:latest image locally and failed to pull it")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -18,6 +19,7 @@ func (s *DockerSuite) TestTagUnprefixedRepoByName(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// tagging an image by ID in a new unprefixed repo should work
 | 
					// tagging an image by ID in a new unprefixed repo should work
 | 
				
			||||||
func (s *DockerSuite) TestTagUnprefixedRepoByID(c *check.C) {
 | 
					func (s *DockerSuite) TestTagUnprefixedRepoByID(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	imageID, err := inspectField("busybox", "Id")
 | 
						imageID, err := inspectField("busybox", "Id")
 | 
				
			||||||
	c.Assert(err, check.IsNil)
 | 
						c.Assert(err, check.IsNil)
 | 
				
			||||||
	dockerCmd(c, "tag", imageID, "testfoobarbaz")
 | 
						dockerCmd(c, "tag", imageID, "testfoobarbaz")
 | 
				
			||||||
| 
						 | 
					@ -52,6 +54,7 @@ func (s *DockerSuite) TestTagInvalidPrefixedRepo(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ensure we allow the use of valid tags
 | 
					// ensure we allow the use of valid tags
 | 
				
			||||||
func (s *DockerSuite) TestTagValidPrefixedRepo(c *check.C) {
 | 
					func (s *DockerSuite) TestTagValidPrefixedRepo(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	if err := pullImageIfNotExist("busybox:latest"); err != nil {
 | 
						if err := pullImageIfNotExist("busybox:latest"); err != nil {
 | 
				
			||||||
		c.Fatal("couldn't find the busybox:latest image locally and failed to pull it")
 | 
							c.Fatal("couldn't find the busybox:latest image locally and failed to pull it")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -70,6 +73,7 @@ func (s *DockerSuite) TestTagValidPrefixedRepo(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// tag an image with an existed tag name without -f option should fail
 | 
					// tag an image with an existed tag name without -f option should fail
 | 
				
			||||||
func (s *DockerSuite) TestTagExistedNameWithoutForce(c *check.C) {
 | 
					func (s *DockerSuite) TestTagExistedNameWithoutForce(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	if err := pullImageIfNotExist("busybox:latest"); err != nil {
 | 
						if err := pullImageIfNotExist("busybox:latest"); err != nil {
 | 
				
			||||||
		c.Fatal("couldn't find the busybox:latest image locally and failed to pull it")
 | 
							c.Fatal("couldn't find the busybox:latest image locally and failed to pull it")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -83,6 +87,7 @@ func (s *DockerSuite) TestTagExistedNameWithoutForce(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// tag an image with an existed tag name with -f option should work
 | 
					// tag an image with an existed tag name with -f option should work
 | 
				
			||||||
func (s *DockerSuite) TestTagExistedNameWithForce(c *check.C) {
 | 
					func (s *DockerSuite) TestTagExistedNameWithForce(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	if err := pullImageIfNotExist("busybox:latest"); err != nil {
 | 
						if err := pullImageIfNotExist("busybox:latest"); err != nil {
 | 
				
			||||||
		c.Fatal("couldn't find the busybox:latest image locally and failed to pull it")
 | 
							c.Fatal("couldn't find the busybox:latest image locally and failed to pull it")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -92,6 +97,7 @@ func (s *DockerSuite) TestTagExistedNameWithForce(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestTagWithPrefixHyphen(c *check.C) {
 | 
					func (s *DockerSuite) TestTagWithPrefixHyphen(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	if err := pullImageIfNotExist("busybox:latest"); err != nil {
 | 
						if err := pullImageIfNotExist("busybox:latest"); err != nil {
 | 
				
			||||||
		c.Fatal("couldn't find the busybox:latest image locally and failed to pull it")
 | 
							c.Fatal("couldn't find the busybox:latest image locally and failed to pull it")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -115,6 +121,7 @@ func (s *DockerSuite) TestTagWithPrefixHyphen(c *check.C) {
 | 
				
			||||||
// ensure tagging using official names works
 | 
					// ensure tagging using official names works
 | 
				
			||||||
// ensure all tags result in the same name
 | 
					// ensure all tags result in the same name
 | 
				
			||||||
func (s *DockerSuite) TestTagOfficialNames(c *check.C) {
 | 
					func (s *DockerSuite) TestTagOfficialNames(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	names := []string{
 | 
						names := []string{
 | 
				
			||||||
		"docker.io/busybox",
 | 
							"docker.io/busybox",
 | 
				
			||||||
		"index.docker.io/busybox",
 | 
							"index.docker.io/busybox",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,6 +7,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestTopMultipleArgs(c *check.C) {
 | 
					func (s *DockerSuite) TestTopMultipleArgs(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-i", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-i", "-d", "busybox", "top")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
| 
						 | 
					@ -19,6 +20,7 @@ func (s *DockerSuite) TestTopMultipleArgs(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestTopNonPrivileged(c *check.C) {
 | 
					func (s *DockerSuite) TestTopNonPrivileged(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-i", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "-i", "-d", "busybox", "top")
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,6 +39,7 @@ func (s *DockerSuite) TestTopNonPrivileged(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestTopPrivileged(c *check.C) {
 | 
					func (s *DockerSuite) TestTopPrivileged(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "--privileged", "-i", "-d", "busybox", "top")
 | 
						out, _ := dockerCmd(c, "run", "--privileged", "-i", "-d", "busybox", "top")
 | 
				
			||||||
	cleanedContainerID := strings.TrimSpace(out)
 | 
						cleanedContainerID := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,7 @@ import (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestVolumeCliCreate(c *check.C) {
 | 
					func (s *DockerSuite) TestVolumeCliCreate(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	dockerCmd(c, "volume", "create")
 | 
						dockerCmd(c, "volume", "create")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_, err := runCommand(exec.Command(dockerBinary, "volume", "create", "-d", "nosuchdriver"))
 | 
						_, err := runCommand(exec.Command(dockerBinary, "volume", "create", "-d", "nosuchdriver"))
 | 
				
			||||||
| 
						 | 
					@ -19,6 +20,7 @@ func (s *DockerSuite) TestVolumeCliCreate(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestVolumeCliInspect(c *check.C) {
 | 
					func (s *DockerSuite) TestVolumeCliInspect(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	c.Assert(
 | 
						c.Assert(
 | 
				
			||||||
		exec.Command(dockerBinary, "volume", "inspect", "doesntexist").Run(),
 | 
							exec.Command(dockerBinary, "volume", "inspect", "doesntexist").Run(),
 | 
				
			||||||
		check.Not(check.IsNil),
 | 
							check.Not(check.IsNil),
 | 
				
			||||||
| 
						 | 
					@ -36,6 +38,7 @@ func (s *DockerSuite) TestVolumeCliInspect(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestVolumeCliLs(c *check.C) {
 | 
					func (s *DockerSuite) TestVolumeCliLs(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "volume", "create")
 | 
						out, _ := dockerCmd(c, "volume", "create")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,6 +55,7 @@ func (s *DockerSuite) TestVolumeCliLs(c *check.C) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *DockerSuite) TestVolumeCliRm(c *check.C) {
 | 
					func (s *DockerSuite) TestVolumeCliRm(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "volume", "create")
 | 
						out, _ := dockerCmd(c, "volume", "create")
 | 
				
			||||||
	id := strings.TrimSpace(out)
 | 
						id := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// non-blocking wait with 0 exit code
 | 
					// non-blocking wait with 0 exit code
 | 
				
			||||||
func (s *DockerSuite) TestWaitNonBlockedExitZero(c *check.C) {
 | 
					func (s *DockerSuite) TestWaitNonBlockedExitZero(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", "true")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", "true")
 | 
				
			||||||
	containerID := strings.TrimSpace(out)
 | 
						containerID := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,6 +28,7 @@ func (s *DockerSuite) TestWaitNonBlockedExitZero(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// blocking wait with 0 exit code
 | 
					// blocking wait with 0 exit code
 | 
				
			||||||
func (s *DockerSuite) TestWaitBlockedExitZero(c *check.C) {
 | 
					func (s *DockerSuite) TestWaitBlockedExitZero(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "trap 'exit 0' TERM; while true; do sleep 0.01; done")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "trap 'exit 0' TERM; while true; do sleep 0.01; done")
 | 
				
			||||||
	containerID := strings.TrimSpace(out)
 | 
						containerID := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,6 +56,7 @@ func (s *DockerSuite) TestWaitBlockedExitZero(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// non-blocking wait with random exit code
 | 
					// non-blocking wait with random exit code
 | 
				
			||||||
func (s *DockerSuite) TestWaitNonBlockedExitRandom(c *check.C) {
 | 
					func (s *DockerSuite) TestWaitNonBlockedExitRandom(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", "exit 99")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "sh", "-c", "exit 99")
 | 
				
			||||||
	containerID := strings.TrimSpace(out)
 | 
						containerID := strings.TrimSpace(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -70,6 +73,7 @@ func (s *DockerSuite) TestWaitNonBlockedExitRandom(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// blocking wait with random exit code
 | 
					// blocking wait with random exit code
 | 
				
			||||||
func (s *DockerSuite) TestWaitBlockedExitRandom(c *check.C) {
 | 
					func (s *DockerSuite) TestWaitBlockedExitRandom(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "trap 'exit 99' TERM; while true; do sleep 0.01; done")
 | 
						out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "trap 'exit 99' TERM; while true; do sleep 0.01; done")
 | 
				
			||||||
	containerID := strings.TrimSpace(out)
 | 
						containerID := strings.TrimSpace(out)
 | 
				
			||||||
	c.Assert(waitRun(containerID), check.IsNil)
 | 
						c.Assert(waitRun(containerID), check.IsNil)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,6 +37,7 @@ func newDockerHubPullSuite() *DockerHubPullSuite {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// SetUpSuite starts the suite daemon.
 | 
					// SetUpSuite starts the suite daemon.
 | 
				
			||||||
func (s *DockerHubPullSuite) SetUpSuite(c *check.C) {
 | 
					func (s *DockerHubPullSuite) SetUpSuite(c *check.C) {
 | 
				
			||||||
 | 
						testRequires(c, DaemonIsLinux)
 | 
				
			||||||
	s.d = NewDaemon(c)
 | 
						s.d = NewDaemon(c)
 | 
				
			||||||
	if err := s.d.Start(); err != nil {
 | 
						if err := s.d.Start(); err != nil {
 | 
				
			||||||
		c.Fatalf("starting push/pull test daemon: %v", err)
 | 
							c.Fatalf("starting push/pull test daemon: %v", err)
 | 
				
			||||||
| 
						 | 
					@ -45,8 +46,10 @@ func (s *DockerHubPullSuite) SetUpSuite(c *check.C) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TearDownSuite stops the suite daemon.
 | 
					// TearDownSuite stops the suite daemon.
 | 
				
			||||||
func (s *DockerHubPullSuite) TearDownSuite(c *check.C) {
 | 
					func (s *DockerHubPullSuite) TearDownSuite(c *check.C) {
 | 
				
			||||||
	if err := s.d.Stop(); err != nil {
 | 
						if s.d != nil {
 | 
				
			||||||
		c.Fatalf("stopping push/pull test daemon: %v", err)
 | 
							if err := s.d.Stop(); err != nil {
 | 
				
			||||||
 | 
								c.Fatalf("stopping push/pull test daemon: %v", err)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue