Browse code

Merge pull request #34550 from kolyshkin/libeudev

Update Dockerfiles to use Debian Stretch

Yong Tang authored on 2017/09/19 13:03:31
Showing 14 changed files
... ...
@@ -23,7 +23,7 @@
23 23
 # the case. Therefore, you don't have to disable it anymore.
24 24
 #
25 25
 
26
-FROM debian:jessie
26
+FROM debian:stretch
27 27
 
28 28
 # allow replacing httpredir or deb mirror
29 29
 ARG APT_MIRROR=deb.debian.org
... ...
@@ -51,21 +51,28 @@ RUN apt-get update && apt-get install -y \
51 51
 	less \
52 52
 	libapparmor-dev \
53 53
 	libcap-dev \
54
+	libdevmapper-dev \
54 55
 	libnl-3-dev \
55 56
 	libprotobuf-c0-dev \
56 57
 	libprotobuf-dev \
57
-	libsystemd-journal-dev \
58
+	libsystemd-dev \
58 59
 	libtool \
60
+	libudev-dev \
59 61
 	mercurial \
60 62
 	net-tools \
61 63
 	pkg-config \
62 64
 	protobuf-compiler \
63 65
 	protobuf-c-compiler \
66
+	python-backports.ssl-match-hostname \
64 67
 	python-dev \
65 68
 	python-mock \
66 69
 	python-pip \
70
+	python-requests \
71
+	python-setuptools \
67 72
 	python-websocket \
73
+	python-wheel \
68 74
 	tar \
75
+	thin-provisioning-tools \
69 76
 	vim \
70 77
 	vim-common \
71 78
 	xfsprogs \
... ...
@@ -73,21 +80,6 @@ RUN apt-get update && apt-get install -y \
73 73
 	--no-install-recommends \
74 74
 	&& pip install awscli==1.10.15
75 75
 
76
-# Get lvm2 sources to build statically linked devmapper library
77
-ENV LVM2_VERSION 2.02.168
78
-RUN mkdir -p /usr/local/lvm2 \
79
-	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
80
-		| tar -xzC /usr/local/lvm2 --strip-components=1
81
-
82
-# Compile and install (only the needed library)
83
-RUN cd /usr/local/lvm2 \
84
-	&& ./configure \
85
-		--build="$(gcc -print-multiarch)" \
86
-		--enable-static_link \
87
-		--enable-pkgconfig \
88
-	&& make -C include \
89
-	&& make -C libdm install_device-mapper
90
-
91 76
 # Install seccomp: the version shipped upstream is too old
92 77
 ENV SECCOMP_VERSION 2.3.2
93 78
 RUN set -x \
... ...
@@ -157,9 +149,6 @@ RUN set -x \
157 157
 # Get the "docker-py" source so we can run their integration tests
158 158
 ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
159 159
 # To run integration tests docker-pycreds is required.
160
-# Before running the integration tests conftest.py is
161
-# loaded which results in loads auth.py that
162
-# imports the docker-pycreds module.
163 160
 RUN git clone https://github.com/docker/docker-py.git /docker-py \
164 161
 	&& cd /docker-py \
165 162
 	&& git checkout -q $DOCKER_PY_COMMIT \
... ...
@@ -15,14 +15,20 @@
15 15
 # the case. Therefore, you don't have to disable it anymore.
16 16
 #
17 17
 
18
-FROM aarch64/ubuntu:xenial
18
+FROM arm64v8/debian:stretch
19
+
20
+# allow replacing httpredir or deb mirror
21
+ARG APT_MIRROR=deb.debian.org
22
+RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list
19 23
 
20 24
 # Packaged dependencies
21 25
 RUN apt-get update && apt-get install -y \
22 26
 	apparmor \
27
+	apt-utils \
23 28
 	aufs-tools \
24 29
 	automake \
25 30
 	bash-completion \
31
+	bsdmainutils \
26 32
 	btrfs-tools \
27 33
 	build-essential \
28 34
 	cmake \
... ...
@@ -32,43 +38,40 @@ RUN apt-get update && apt-get install -y \
32 32
 	g++ \
33 33
 	gcc \
34 34
 	git \
35
+	golang \
35 36
 	iptables \
36 37
 	jq \
38
+	less \
37 39
 	libapparmor-dev \
38
-	libc6-dev \
39 40
 	libcap-dev \
41
+	libdevmapper-dev \
42
+	libnl-3-dev \
43
+	libprotobuf-c0-dev \
44
+	libprotobuf-dev \
40 45
 	libsystemd-dev \
41
-	libyaml-dev \
46
+	libtool \
47
+	libudev-dev \
42 48
 	mercurial \
43 49
 	net-tools \
44
-	parallel \
45 50
 	pkg-config \
51
+	protobuf-compiler \
52
+	protobuf-c-compiler \
53
+	python-backports.ssl-match-hostname \
46 54
 	python-dev \
47 55
 	python-mock \
48 56
 	python-pip \
57
+	python-requests \
49 58
 	python-setuptools \
50 59
 	python-websocket \
51
-	golang-go \
52
-	iproute2 \
53
-	iputils-ping \
60
+	python-wheel \
61
+	tar \
62
+	thin-provisioning-tools \
63
+	vim \
54 64
 	vim-common \
65
+	xfsprogs \
66
+	zip \
55 67
 	--no-install-recommends
56 68
 
57
-# Get lvm2 sources to build statically linked devmapper library
58
-ENV LVM2_VERSION 2.02.168
59
-RUN mkdir -p /usr/local/lvm2 \
60
-	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
61
-		| tar -xzC /usr/local/lvm2 --strip-components=1
62
-
63
-# Compile and install (only the needed library)
64
-RUN cd /usr/local/lvm2 \
65
-	&& ./configure \
66
-		--build="$(gcc -print-multiarch)" \
67
-		--enable-static_link \
68
-		--enable-pkgconfig \
69
-	&& make -C include \
70
-	&& make -C libdm install_device-mapper
71
-
72 69
 # Install seccomp: the version shipped upstream is too old
73 70
 ENV SECCOMP_VERSION 2.3.2
74 71
 RUN set -x \
... ...
@@ -86,9 +89,7 @@ RUN set -x \
86 86
 
87 87
 # Install Go
88 88
 # We don't have official binary golang 1.7.5 tarballs for ARM64, either for Go or
89
-# bootstrap, so we use golang-go (1.6) as bootstrap to build Go from source code.
90
-# We don't use the official ARMv6 released binaries as a GOROOT_BOOTSTRAP, because
91
-# not all ARM64 platforms support 32-bit mode. 32-bit mode is optional for ARMv8.
89
+# bootstrap, so we use Debian golang (1.7) as bootstrap to build Go from source code.
92 90
 # IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored
93 91
 ENV GO_VERSION 1.8.3
94 92
 RUN mkdir /usr/src/go && curl -fsSL https://golang.org/dl/go${GO_VERSION}.src.tar.gz | tar -v -C /usr/src/go -xz --strip-components=1 \
... ...
@@ -124,13 +125,10 @@ RUN set -x \
124 124
 
125 125
 # Get the "docker-py" source so we can run their integration tests
126 126
 ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
127
-# Before running the integration tests conftest.py is
128
-# loaded which results in loads auth.py that
129
-# imports the docker-pycreds module.
127
+# To run integration tests docker-pycreds is required.
130 128
 RUN git clone https://github.com/docker/docker-py.git /docker-py \
131 129
 	&& cd /docker-py \
132 130
 	&& git checkout -q $DOCKER_PY_COMMIT \
133
-	&& pip install wheel \
134 131
 	&& pip install docker-pycreds==0.2.1 \
135 132
 	&& pip install -r test-requirements.txt
136 133
 
... ...
@@ -15,7 +15,7 @@
15 15
 # the case. Therefore, you don't have to disable it anymore.
16 16
 #
17 17
 
18
-FROM armhf/debian:jessie
18
+FROM arm32v7/debian:stretch
19 19
 
20 20
 # allow replacing httpredir or deb mirror
21 21
 ARG APT_MIRROR=deb.debian.org
... ...
@@ -39,36 +39,27 @@ RUN apt-get update && apt-get install -y \
39 39
 	net-tools \
40 40
 	libapparmor-dev \
41 41
 	libcap-dev \
42
-	libsystemd-journal-dev \
42
+	libdevmapper-dev \
43
+	libsystemd-dev \
43 44
 	libtool \
45
+	libudev-dev \
44 46
 	mercurial \
45 47
 	pkg-config \
48
+	python-backports.ssl-match-hostname \
46 49
 	python-dev \
47 50
 	python-mock \
48 51
 	python-pip \
52
+	python-requests \
53
+	python-setuptools \
49 54
 	python-websocket \
55
+	python-wheel \
50 56
 	xfsprogs \
51 57
 	tar \
58
+	thin-provisioning-tools \
52 59
 	vim-common \
53 60
 	--no-install-recommends \
54 61
 	&& pip install awscli==1.10.15
55 62
 
56
-# Get lvm2 sources to build statically linked devmapper library
57
-ENV LVM2_VERSION 2.02.168
58
-RUN mkdir -p /usr/local/lvm2 \
59
-	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
60
-		| tar -xzC /usr/local/lvm2 --strip-components=1
61
-
62
-# Compile and install (only the needed library)
63
-RUN cd /usr/local/lvm2 \
64
-	&& ./configure \
65
-		--build="$(gcc -print-multiarch)" \
66
-		--enable-static_link \
67
-		--enable-pkgconfig \
68
-	&& make -C include \
69
-	&& make -C libdm install_device-mapper
70
-
71
-
72 63
 # Install Go
73 64
 # IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored
74 65
 ENV GO_VERSION 1.8.3
... ...
@@ -127,9 +118,11 @@ RUN set -x \
127 127
 
128 128
 # Get the "docker-py" source so we can run their integration tests
129 129
 ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
130
+# To run integration tests docker-pycreds is required.
130 131
 RUN git clone https://github.com/docker/docker-py.git /docker-py \
131 132
 	&& cd /docker-py \
132 133
 	&& git checkout -q $DOCKER_PY_COMMIT \
134
+	&& pip install docker-pycreds==0.2.1 \
133 135
 	&& pip install -r test-requirements.txt
134 136
 
135 137
 # Set user.email so crosbymichael's in-container merge commits go smoothly
... ...
@@ -15,7 +15,7 @@
15 15
 # the case. Therefore, you don't have to disable it anymore.
16 16
 #
17 17
 
18
-FROM ppc64le/debian:jessie
18
+FROM ppc64le/debian:stretch
19 19
 
20 20
 # allow replacing httpredir or deb mirror
21 21
 ARG APT_MIRROR=deb.debian.org
... ...
@@ -40,34 +40,26 @@ RUN apt-get update && apt-get install -y \
40 40
 	net-tools \
41 41
 	libapparmor-dev \
42 42
 	libcap-dev \
43
-	libsystemd-journal-dev \
43
+	libdevmapper-dev \
44
+	libsystemd-dev \
44 45
 	libtool \
46
+	libudev-dev \
45 47
 	mercurial \
46 48
 	pkg-config \
49
+	python-backports.ssl-match-hostname \
47 50
 	python-dev \
48 51
 	python-mock \
49 52
 	python-pip \
53
+	python-requests \
54
+	python-setuptools \
50 55
 	python-websocket \
56
+	python-wheel \
51 57
 	xfsprogs \
52 58
 	tar \
59
+	thin-provisioning-tools \
53 60
 	vim-common \
54 61
 	--no-install-recommends
55 62
 
56
-# Get lvm2 sources to build statically linked devmapper library
57
-ENV LVM2_VERSION 2.02.168
58
-RUN mkdir -p /usr/local/lvm2 \
59
-	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
60
-		| tar -xzC /usr/local/lvm2 --strip-components=1
61
-
62
-# Compile and install (only the needed library)
63
-RUN cd /usr/local/lvm2 \
64
-	&& ./configure \
65
-		--build="$(gcc -print-multiarch)" \
66
-		--enable-static_link \
67
-		--enable-pkgconfig \
68
-	&& make -C include \
69
-	&& make -C libdm install_device-mapper
70
-
71 63
 # Install seccomp: the version shipped upstream is too old
72 64
 ENV SECCOMP_VERSION 2.3.2
73 65
 RUN set -x \
... ...
@@ -125,9 +117,11 @@ RUN set -x \
125 125
 
126 126
 # Get the "docker-py" source so we can run their integration tests
127 127
 ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
128
+# To run integration tests docker-pycreds is required.
128 129
 RUN git clone https://github.com/docker/docker-py.git /docker-py \
129 130
 	&& cd /docker-py \
130 131
 	&& git checkout -q $DOCKER_PY_COMMIT \
132
+	&& pip install docker-pycreds==0.2.1 \
131 133
 	&& pip install -r test-requirements.txt
132 134
 
133 135
 # Set user.email so crosbymichael's in-container merge commits go smoothly
... ...
@@ -15,7 +15,7 @@
15 15
 # the case. Therefore, you don't have to disable it anymore.
16 16
 #
17 17
 
18
-FROM s390x/debian:jessie
18
+FROM s390x/debian:stretch
19 19
 
20 20
 # Packaged dependencies
21 21
 RUN apt-get update && apt-get install -y \
... ...
@@ -36,16 +36,23 @@ RUN apt-get update && apt-get install -y \
36 36
 	net-tools \
37 37
 	libapparmor-dev \
38 38
 	libcap-dev \
39
-	libsystemd-journal-dev \
39
+	libdevmapper-dev \
40
+	libsystemd-dev \
40 41
 	libtool \
42
+	libudev-dev \
41 43
 	mercurial \
42 44
 	pkg-config \
45
+	python-backports.ssl-match-hostname \
43 46
 	python-dev \
44 47
 	python-mock \
45 48
 	python-pip \
49
+	python-requests \
50
+	python-setuptools \
46 51
 	python-websocket \
52
+	python-wheel \
47 53
 	xfsprogs \
48 54
 	tar \
55
+	thin-provisioning-tools \
49 56
 	vim-common \
50 57
 	--no-install-recommends
51 58
 
... ...
@@ -64,21 +71,6 @@ RUN set -x \
64 64
 	) \
65 65
 	&& rm -rf "$SECCOMP_PATH"
66 66
 
67
-# Get lvm2 sources to build statically linked devmapper library
68
-ENV LVM2_VERSION 2.02.168
69
-RUN mkdir -p /usr/local/lvm2 \
70
-	&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
71
-		| tar -xzC /usr/local/lvm2 --strip-components=1
72
-
73
-# Compile and install (only the needed library)
74
-RUN cd /usr/local/lvm2 \
75
-	&& ./configure \
76
-		--build="$(gcc -print-multiarch)" \
77
-		--enable-static_link \
78
-		--enable-pkgconfig \
79
-	&& make -C include \
80
-	&& make -C libdm install_device-mapper
81
-
82 67
 # IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored
83 68
 ENV GO_VERSION 1.8.3
84 69
 RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" \
... ...
@@ -118,9 +110,11 @@ RUN set -x \
118 118
 
119 119
 # Get the "docker-py" source so we can run their integration tests
120 120
 ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
121
+# To run integration tests docker-pycreds is required.
121 122
 RUN git clone https://github.com/docker/docker-py.git /docker-py \
122 123
 	&& cd /docker-py \
123 124
 	&& git checkout -q $DOCKER_PY_COMMIT \
125
+	&& pip install docker-pycreds==0.2.1 \
124 126
 	&& pip install -r test-requirements.txt
125 127
 
126 128
 # Set user.email so crosbymichael's in-container merge commits go smoothly
... ...
@@ -5,7 +5,7 @@
5 5
 
6 6
 # This represents the bare minimum required to build and test Docker.
7 7
 
8
-FROM debian:jessie
8
+FROM debian:stretch
9 9
 
10 10
 # allow replacing httpredir or deb mirror
11 11
 ARG APT_MIRROR=deb.debian.org
... ...
@@ -21,10 +21,12 @@ import (
21 21
 	"github.com/docker/docker/daemon/graphdriver"
22 22
 	"github.com/docker/docker/dockerversion"
23 23
 	"github.com/docker/docker/pkg/devicemapper"
24
+	"github.com/docker/docker/pkg/dmesg"
24 25
 	"github.com/docker/docker/pkg/idtools"
25 26
 	"github.com/docker/docker/pkg/loopback"
26 27
 	"github.com/docker/docker/pkg/mount"
27 28
 	"github.com/docker/docker/pkg/parsers"
29
+	"github.com/docker/docker/pkg/parsers/kernel"
28 30
 	units "github.com/docker/go-units"
29 31
 	"github.com/opencontainers/selinux/go-selinux/label"
30 32
 	"github.com/pkg/errors"
... ...
@@ -533,11 +535,11 @@ func (devices *DeviceSet) activateDeviceIfNeeded(info *devInfo, ignoreDeleted bo
533 533
 	return devicemapper.ActivateDevice(devices.getPoolDevName(), info.Name(), info.DeviceID, info.Size)
534 534
 }
535 535
 
536
-// Return true only if kernel supports xfs and mkfs.xfs is available
537
-func xfsSupported() bool {
536
+// xfsSupported checks if xfs is supported, returns nil if it is, otherwise an error
537
+func xfsSupported() error {
538 538
 	// Make sure mkfs.xfs is available
539 539
 	if _, err := exec.LookPath("mkfs.xfs"); err != nil {
540
-		return false
540
+		return err // error text is descriptive enough
541 541
 	}
542 542
 
543 543
 	// Check if kernel supports xfs filesystem or not.
... ...
@@ -545,40 +547,47 @@ func xfsSupported() bool {
545 545
 
546 546
 	f, err := os.Open("/proc/filesystems")
547 547
 	if err != nil {
548
-		logrus.Warnf("devmapper: Could not check if xfs is supported: %v", err)
549
-		return false
548
+		return errors.Wrapf(err, "error checking for xfs support")
550 549
 	}
551 550
 	defer f.Close()
552 551
 
553 552
 	s := bufio.NewScanner(f)
554 553
 	for s.Scan() {
555 554
 		if strings.HasSuffix(s.Text(), "\txfs") {
556
-			return true
555
+			return nil
557 556
 		}
558 557
 	}
559 558
 
560 559
 	if err := s.Err(); err != nil {
561
-		logrus.Warnf("devmapper: Could not check if xfs is supported: %v", err)
560
+		return errors.Wrapf(err, "error checking for xfs support")
562 561
 	}
563
-	return false
562
+
563
+	return errors.New(`kernel does not support xfs, or "modprobe xfs" failed`)
564 564
 }
565 565
 
566 566
 func determineDefaultFS() string {
567
-	if xfsSupported() {
567
+	err := xfsSupported()
568
+	if err == nil {
568 569
 		return "xfs"
569 570
 	}
570 571
 
571
-	logrus.Warn("devmapper: XFS is not supported in your system. Either the kernel doesn't support it or mkfs.xfs is not in your PATH. Defaulting to ext4 filesystem")
572
+	logrus.Warnf("devmapper: XFS is not supported in your system (%v). Defaulting to ext4 filesystem", err)
572 573
 	return "ext4"
573 574
 }
574 575
 
575
-func (devices *DeviceSet) createFilesystem(info *devInfo) (err error) {
576
-	devname := info.DevName()
576
+// mkfsOptions tries to figure out whether some additional mkfs options are required
577
+func mkfsOptions(fs string) []string {
578
+	if fs == "xfs" && !kernel.CheckKernelVersion(3, 16, 0) {
579
+		// For kernels earlier than 3.16 (and newer xfsutils),
580
+		// some xfs features need to be explicitly disabled.
581
+		return []string{"-m", "crc=0,finobt=0"}
582
+	}
577 583
 
578
-	args := []string{}
579
-	args = append(args, devices.mkfsArgs...)
584
+	return []string{}
585
+}
580 586
 
581
-	args = append(args, devname)
587
+func (devices *DeviceSet) createFilesystem(info *devInfo) (err error) {
588
+	devname := info.DevName()
582 589
 
583 590
 	if devices.filesystem == "" {
584 591
 		devices.filesystem = determineDefaultFS()
... ...
@@ -587,7 +596,11 @@ func (devices *DeviceSet) createFilesystem(info *devInfo) (err error) {
587 587
 		return err
588 588
 	}
589 589
 
590
-	logrus.Infof("devmapper: Creating filesystem %s on device %s", devices.filesystem, info.Name())
590
+	args := mkfsOptions(devices.filesystem)
591
+	args = append(args, devices.mkfsArgs...)
592
+	args = append(args, devname)
593
+
594
+	logrus.Infof("devmapper: Creating filesystem %s on device %s, mkfs args: %v", devices.filesystem, info.Name(), args)
591 595
 	defer func() {
592 596
 		if err != nil {
593 597
 			logrus.Infof("devmapper: Error while creating filesystem %s on device %s: %v", devices.filesystem, info.Name(), err)
... ...
@@ -1188,7 +1201,7 @@ func (devices *DeviceSet) growFS(info *devInfo) error {
1188 1188
 	options = joinMountOptions(options, devices.mountOptions)
1189 1189
 
1190 1190
 	if err := mount.Mount(info.DevName(), fsMountPoint, devices.BaseDeviceFilesystem, options); err != nil {
1191
-		return fmt.Errorf("Error mounting '%s' on '%s': %s", info.DevName(), fsMountPoint, err)
1191
+		return fmt.Errorf("Error mounting '%s' on '%s': %s\n%v", info.DevName(), fsMountPoint, err, string(dmesg.Dmesg(256)))
1192 1192
 	}
1193 1193
 
1194 1194
 	defer unix.Unmount(fsMountPoint, unix.MNT_DETACH)
... ...
@@ -2379,7 +2392,7 @@ func (devices *DeviceSet) MountDevice(hash, path, mountLabel string) error {
2379 2379
 	options = joinMountOptions(options, label.FormatMountLabel("", mountLabel))
2380 2380
 
2381 2381
 	if err := mount.Mount(info.DevName(), path, fstype, options); err != nil {
2382
-		return fmt.Errorf("devmapper: Error mounting '%s' on '%s': %s", info.DevName(), path, err)
2382
+		return fmt.Errorf("devmapper: Error mounting '%s' on '%s': %s\n%v", info.DevName(), path, err, string(dmesg.Dmesg(256)))
2383 2383
 	}
2384 2384
 
2385 2385
 	if fstype == "xfs" && devices.xfsNospaceRetries != "" {
... ...
@@ -1,4 +1,4 @@
1
-// +build !exclude_graphdriver_devicemapper,linux
1
+// +build !exclude_graphdriver_devicemapper,!static_build,linux
2 2
 
3 3
 package register
4 4
 
... ...
@@ -214,14 +214,15 @@ func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
214 214
 func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) {
215 215
 	// TODO Windows: Fix this test for TP5.
216 216
 	testRequires(c, DaemonIsLinux)
217
-	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", `usleep 600000;yes X | head -c 200000`)
217
+	expected := 150000
218
+	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", fmt.Sprintf("usleep 600000; yes X | head -c %d", expected))
218 219
 
219 220
 	id := strings.TrimSpace(out)
220 221
 
221 222
 	stopSlowRead := make(chan bool)
222 223
 
223 224
 	go func() {
224
-		exec.Command(dockerBinary, "wait", id).Run()
225
+		dockerCmd(c, "wait", id)
225 226
 		stopSlowRead <- true
226 227
 	}()
227 228
 
... ...
@@ -238,8 +239,9 @@ func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) {
238 238
 	bytes2, err := ConsumeWithSpeed(stdout, 32*1024, 0, nil)
239 239
 	c.Assert(err, checker.IsNil)
240 240
 
241
+	c.Assert(logCmd.Wait(), checker.IsNil)
242
+
241 243
 	actual := bytes1 + bytes2
242
-	expected := 200000
243 244
 	c.Assert(actual, checker.Equals, expected)
244 245
 }
245 246
 
... ...
@@ -288,6 +290,7 @@ func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) {
288 288
 	c.Assert(<-chErr, checker.IsNil)
289 289
 	c.Assert(cmd.Process.Kill(), checker.IsNil)
290 290
 	r.Close()
291
+	cmd.Wait()
291 292
 	// NGoroutines is not updated right away, so we need to wait before failing
292 293
 	c.Assert(waitForGoroutines(nroutines), checker.IsNil)
293 294
 }
... ...
@@ -303,6 +306,7 @@ func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *check.C) {
303 303
 	c.Assert(cmd.Start(), checker.IsNil)
304 304
 	time.Sleep(200 * time.Millisecond)
305 305
 	c.Assert(cmd.Process.Kill(), checker.IsNil)
306
+	cmd.Wait()
306 307
 
307 308
 	// NGoroutines is not updated right away, so we need to wait before failing
308 309
 	c.Assert(waitForGoroutines(nroutines), checker.IsNil)
... ...
@@ -1060,7 +1060,7 @@ func (s *DockerSuite) TestRunSeccompProfileAllow32Bit(c *check.C) {
1060 1060
 	testRequires(c, SameHostDaemon, seccompEnabled, IsAmd64)
1061 1061
 	ensureSyscallTest(c)
1062 1062
 
1063
-	icmd.RunCommand(dockerBinary, "run", "syscall-test", "exit32-test", "id").Assert(c, icmd.Success)
1063
+	icmd.RunCommand(dockerBinary, "run", "syscall-test", "exit32-test").Assert(c, icmd.Success)
1064 1064
 }
1065 1065
 
1066 1066
 // TestRunSeccompAllowSetrlimit checks that 'docker run debian:jessie ulimit -v 1048510' succeeds.
... ...
@@ -57,7 +57,7 @@ func ensureSyscallTest(c *check.C) {
57 57
 	}
58 58
 
59 59
 	if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" {
60
-		out, err := exec.Command(gcc, "-s", "-m32", "-nostdlib", "../contrib/syscall-test/exit32.s", "-o", tmp+"/"+"exit32-test").CombinedOutput()
60
+		out, err := exec.Command(gcc, "-s", "-m32", "-nostdlib", "-static", "../contrib/syscall-test/exit32.s", "-o", tmp+"/"+"exit32-test").CombinedOutput()
61 61
 		c.Assert(err, checker.IsNil, check.Commentf(string(out)))
62 62
 	}
63 63
 
64 64
deleted file mode 100644
... ...
@@ -1,6 +0,0 @@
1
-// +build linux,cgo,static_build
2
-
3
-package devicemapper
4
-
5
-// #cgo pkg-config: --static devmapper
6
-import "C"
7 1
new file mode 100644
... ...
@@ -0,0 +1,20 @@
0
+// +build linux
1
+
2
+package dmesg
3
+
4
+import (
5
+	"unsafe"
6
+
7
+	"golang.org/x/sys/unix"
8
+)
9
+
10
+// Dmesg returns last messages from the kernel log, up to size bytes
11
+func Dmesg(size int) []byte {
12
+	t := uintptr(3) // SYSLOG_ACTION_READ_ALL
13
+	b := make([]byte, size)
14
+	amt, _, err := unix.Syscall(unix.SYS_SYSLOG, t, uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)))
15
+	if err != 0 {
16
+		return []byte{}
17
+	}
18
+	return b[:amt]
19
+}
0 20
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+package dmesg
1
+
2
+import (
3
+	"testing"
4
+)
5
+
6
+func TestDmesg(t *testing.T) {
7
+	t.Logf("dmesg output follows:\n%v", string(Dmesg(512)))
8
+}