Browse code

Update Dockerfile to use the correct busybox:latest identifier

Also requires some tests to be updated which relied on behavior
of a busybox image that wasn't actually "busybox:latest"; meaning these
tests were unable to be verified/run against a real busybox:latest image
on a daemon.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)

Phil Estes authored on 2015/10/14 01:39:05
Showing 4 changed files
... ...
@@ -182,7 +182,7 @@ RUN ln -sv $PWD/contrib/completion/bash/docker /etc/bash_completion.d/docker
182 182
 # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
183 183
 COPY contrib/download-frozen-image.sh /go/src/github.com/docker/docker/contrib/
184 184
 RUN ./contrib/download-frozen-image.sh /docker-frozen-images \
185
-	busybox:latest@8c2e06607696bd4afb3d03b687e361cc43cf8ec1a4a725bc96e39f05ba97dd55 \
185
+	busybox:latest@d7057cb020844f245031d27b76cb18af05db1cc3a96a29fa7777af75f5ac91a3 \
186 186
 	hello-world:frozen@91c95931e552b11604fea91c2f537284149ec32fff0f700a4769cfd31d7696ae \
187 187
 	jess/unshare@5c9f6ea50341a2a8eb6677527f2bdedbf331ae894a41714fda770fb130f3314d
188 188
 # see also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
... ...
@@ -797,7 +797,7 @@ func (s *DockerSuite) TestCopyAndRestart(c *check.C) {
797 797
 	}
798 798
 	defer os.RemoveAll(tmpDir)
799 799
 
800
-	dockerCmd(c, "cp", fmt.Sprintf("%s:/etc/issue", id), tmpDir)
800
+	dockerCmd(c, "cp", fmt.Sprintf("%s:/etc/group", id), tmpDir)
801 801
 
802 802
 	out, _ = dockerCmd(c, "start", "-a", id)
803 803
 
... ...
@@ -1495,13 +1495,16 @@ func (s *DockerDaemonSuite) TestRunContainerWithBridgeNone(c *check.C) {
1495 1495
 	c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
1496 1496
 	c.Assert(strings.Contains(out, "eth0"), check.Equals, false,
1497 1497
 		check.Commentf("There shouldn't be eth0 in container in bridge mode when bridge network is disabled: %s", out))
1498
-	cmd := exec.Command("ip", "l")
1498
+	// the extra grep and awk clean up the output of `ip` to only list the number and name of
1499
+	// interfaces, allowing for different versions of ip (e.g. inside and outside the container) to
1500
+	// be used while still verifying that the interface list is the exact same
1501
+	cmd := exec.Command("sh", "-c", "ip l | grep -E '^[0-9]+:' | awk -F: ' { print $1\":\"$2 } '")
1499 1502
 	stdout := bytes.NewBuffer(nil)
1500 1503
 	cmd.Stdout = stdout
1501 1504
 	if err := cmd.Run(); err != nil {
1502 1505
 		c.Fatal("Failed to get host network interface")
1503 1506
 	}
1504
-	out, err = s.d.Cmd("run", "--rm", "--net=host", "busybox", "ip", "l")
1507
+	out, err = s.d.Cmd("run", "--rm", "--net=host", "busybox", "sh", "-c", "ip l | grep -E '^[0-9]+:' | awk -F: ' { print $1\":\"$2 } '")
1505 1508
 	c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
1506 1509
 	c.Assert(out, check.Equals, fmt.Sprintf("%s", stdout),
1507 1510
 		check.Commentf("The network interfaces in container should be the same with host when --net=host when bridge network is disabled: %s", out))
... ...
@@ -851,9 +851,9 @@ func (s *DockerSuite) TestRunCapAddALLDropNetAdminCanDownInterface(c *check.C) {
851 851
 func (s *DockerSuite) TestRunGroupAdd(c *check.C) {
852 852
 	// Not applicable for Windows as there is no concept of --group-add
853 853
 	testRequires(c, DaemonIsLinux, NativeExecDriver)
854
-	out, _ := dockerCmd(c, "run", "--group-add=audio", "--group-add=dbus", "--group-add=777", "busybox", "sh", "-c", "id")
854
+	out, _ := dockerCmd(c, "run", "--group-add=audio", "--group-add=staff", "--group-add=777", "busybox", "sh", "-c", "id")
855 855
 
856
-	groupsList := "uid=0(root) gid=0(root) groups=10(wheel),29(audio),81(dbus),777"
856
+	groupsList := "uid=0(root) gid=0(root) groups=10(wheel),29(audio),50(staff),777"
857 857
 	if actual := strings.Trim(out, "\r\n"); actual != groupsList {
858 858
 		c.Fatalf("expected output %s received %s", groupsList, actual)
859 859
 	}
... ...
@@ -1168,13 +1168,13 @@ func (s *DockerSuite) TestRunDnsOptionsBasedOnHostResolvConf(c *check.C) {
1168 1168
 	}
1169 1169
 }
1170 1170
 
1171
-// Test to see if a non-root user can resolve a DNS name and reach out to it. Also
1171
+// Test to see if a non-root user can resolve a DNS name. Also
1172 1172
 // check if the container resolv.conf file has at least 0644 perm.
1173 1173
 func (s *DockerSuite) TestRunNonRootUserResolvName(c *check.C) {
1174 1174
 	// Not applicable on Windows as Windows does not support --user
1175 1175
 	testRequires(c, SameHostDaemon, Network, DaemonIsLinux)
1176 1176
 
1177
-	dockerCmd(c, "run", "--name=testperm", "--user=default", "busybox", "ping", "-c", "1", "apt.dockerproject.org")
1177
+	dockerCmd(c, "run", "--name=testperm", "--user=nobody", "busybox", "nslookup", "apt.dockerproject.org")
1178 1178
 
1179 1179
 	cID, err := getIDByName("testperm")
1180 1180
 	if err != nil {