Merge pull request #34550 from kolyshkin/libeudev

Update Dockerfiles to use Debian Stretch
This commit is contained in:
Yong Tang 2017-09-18 21:03:31 -07:00 committed by GitHub
commit cfdac1245a
14 changed files with 140 additions and 132 deletions

View file

@ -23,7 +23,7 @@
# the case. Therefore, you don't have to disable it anymore. # the case. Therefore, you don't have to disable it anymore.
# #
FROM debian:jessie FROM debian:stretch
# allow replacing httpredir or deb mirror # allow replacing httpredir or deb mirror
ARG APT_MIRROR=deb.debian.org ARG APT_MIRROR=deb.debian.org
@ -51,21 +51,28 @@ RUN apt-get update && apt-get install -y \
less \ less \
libapparmor-dev \ libapparmor-dev \
libcap-dev \ libcap-dev \
libdevmapper-dev \
libnl-3-dev \ libnl-3-dev \
libprotobuf-c0-dev \ libprotobuf-c0-dev \
libprotobuf-dev \ libprotobuf-dev \
libsystemd-journal-dev \ libsystemd-dev \
libtool \ libtool \
libudev-dev \
mercurial \ mercurial \
net-tools \ net-tools \
pkg-config \ pkg-config \
protobuf-compiler \ protobuf-compiler \
protobuf-c-compiler \ protobuf-c-compiler \
python-backports.ssl-match-hostname \
python-dev \ python-dev \
python-mock \ python-mock \
python-pip \ python-pip \
python-requests \
python-setuptools \
python-websocket \ python-websocket \
python-wheel \
tar \ tar \
thin-provisioning-tools \
vim \ vim \
vim-common \ vim-common \
xfsprogs \ xfsprogs \
@ -73,21 +80,6 @@ RUN apt-get update && apt-get install -y \
--no-install-recommends \ --no-install-recommends \
&& pip install awscli==1.10.15 && pip install awscli==1.10.15
# Get lvm2 sources to build statically linked devmapper library
ENV LVM2_VERSION 2.02.168
RUN mkdir -p /usr/local/lvm2 \
&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
| tar -xzC /usr/local/lvm2 --strip-components=1
# Compile and install (only the needed library)
RUN cd /usr/local/lvm2 \
&& ./configure \
--build="$(gcc -print-multiarch)" \
--enable-static_link \
--enable-pkgconfig \
&& make -C include \
&& make -C libdm install_device-mapper
# Install seccomp: the version shipped upstream is too old # Install seccomp: the version shipped upstream is too old
ENV SECCOMP_VERSION 2.3.2 ENV SECCOMP_VERSION 2.3.2
RUN set -x \ RUN set -x \
@ -157,9 +149,6 @@ RUN set -x \
# Get the "docker-py" source so we can run their integration tests # Get the "docker-py" source so we can run their integration tests
ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
# To run integration tests docker-pycreds is required. # To run integration tests docker-pycreds is required.
# Before running the integration tests conftest.py is
# loaded which results in loads auth.py that
# imports the docker-pycreds module.
RUN git clone https://github.com/docker/docker-py.git /docker-py \ RUN git clone https://github.com/docker/docker-py.git /docker-py \
&& cd /docker-py \ && cd /docker-py \
&& git checkout -q $DOCKER_PY_COMMIT \ && git checkout -q $DOCKER_PY_COMMIT \

View file

@ -15,14 +15,20 @@
# the case. Therefore, you don't have to disable it anymore. # the case. Therefore, you don't have to disable it anymore.
# #
FROM aarch64/ubuntu:xenial FROM arm64v8/debian:stretch
# allow replacing httpredir or deb mirror
ARG APT_MIRROR=deb.debian.org
RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list
# Packaged dependencies # Packaged dependencies
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
apparmor \ apparmor \
apt-utils \
aufs-tools \ aufs-tools \
automake \ automake \
bash-completion \ bash-completion \
bsdmainutils \
btrfs-tools \ btrfs-tools \
build-essential \ build-essential \
cmake \ cmake \
@ -32,43 +38,40 @@ RUN apt-get update && apt-get install -y \
g++ \ g++ \
gcc \ gcc \
git \ git \
golang \
iptables \ iptables \
jq \ jq \
less \
libapparmor-dev \ libapparmor-dev \
libc6-dev \
libcap-dev \ libcap-dev \
libdevmapper-dev \
libnl-3-dev \
libprotobuf-c0-dev \
libprotobuf-dev \
libsystemd-dev \ libsystemd-dev \
libyaml-dev \ libtool \
libudev-dev \
mercurial \ mercurial \
net-tools \ net-tools \
parallel \
pkg-config \ pkg-config \
protobuf-compiler \
protobuf-c-compiler \
python-backports.ssl-match-hostname \
python-dev \ python-dev \
python-mock \ python-mock \
python-pip \ python-pip \
python-requests \
python-setuptools \ python-setuptools \
python-websocket \ python-websocket \
golang-go \ python-wheel \
iproute2 \ tar \
iputils-ping \ thin-provisioning-tools \
vim \
vim-common \ vim-common \
xfsprogs \
zip \
--no-install-recommends --no-install-recommends
# Get lvm2 sources to build statically linked devmapper library
ENV LVM2_VERSION 2.02.168
RUN mkdir -p /usr/local/lvm2 \
&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
| tar -xzC /usr/local/lvm2 --strip-components=1
# Compile and install (only the needed library)
RUN cd /usr/local/lvm2 \
&& ./configure \
--build="$(gcc -print-multiarch)" \
--enable-static_link \
--enable-pkgconfig \
&& make -C include \
&& make -C libdm install_device-mapper
# Install seccomp: the version shipped upstream is too old # Install seccomp: the version shipped upstream is too old
ENV SECCOMP_VERSION 2.3.2 ENV SECCOMP_VERSION 2.3.2
RUN set -x \ RUN set -x \
@ -86,9 +89,7 @@ RUN set -x \
# Install Go # Install Go
# We don't have official binary golang 1.7.5 tarballs for ARM64, either for Go or # We don't have official binary golang 1.7.5 tarballs for ARM64, either for Go or
# bootstrap, so we use golang-go (1.6) as bootstrap to build Go from source code. # bootstrap, so we use Debian golang (1.7) as bootstrap to build Go from source code.
# We don't use the official ARMv6 released binaries as a GOROOT_BOOTSTRAP, because
# not all ARM64 platforms support 32-bit mode. 32-bit mode is optional for ARMv8.
# IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored # IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored
ENV GO_VERSION 1.8.3 ENV GO_VERSION 1.8.3
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 \ 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 \
# Get the "docker-py" source so we can run their integration tests # Get the "docker-py" source so we can run their integration tests
ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
# Before running the integration tests conftest.py is # To run integration tests docker-pycreds is required.
# loaded which results in loads auth.py that
# imports the docker-pycreds module.
RUN git clone https://github.com/docker/docker-py.git /docker-py \ RUN git clone https://github.com/docker/docker-py.git /docker-py \
&& cd /docker-py \ && cd /docker-py \
&& git checkout -q $DOCKER_PY_COMMIT \ && git checkout -q $DOCKER_PY_COMMIT \
&& pip install wheel \
&& pip install docker-pycreds==0.2.1 \ && pip install docker-pycreds==0.2.1 \
&& pip install -r test-requirements.txt && pip install -r test-requirements.txt

View file

@ -15,7 +15,7 @@
# the case. Therefore, you don't have to disable it anymore. # the case. Therefore, you don't have to disable it anymore.
# #
FROM armhf/debian:jessie FROM arm32v7/debian:stretch
# allow replacing httpredir or deb mirror # allow replacing httpredir or deb mirror
ARG APT_MIRROR=deb.debian.org ARG APT_MIRROR=deb.debian.org
@ -39,36 +39,27 @@ RUN apt-get update && apt-get install -y \
net-tools \ net-tools \
libapparmor-dev \ libapparmor-dev \
libcap-dev \ libcap-dev \
libsystemd-journal-dev \ libdevmapper-dev \
libsystemd-dev \
libtool \ libtool \
libudev-dev \
mercurial \ mercurial \
pkg-config \ pkg-config \
python-backports.ssl-match-hostname \
python-dev \ python-dev \
python-mock \ python-mock \
python-pip \ python-pip \
python-requests \
python-setuptools \
python-websocket \ python-websocket \
python-wheel \
xfsprogs \ xfsprogs \
tar \ tar \
thin-provisioning-tools \
vim-common \ vim-common \
--no-install-recommends \ --no-install-recommends \
&& pip install awscli==1.10.15 && pip install awscli==1.10.15
# Get lvm2 sources to build statically linked devmapper library
ENV LVM2_VERSION 2.02.168
RUN mkdir -p /usr/local/lvm2 \
&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
| tar -xzC /usr/local/lvm2 --strip-components=1
# Compile and install (only the needed library)
RUN cd /usr/local/lvm2 \
&& ./configure \
--build="$(gcc -print-multiarch)" \
--enable-static_link \
--enable-pkgconfig \
&& make -C include \
&& make -C libdm install_device-mapper
# Install Go # Install Go
# IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored # IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored
ENV GO_VERSION 1.8.3 ENV GO_VERSION 1.8.3
@ -127,9 +118,11 @@ RUN set -x \
# Get the "docker-py" source so we can run their integration tests # Get the "docker-py" source so we can run their integration tests
ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
# To run integration tests docker-pycreds is required.
RUN git clone https://github.com/docker/docker-py.git /docker-py \ RUN git clone https://github.com/docker/docker-py.git /docker-py \
&& cd /docker-py \ && cd /docker-py \
&& git checkout -q $DOCKER_PY_COMMIT \ && git checkout -q $DOCKER_PY_COMMIT \
&& pip install docker-pycreds==0.2.1 \
&& pip install -r test-requirements.txt && pip install -r test-requirements.txt
# Set user.email so crosbymichael's in-container merge commits go smoothly # Set user.email so crosbymichael's in-container merge commits go smoothly

View file

@ -15,7 +15,7 @@
# the case. Therefore, you don't have to disable it anymore. # the case. Therefore, you don't have to disable it anymore.
# #
FROM ppc64le/debian:jessie FROM ppc64le/debian:stretch
# allow replacing httpredir or deb mirror # allow replacing httpredir or deb mirror
ARG APT_MIRROR=deb.debian.org ARG APT_MIRROR=deb.debian.org
@ -40,34 +40,26 @@ RUN apt-get update && apt-get install -y \
net-tools \ net-tools \
libapparmor-dev \ libapparmor-dev \
libcap-dev \ libcap-dev \
libsystemd-journal-dev \ libdevmapper-dev \
libsystemd-dev \
libtool \ libtool \
libudev-dev \
mercurial \ mercurial \
pkg-config \ pkg-config \
python-backports.ssl-match-hostname \
python-dev \ python-dev \
python-mock \ python-mock \
python-pip \ python-pip \
python-requests \
python-setuptools \
python-websocket \ python-websocket \
python-wheel \
xfsprogs \ xfsprogs \
tar \ tar \
thin-provisioning-tools \
vim-common \ vim-common \
--no-install-recommends --no-install-recommends
# Get lvm2 sources to build statically linked devmapper library
ENV LVM2_VERSION 2.02.168
RUN mkdir -p /usr/local/lvm2 \
&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
| tar -xzC /usr/local/lvm2 --strip-components=1
# Compile and install (only the needed library)
RUN cd /usr/local/lvm2 \
&& ./configure \
--build="$(gcc -print-multiarch)" \
--enable-static_link \
--enable-pkgconfig \
&& make -C include \
&& make -C libdm install_device-mapper
# Install seccomp: the version shipped upstream is too old # Install seccomp: the version shipped upstream is too old
ENV SECCOMP_VERSION 2.3.2 ENV SECCOMP_VERSION 2.3.2
RUN set -x \ RUN set -x \
@ -125,9 +117,11 @@ RUN set -x \
# Get the "docker-py" source so we can run their integration tests # Get the "docker-py" source so we can run their integration tests
ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
# To run integration tests docker-pycreds is required.
RUN git clone https://github.com/docker/docker-py.git /docker-py \ RUN git clone https://github.com/docker/docker-py.git /docker-py \
&& cd /docker-py \ && cd /docker-py \
&& git checkout -q $DOCKER_PY_COMMIT \ && git checkout -q $DOCKER_PY_COMMIT \
&& pip install docker-pycreds==0.2.1 \
&& pip install -r test-requirements.txt && pip install -r test-requirements.txt
# Set user.email so crosbymichael's in-container merge commits go smoothly # Set user.email so crosbymichael's in-container merge commits go smoothly

View file

@ -15,7 +15,7 @@
# the case. Therefore, you don't have to disable it anymore. # the case. Therefore, you don't have to disable it anymore.
# #
FROM s390x/debian:jessie FROM s390x/debian:stretch
# Packaged dependencies # Packaged dependencies
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
@ -36,16 +36,23 @@ RUN apt-get update && apt-get install -y \
net-tools \ net-tools \
libapparmor-dev \ libapparmor-dev \
libcap-dev \ libcap-dev \
libsystemd-journal-dev \ libdevmapper-dev \
libsystemd-dev \
libtool \ libtool \
libudev-dev \
mercurial \ mercurial \
pkg-config \ pkg-config \
python-backports.ssl-match-hostname \
python-dev \ python-dev \
python-mock \ python-mock \
python-pip \ python-pip \
python-requests \
python-setuptools \
python-websocket \ python-websocket \
python-wheel \
xfsprogs \ xfsprogs \
tar \ tar \
thin-provisioning-tools \
vim-common \ vim-common \
--no-install-recommends --no-install-recommends
@ -64,21 +71,6 @@ RUN set -x \
) \ ) \
&& rm -rf "$SECCOMP_PATH" && rm -rf "$SECCOMP_PATH"
# Get lvm2 sources to build statically linked devmapper library
ENV LVM2_VERSION 2.02.168
RUN mkdir -p /usr/local/lvm2 \
&& curl -fsSL "https://mirrors.kernel.org/sourceware/lvm2/LVM2.${LVM2_VERSION}.tgz" \
| tar -xzC /usr/local/lvm2 --strip-components=1
# Compile and install (only the needed library)
RUN cd /usr/local/lvm2 \
&& ./configure \
--build="$(gcc -print-multiarch)" \
--enable-static_link \
--enable-pkgconfig \
&& make -C include \
&& make -C libdm install_device-mapper
# IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored # IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored
ENV GO_VERSION 1.8.3 ENV GO_VERSION 1.8.3
RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" \ RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" \
@ -118,9 +110,11 @@ RUN set -x \
# Get the "docker-py" source so we can run their integration tests # Get the "docker-py" source so we can run their integration tests
ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef ENV DOCKER_PY_COMMIT a962578e515185cf06506050b2200c0b81aa84ef
# To run integration tests docker-pycreds is required.
RUN git clone https://github.com/docker/docker-py.git /docker-py \ RUN git clone https://github.com/docker/docker-py.git /docker-py \
&& cd /docker-py \ && cd /docker-py \
&& git checkout -q $DOCKER_PY_COMMIT \ && git checkout -q $DOCKER_PY_COMMIT \
&& pip install docker-pycreds==0.2.1 \
&& pip install -r test-requirements.txt && pip install -r test-requirements.txt
# Set user.email so crosbymichael's in-container merge commits go smoothly # Set user.email so crosbymichael's in-container merge commits go smoothly

View file

@ -5,7 +5,7 @@
# This represents the bare minimum required to build and test Docker. # This represents the bare minimum required to build and test Docker.
FROM debian:jessie FROM debian:stretch
# allow replacing httpredir or deb mirror # allow replacing httpredir or deb mirror
ARG APT_MIRROR=deb.debian.org ARG APT_MIRROR=deb.debian.org

View file

@ -21,10 +21,12 @@ import (
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/dockerversion" "github.com/docker/docker/dockerversion"
"github.com/docker/docker/pkg/devicemapper" "github.com/docker/docker/pkg/devicemapper"
"github.com/docker/docker/pkg/dmesg"
"github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/loopback" "github.com/docker/docker/pkg/loopback"
"github.com/docker/docker/pkg/mount" "github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/parsers/kernel"
units "github.com/docker/go-units" units "github.com/docker/go-units"
"github.com/opencontainers/selinux/go-selinux/label" "github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -533,11 +535,11 @@ func (devices *DeviceSet) activateDeviceIfNeeded(info *devInfo, ignoreDeleted bo
return devicemapper.ActivateDevice(devices.getPoolDevName(), info.Name(), info.DeviceID, info.Size) return devicemapper.ActivateDevice(devices.getPoolDevName(), info.Name(), info.DeviceID, info.Size)
} }
// Return true only if kernel supports xfs and mkfs.xfs is available // xfsSupported checks if xfs is supported, returns nil if it is, otherwise an error
func xfsSupported() bool { func xfsSupported() error {
// Make sure mkfs.xfs is available // Make sure mkfs.xfs is available
if _, err := exec.LookPath("mkfs.xfs"); err != nil { if _, err := exec.LookPath("mkfs.xfs"); err != nil {
return false return err // error text is descriptive enough
} }
// Check if kernel supports xfs filesystem or not. // Check if kernel supports xfs filesystem or not.
@ -545,41 +547,48 @@ func xfsSupported() bool {
f, err := os.Open("/proc/filesystems") f, err := os.Open("/proc/filesystems")
if err != nil { if err != nil {
logrus.Warnf("devmapper: Could not check if xfs is supported: %v", err) return errors.Wrapf(err, "error checking for xfs support")
return false
} }
defer f.Close() defer f.Close()
s := bufio.NewScanner(f) s := bufio.NewScanner(f)
for s.Scan() { for s.Scan() {
if strings.HasSuffix(s.Text(), "\txfs") { if strings.HasSuffix(s.Text(), "\txfs") {
return true return nil
} }
} }
if err := s.Err(); err != nil { if err := s.Err(); err != nil {
logrus.Warnf("devmapper: Could not check if xfs is supported: %v", err) return errors.Wrapf(err, "error checking for xfs support")
} }
return false
return errors.New(`kernel does not support xfs, or "modprobe xfs" failed`)
} }
func determineDefaultFS() string { func determineDefaultFS() string {
if xfsSupported() { err := xfsSupported()
if err == nil {
return "xfs" return "xfs"
} }
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") logrus.Warnf("devmapper: XFS is not supported in your system (%v). Defaulting to ext4 filesystem", err)
return "ext4" return "ext4"
} }
// mkfsOptions tries to figure out whether some additional mkfs options are required
func mkfsOptions(fs string) []string {
if fs == "xfs" && !kernel.CheckKernelVersion(3, 16, 0) {
// For kernels earlier than 3.16 (and newer xfsutils),
// some xfs features need to be explicitly disabled.
return []string{"-m", "crc=0,finobt=0"}
}
return []string{}
}
func (devices *DeviceSet) createFilesystem(info *devInfo) (err error) { func (devices *DeviceSet) createFilesystem(info *devInfo) (err error) {
devname := info.DevName() devname := info.DevName()
args := []string{}
args = append(args, devices.mkfsArgs...)
args = append(args, devname)
if devices.filesystem == "" { if devices.filesystem == "" {
devices.filesystem = determineDefaultFS() devices.filesystem = determineDefaultFS()
} }
@ -587,7 +596,11 @@ func (devices *DeviceSet) createFilesystem(info *devInfo) (err error) {
return err return err
} }
logrus.Infof("devmapper: Creating filesystem %s on device %s", devices.filesystem, info.Name()) args := mkfsOptions(devices.filesystem)
args = append(args, devices.mkfsArgs...)
args = append(args, devname)
logrus.Infof("devmapper: Creating filesystem %s on device %s, mkfs args: %v", devices.filesystem, info.Name(), args)
defer func() { defer func() {
if err != nil { if err != nil {
logrus.Infof("devmapper: Error while creating filesystem %s on device %s: %v", devices.filesystem, info.Name(), err) 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 {
options = joinMountOptions(options, devices.mountOptions) options = joinMountOptions(options, devices.mountOptions)
if err := mount.Mount(info.DevName(), fsMountPoint, devices.BaseDeviceFilesystem, options); err != nil { if err := mount.Mount(info.DevName(), fsMountPoint, devices.BaseDeviceFilesystem, options); err != nil {
return fmt.Errorf("Error mounting '%s' on '%s': %s", info.DevName(), fsMountPoint, err) return fmt.Errorf("Error mounting '%s' on '%s': %s\n%v", info.DevName(), fsMountPoint, err, string(dmesg.Dmesg(256)))
} }
defer unix.Unmount(fsMountPoint, unix.MNT_DETACH) defer unix.Unmount(fsMountPoint, unix.MNT_DETACH)
@ -2379,7 +2392,7 @@ func (devices *DeviceSet) MountDevice(hash, path, mountLabel string) error {
options = joinMountOptions(options, label.FormatMountLabel("", mountLabel)) options = joinMountOptions(options, label.FormatMountLabel("", mountLabel))
if err := mount.Mount(info.DevName(), path, fstype, options); err != nil { if err := mount.Mount(info.DevName(), path, fstype, options); err != nil {
return fmt.Errorf("devmapper: Error mounting '%s' on '%s': %s", info.DevName(), path, err) return fmt.Errorf("devmapper: Error mounting '%s' on '%s': %s\n%v", info.DevName(), path, err, string(dmesg.Dmesg(256)))
} }
if fstype == "xfs" && devices.xfsNospaceRetries != "" { if fstype == "xfs" && devices.xfsNospaceRetries != "" {

View file

@ -1,4 +1,4 @@
// +build !exclude_graphdriver_devicemapper,linux // +build !exclude_graphdriver_devicemapper,!static_build,linux
package register package register

View file

@ -214,14 +214,15 @@ func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) { func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) {
// TODO Windows: Fix this test for TP5. // TODO Windows: Fix this test for TP5.
testRequires(c, DaemonIsLinux) testRequires(c, DaemonIsLinux)
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", `usleep 600000;yes X | head -c 200000`) expected := 150000
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", fmt.Sprintf("usleep 600000; yes X | head -c %d", expected))
id := strings.TrimSpace(out) id := strings.TrimSpace(out)
stopSlowRead := make(chan bool) stopSlowRead := make(chan bool)
go func() { go func() {
exec.Command(dockerBinary, "wait", id).Run() dockerCmd(c, "wait", id)
stopSlowRead <- true stopSlowRead <- true
}() }()
@ -238,8 +239,9 @@ func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) {
bytes2, err := ConsumeWithSpeed(stdout, 32*1024, 0, nil) bytes2, err := ConsumeWithSpeed(stdout, 32*1024, 0, nil)
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
c.Assert(logCmd.Wait(), checker.IsNil)
actual := bytes1 + bytes2 actual := bytes1 + bytes2
expected := 200000
c.Assert(actual, checker.Equals, expected) c.Assert(actual, checker.Equals, expected)
} }
@ -288,6 +290,7 @@ func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) {
c.Assert(<-chErr, checker.IsNil) c.Assert(<-chErr, checker.IsNil)
c.Assert(cmd.Process.Kill(), checker.IsNil) c.Assert(cmd.Process.Kill(), checker.IsNil)
r.Close() r.Close()
cmd.Wait()
// NGoroutines is not updated right away, so we need to wait before failing // NGoroutines is not updated right away, so we need to wait before failing
c.Assert(waitForGoroutines(nroutines), checker.IsNil) c.Assert(waitForGoroutines(nroutines), checker.IsNil)
} }
@ -303,6 +306,7 @@ func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *check.C) {
c.Assert(cmd.Start(), checker.IsNil) c.Assert(cmd.Start(), checker.IsNil)
time.Sleep(200 * time.Millisecond) time.Sleep(200 * time.Millisecond)
c.Assert(cmd.Process.Kill(), checker.IsNil) c.Assert(cmd.Process.Kill(), checker.IsNil)
cmd.Wait()
// NGoroutines is not updated right away, so we need to wait before failing // NGoroutines is not updated right away, so we need to wait before failing
c.Assert(waitForGoroutines(nroutines), checker.IsNil) c.Assert(waitForGoroutines(nroutines), checker.IsNil)

View file

@ -1060,7 +1060,7 @@ func (s *DockerSuite) TestRunSeccompProfileAllow32Bit(c *check.C) {
testRequires(c, SameHostDaemon, seccompEnabled, IsAmd64) testRequires(c, SameHostDaemon, seccompEnabled, IsAmd64)
ensureSyscallTest(c) ensureSyscallTest(c)
icmd.RunCommand(dockerBinary, "run", "syscall-test", "exit32-test", "id").Assert(c, icmd.Success) icmd.RunCommand(dockerBinary, "run", "syscall-test", "exit32-test").Assert(c, icmd.Success)
} }
// TestRunSeccompAllowSetrlimit checks that 'docker run debian:jessie ulimit -v 1048510' succeeds. // TestRunSeccompAllowSetrlimit checks that 'docker run debian:jessie ulimit -v 1048510' succeeds.

View file

@ -57,7 +57,7 @@ func ensureSyscallTest(c *check.C) {
} }
if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" { if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" {
out, err := exec.Command(gcc, "-s", "-m32", "-nostdlib", "../contrib/syscall-test/exit32.s", "-o", tmp+"/"+"exit32-test").CombinedOutput() out, err := exec.Command(gcc, "-s", "-m32", "-nostdlib", "-static", "../contrib/syscall-test/exit32.s", "-o", tmp+"/"+"exit32-test").CombinedOutput()
c.Assert(err, checker.IsNil, check.Commentf(string(out))) c.Assert(err, checker.IsNil, check.Commentf(string(out)))
} }

View file

@ -1,6 +0,0 @@
// +build linux,cgo,static_build
package devicemapper
// #cgo pkg-config: --static devmapper
import "C"

20
pkg/dmesg/dmesg_linux.go Normal file
View file

@ -0,0 +1,20 @@
// +build linux
package dmesg
import (
"unsafe"
"golang.org/x/sys/unix"
)
// Dmesg returns last messages from the kernel log, up to size bytes
func Dmesg(size int) []byte {
t := uintptr(3) // SYSLOG_ACTION_READ_ALL
b := make([]byte, size)
amt, _, err := unix.Syscall(unix.SYS_SYSLOG, t, uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)))
if err != 0 {
return []byte{}
}
return b[:amt]
}

View file

@ -0,0 +1,9 @@
package dmesg
import (
"testing"
)
func TestDmesg(t *testing.T) {
t.Logf("dmesg output follows:\n%v", string(Dmesg(512)))
}