Browse Source

Merge pull request #30331 from vieux/1.13.1-rc1-cherrypicks

1.13.1 rc1 cherrypicks
Victor Vieux 8 years ago
parent
commit
1b05e7aee7
68 changed files with 676 additions and 222 deletions
  1. 1 1
      Dockerfile
  2. 1 1
      Dockerfile.aarch64
  3. 1 1
      Dockerfile.armhf
  4. 6 20
      Dockerfile.ppc64le
  5. 1 1
      Dockerfile.s390x
  6. 1 1
      Dockerfile.simple
  7. 2 2
      Dockerfile.windows
  8. 1 1
      api/server/router/network/network_routes.go
  9. 6 0
      cli/command/container/list.go
  10. 4 1
      cli/command/formatter/disk_usage.go
  11. 74 18
      cli/command/system/inspect.go
  12. 11 0
      cmd/dockerd/service_windows.go
  13. 1 1
      contrib/builder/deb/aarch64/ubuntu-trusty/Dockerfile
  14. 1 1
      contrib/builder/deb/aarch64/ubuntu-xenial/Dockerfile
  15. 1 1
      contrib/builder/deb/amd64/debian-jessie/Dockerfile
  16. 1 1
      contrib/builder/deb/amd64/debian-stretch/Dockerfile
  17. 1 1
      contrib/builder/deb/amd64/debian-wheezy/Dockerfile
  18. 1 1
      contrib/builder/deb/amd64/ubuntu-precise/Dockerfile
  19. 1 1
      contrib/builder/deb/amd64/ubuntu-trusty/Dockerfile
  20. 1 1
      contrib/builder/deb/amd64/ubuntu-xenial/Dockerfile
  21. 1 1
      contrib/builder/deb/amd64/ubuntu-yakkety/Dockerfile
  22. 1 1
      contrib/builder/deb/armhf/debian-jessie/Dockerfile
  23. 1 1
      contrib/builder/deb/armhf/raspbian-jessie/Dockerfile
  24. 1 1
      contrib/builder/deb/armhf/ubuntu-trusty/Dockerfile
  25. 1 1
      contrib/builder/deb/armhf/ubuntu-xenial/Dockerfile
  26. 1 1
      contrib/builder/deb/armhf/ubuntu-yakkety/Dockerfile
  27. 1 28
      contrib/builder/deb/ppc64le/generate.sh
  28. 3 15
      contrib/builder/deb/ppc64le/ubuntu-trusty/Dockerfile
  29. 3 15
      contrib/builder/deb/ppc64le/ubuntu-xenial/Dockerfile
  30. 3 15
      contrib/builder/deb/ppc64le/ubuntu-yakkety/Dockerfile
  31. 1 1
      contrib/builder/deb/s390x/ubuntu-xenial/Dockerfile
  32. 1 1
      contrib/builder/rpm/amd64/centos-7/Dockerfile
  33. 1 1
      contrib/builder/rpm/amd64/fedora-24/Dockerfile
  34. 1 1
      contrib/builder/rpm/amd64/fedora-25/Dockerfile
  35. 1 1
      contrib/builder/rpm/amd64/opensuse-13.2/Dockerfile
  36. 1 1
      contrib/builder/rpm/amd64/oraclelinux-6/Dockerfile
  37. 1 1
      contrib/builder/rpm/amd64/oraclelinux-7/Dockerfile
  38. 1 1
      contrib/builder/rpm/amd64/photon-1.0/Dockerfile
  39. 89 35
      contrib/completion/bash/docker
  40. 40 7
      contrib/completion/zsh/_docker
  41. 3 2
      daemon/cluster/cluster.go
  42. 2 1
      daemon/cluster/executor/backend.go
  43. 16 2
      daemon/daemon.go
  44. 13 4
      daemon/daemon_unix.go
  45. 1 1
      daemon/images.go
  46. 28 0
      daemon/network.go
  47. 1 1
      daemon/oci_linux.go
  48. 4 0
      distribution/registry.go
  49. 164 0
      docs/extend/EBS_volume.md
  50. 2 2
      docs/extend/index.md
  51. 2 0
      docs/reference/commandline/create.md
  52. 2 0
      docs/reference/commandline/run.md
  53. 1 1
      docs/reference/commandline/service_create.md
  54. 1 1
      hack/dockerfile/install-binaries.sh
  55. 55 0
      integration-cli/docker_api_swarm_test.go
  56. 7 0
      integration-cli/docker_cli_ps_test.go
  57. 27 0
      integration-cli/docker_cli_swarm_test.go
  58. 17 3
      libcontainerd/client_linux.go
  59. 9 2
      libcontainerd/container_unix.go
  60. 1 4
      libcontainerd/process_unix.go
  61. 9 1
      man/docker-run.1.md
  62. 1 1
      opts/secret.go
  63. 12 0
      opts/secret_test.go
  64. 7 0
      pkg/plugins/plugin_test.go
  65. 1 7
      pkg/plugins/plugins.go
  66. 7 0
      pkg/plugins/plugins_linux.go
  67. 8 0
      pkg/plugins/plugins_windows.go
  68. 5 5
      pkg/sysinfo/sysinfo_linux.go

+ 1 - 1
Dockerfile

@@ -126,7 +126,7 @@ RUN set -x \
 # IMPORTANT: If the version of Go is updated, the Windows to Linux CI machines
 # IMPORTANT: If the version of Go is updated, the Windows to Linux CI machines
 #            will need updating, to avoid errors. Ping #docker-maintainers on IRC
 #            will need updating, to avoid errors. Ping #docker-maintainers on IRC
 #            with a heads-up.
 #            with a heads-up.
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
 RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
 	| tar -xzC /usr/local
 	| tar -xzC /usr/local
 
 

+ 1 - 1
Dockerfile.aarch64

@@ -97,7 +97,7 @@ RUN set -x \
 # so we use gccgo as bootstrap to build Go from source code.
 # so we use gccgo as bootstrap to build Go from source code.
 # We don't use the official ARMv6 released binaries as a GOROOT_BOOTSTRAP, because
 # 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.
 # not all ARM64 platforms support 32-bit mode. 32-bit mode is optional for ARMv8.
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 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 \
 	&& cd /usr/src/go/src \
 	&& cd /usr/src/go/src \
 	&& GOOS=linux GOARCH=arm64 GOROOT_BOOTSTRAP="$(go env GOROOT)" ./make.bash
 	&& GOOS=linux GOARCH=arm64 GOROOT_BOOTSTRAP="$(go env GOROOT)" ./make.bash

+ 1 - 1
Dockerfile.armhf

@@ -72,7 +72,7 @@ RUN cd /usr/local/lvm2 \
 # See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
 # See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
 
 
 # Install Go
 # Install Go
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" \
 RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" \
 	| tar -xzC /usr/local
 	| tar -xzC /usr/local
 ENV PATH /go/bin:/usr/local/go/bin:$PATH
 ENV PATH /go/bin:/usr/local/go/bin:$PATH

+ 6 - 20
Dockerfile.ppc64le

@@ -15,8 +15,7 @@
 # the case. Therefore, you don't have to disable it anymore.
 # the case. Therefore, you don't have to disable it anymore.
 #
 #
 
 
-# ppc64le/golang is a debian:jessie based image with golang installed
-FROM ppc64le/golang:1.6.3
+FROM ppc64le/debian:jessie
 
 
 # allow replacing httpredir or deb mirror
 # allow replacing httpredir or deb mirror
 ARG APT_MIRROR=deb.debian.org
 ARG APT_MIRROR=deb.debian.org
@@ -95,25 +94,12 @@ RUN set -x \
 
 
 
 
 # Install Go
 # Install Go
-# ppc64le doesn't have official go binaries, so use the version of go installed from the image
-# to build go from source.
-# NOTE: ppc64le has compatibility issues with older versions of go, so make sure the version >= 1.6
-ENV GO_VERSION 1.7.3
-ENV GO_DOWNLOAD_URL https://golang.org/dl/go${GO_VERSION}.src.tar.gz
+# NOTE: official ppc64le go binaries weren't available until go 1.6.4 and 1.7.4
+ENV GO_VERSION 1.7.4
+RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" \
+	| tar -xzC /usr/local
 
 
-RUN set -x \
-	&& TEMPDIR="$(mktemp -d)" \
-	&& mv /usr/local/go $TEMPDIR \
-	&& GOROOT_BOOTSTRAP=$TEMPDIR/go \
-	&& cd /usr/local \
-	&& curl -fsSL "$GO_DOWNLOAD_URL" -o golang.tar.gz \
-	&& tar -C /usr/local -xzf golang.tar.gz \
-	&& rm golang.tar.gz \
-	&& cd go/src && ./make.bash 2>&1 \
-	&& rm -rf $TEMPDIR
-
-ENV GOROOT_BOOTSTRAP /usr/local/go
-ENV PATH /usr/local/go/bin/:$PATH
+ENV PATH /go/bin:/usr/local/go/bin:$PATH
 ENV GOPATH /go
 ENV GOPATH /go
 
 
 # Dependency for golint
 # Dependency for golint

+ 1 - 1
Dockerfile.s390x

@@ -97,7 +97,7 @@ RUN cd /usr/local/lvm2 \
 	&& make install_device-mapper
 	&& make install_device-mapper
 # See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
 # See https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 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" \
 	| tar -xzC /usr/local
 	| tar -xzC /usr/local
 
 

+ 1 - 1
Dockerfile.simple

@@ -55,7 +55,7 @@ RUN set -x \
 # IMPORTANT: If the version of Go is updated, the Windows to Linux CI machines
 # IMPORTANT: If the version of Go is updated, the Windows to Linux CI machines
 #            will need updating, to avoid errors. Ping #docker-maintainers on IRC
 #            will need updating, to avoid errors. Ping #docker-maintainers on IRC
 #            with a heads-up.
 #            with a heads-up.
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
 RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
 	| tar -xzC /usr/local
 	| tar -xzC /usr/local
 ENV PATH /go/bin:/usr/local/go/bin:$PATH
 ENV PATH /go/bin:/usr/local/go/bin:$PATH

+ 2 - 2
Dockerfile.windows

@@ -165,8 +165,8 @@ SHELL ["powershell", "-command"]
 # Environment variable notes:
 # Environment variable notes:
 #  - GO_VERSION must be consistent with 'Dockerfile' used by Linux.
 #  - GO_VERSION must be consistent with 'Dockerfile' used by Linux.
 #  - FROM_DOCKERFILE is used for detection of building within a container.
 #  - FROM_DOCKERFILE is used for detection of building within a container.
-ENV GO_VERSION=1.7.3 `
-    GIT_VERSION=2.10.2 `
+ENV GO_VERSION=1.7.4 `
+    GIT_VERSION=2.11.0 `
     GOPATH=C:\go `
     GOPATH=C:\go `
     FROM_DOCKERFILE=1
     FROM_DOCKERFILE=1
 
 

+ 1 - 1
api/server/router/network/network_routes.go

@@ -163,7 +163,7 @@ func (n *networkRouter) buildNetworkResource(nw libnetwork.Network) *types.Netwo
 	r.Created = info.Created()
 	r.Created = info.Created()
 	r.Scope = info.Scope()
 	r.Scope = info.Scope()
 	if n.clusterProvider.IsManager() {
 	if n.clusterProvider.IsManager() {
-		if _, err := n.clusterProvider.GetNetwork(nw.Name()); err == nil {
+		if _, err := n.clusterProvider.GetNetwork(nw.ID()); err == nil {
 			r.Scope = "swarm"
 			r.Scope = "swarm"
 		}
 		}
 	} else if info.Dynamic() {
 	} else if info.Dynamic() {

+ 6 - 0
cli/command/container/list.go

@@ -74,6 +74,12 @@ func (o listOptionsProcessor) Size() bool {
 	return true
 	return true
 }
 }
 
 
+// Label is needed here as it allows the correct pre-processing
+// because Label() is a method with arguments
+func (o listOptionsProcessor) Label(name string) string {
+	return ""
+}
+
 func buildContainerListOptions(opts *psOptions) (*types.ContainerListOptions, error) {
 func buildContainerListOptions(opts *psOptions) (*types.ContainerListOptions, error) {
 	options := &types.ContainerListOptions{
 	options := &types.ContainerListOptions{
 		All:     opts.all,
 		All:     opts.all,

+ 4 - 1
cli/command/formatter/disk_usage.go

@@ -192,7 +192,10 @@ func (c *diskUsageImagesContext) Reclaimable() string {
 	c.AddHeader(reclaimableHeader)
 	c.AddHeader(reclaimableHeader)
 	for _, i := range c.images {
 	for _, i := range c.images {
 		if i.Containers != 0 {
 		if i.Containers != 0 {
-			used += i.Size
+			if i.VirtualSize == -1 || i.SharedSize == -1 {
+				continue
+			}
+			used += i.VirtualSize - i.SharedSize
 		}
 		}
 	}
 	}
 
 

+ 74 - 18
cli/command/system/inspect.go

@@ -103,22 +103,58 @@ func inspectPlugin(ctx context.Context, dockerCli *command.DockerCli) inspect.Ge
 
 
 func inspectAll(ctx context.Context, dockerCli *command.DockerCli, getSize bool, typeConstraint string) inspect.GetRefFunc {
 func inspectAll(ctx context.Context, dockerCli *command.DockerCli, getSize bool, typeConstraint string) inspect.GetRefFunc {
 	var inspectAutodetect = []struct {
 	var inspectAutodetect = []struct {
-		ObjectType      string
-		IsSizeSupported bool
-		ObjectInspector func(string) (interface{}, []byte, error)
+		objectType      string
+		isSizeSupported bool
+		isSwarmObject   bool
+		objectInspector func(string) (interface{}, []byte, error)
 	}{
 	}{
-		{"container", true, inspectContainers(ctx, dockerCli, getSize)},
-		{"image", false, inspectImages(ctx, dockerCli)},
-		{"network", false, inspectNetwork(ctx, dockerCli)},
-		{"volume", false, inspectVolume(ctx, dockerCli)},
-		{"service", false, inspectService(ctx, dockerCli)},
-		{"task", false, inspectTasks(ctx, dockerCli)},
-		{"node", false, inspectNode(ctx, dockerCli)},
-		{"plugin", false, inspectPlugin(ctx, dockerCli)},
+		{
+			objectType:      "container",
+			isSizeSupported: true,
+			objectInspector: inspectContainers(ctx, dockerCli, getSize),
+		},
+		{
+			objectType:      "image",
+			objectInspector: inspectImages(ctx, dockerCli),
+		},
+		{
+			objectType:      "network",
+			objectInspector: inspectNetwork(ctx, dockerCli),
+		},
+		{
+			objectType:      "volume",
+			objectInspector: inspectVolume(ctx, dockerCli),
+		},
+		{
+			objectType:      "service",
+			isSwarmObject:   true,
+			objectInspector: inspectService(ctx, dockerCli),
+		},
+		{
+			objectType:      "task",
+			isSwarmObject:   true,
+			objectInspector: inspectTasks(ctx, dockerCli),
+		},
+		{
+			objectType:      "node",
+			isSwarmObject:   true,
+			objectInspector: inspectNode(ctx, dockerCli),
+		},
+		{
+			objectType:      "plugin",
+			objectInspector: inspectPlugin(ctx, dockerCli),
+		},
 	}
 	}
 
 
-	isErrNotSwarmManager := func(err error) bool {
-		return strings.Contains(err.Error(), "This node is not a swarm manager")
+	// isSwarmManager does an Info API call to verify that the daemon is
+	// a swarm manager.
+	isSwarmManager := func() bool {
+		info, err := dockerCli.Client().Info(ctx)
+		if err != nil {
+			fmt.Fprintln(dockerCli.Err(), err)
+			return false
+		}
+		return info.Swarm.ControlAvailable
 	}
 	}
 
 
 	isErrNotSupported := func(err error) bool {
 	isErrNotSupported := func(err error) bool {
@@ -126,19 +162,39 @@ func inspectAll(ctx context.Context, dockerCli *command.DockerCli, getSize bool,
 	}
 	}
 
 
 	return func(ref string) (interface{}, []byte, error) {
 	return func(ref string) (interface{}, []byte, error) {
+		const (
+			swarmSupportUnknown = iota
+			swarmSupported
+			swarmUnsupported
+		)
+
+		isSwarmSupported := swarmSupportUnknown
+
 		for _, inspectData := range inspectAutodetect {
 		for _, inspectData := range inspectAutodetect {
-			if typeConstraint != "" && inspectData.ObjectType != typeConstraint {
+			if typeConstraint != "" && inspectData.objectType != typeConstraint {
 				continue
 				continue
 			}
 			}
-			v, raw, err := inspectData.ObjectInspector(ref)
+			if typeConstraint == "" && inspectData.isSwarmObject {
+				if isSwarmSupported == swarmSupportUnknown {
+					if isSwarmManager() {
+						isSwarmSupported = swarmSupported
+					} else {
+						isSwarmSupported = swarmUnsupported
+					}
+				}
+				if isSwarmSupported == swarmUnsupported {
+					continue
+				}
+			}
+			v, raw, err := inspectData.objectInspector(ref)
 			if err != nil {
 			if err != nil {
-				if typeConstraint == "" && (apiclient.IsErrNotFound(err) || isErrNotSwarmManager(err) || isErrNotSupported(err)) {
+				if typeConstraint == "" && (apiclient.IsErrNotFound(err) || isErrNotSupported(err)) {
 					continue
 					continue
 				}
 				}
 				return v, raw, err
 				return v, raw, err
 			}
 			}
-			if getSize && !inspectData.IsSizeSupported {
-				fmt.Fprintf(dockerCli.Err(), "WARNING: --size ignored for %s\n", inspectData.ObjectType)
+			if getSize && !inspectData.isSizeSupported {
+				fmt.Fprintf(dockerCli.Err(), "WARNING: --size ignored for %s\n", inspectData.objectType)
 			}
 			}
 			return v, raw, err
 			return v, raw, err
 		}
 		}

+ 11 - 0
cmd/dockerd/service_windows.go

@@ -13,6 +13,7 @@ import (
 	"unsafe"
 	"unsafe"
 
 
 	"github.com/Sirupsen/logrus"
 	"github.com/Sirupsen/logrus"
+	"github.com/docker/docker/pkg/system"
 	"github.com/spf13/pflag"
 	"github.com/spf13/pflag"
 	"golang.org/x/sys/windows"
 	"golang.org/x/sys/windows"
 	"golang.org/x/sys/windows/svc"
 	"golang.org/x/sys/windows/svc"
@@ -165,10 +166,20 @@ func registerService() error {
 		return err
 		return err
 	}
 	}
 	defer m.Disconnect()
 	defer m.Disconnect()
+
+	depends := []string{}
+
+	// This dependency is required on build 14393 (RS1)
+	// it is added to the platform in newer builds
+	if system.GetOSVersion().Build == 14393 {
+		depends = append(depends, "ConDrv")
+	}
+
 	c := mgr.Config{
 	c := mgr.Config{
 		ServiceType:  windows.SERVICE_WIN32_OWN_PROCESS,
 		ServiceType:  windows.SERVICE_WIN32_OWN_PROCESS,
 		StartType:    mgr.StartAutomatic,
 		StartType:    mgr.StartAutomatic,
 		ErrorControl: mgr.ErrorNormal,
 		ErrorControl: mgr.ErrorNormal,
+		Dependencies: depends,
 		DisplayName:  "Docker Engine",
 		DisplayName:  "Docker Engine",
 	}
 	}
 
 

+ 1 - 1
contrib/builder/deb/aarch64/ubuntu-trusty/Dockerfile

@@ -11,7 +11,7 @@ RUN update-alternatives --install /usr/bin/go go /usr/lib/go-1.6/bin/go 100
 # Install Go
 # Install Go
 # aarch64 doesn't have official go binaries, so use the version of go installed from
 # aarch64 doesn't have official go binaries, so use the version of go installed from
 # the image to build go from source.
 # the image to build go from source.
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 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 \
 	&& cd /usr/src/go/src \
 	&& cd /usr/src/go/src \
 	&& GOOS=linux GOARCH=arm64 GOROOT_BOOTSTRAP="$(go env GOROOT)" ./make.bash
 	&& GOOS=linux GOARCH=arm64 GOROOT_BOOTSTRAP="$(go env GOROOT)" ./make.bash

+ 1 - 1
contrib/builder/deb/aarch64/ubuntu-xenial/Dockerfile

@@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools bu
 # Install Go
 # Install Go
 # aarch64 doesn't have official go binaries, so use the version of go installed from
 # aarch64 doesn't have official go binaries, so use the version of go installed from
 # the image to build go from source.
 # the image to build go from source.
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 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 \
 	&& cd /usr/src/go/src \
 	&& cd /usr/src/go/src \
 	&& GOOS=linux GOARCH=arm64 GOROOT_BOOTSTRAP="$(go env GOROOT)" ./make.bash
 	&& GOOS=linux GOARCH=arm64 GOROOT_BOOTSTRAP="$(go env GOROOT)" ./make.bash

+ 1 - 1
contrib/builder/deb/amd64/debian-jessie/Dockerfile

@@ -10,7 +10,7 @@ RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list
 
 
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev  libsqlite3-dev pkg-config vim-common libsystemd-journal-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev  libsqlite3-dev pkg-config vim-common libsystemd-journal-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/deb/amd64/debian-stretch/Dockerfile

@@ -10,7 +10,7 @@ RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list
 
 
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev libsqlite3-dev pkg-config vim-common libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev libsqlite3-dev pkg-config vim-common libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/deb/amd64/debian-wheezy/Dockerfile

@@ -12,7 +12,7 @@ RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list.d
 RUN apt-get update && apt-get install -y -t wheezy-backports btrfs-tools --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y -t wheezy-backports btrfs-tools --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y apparmor bash-completion  build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev  libsqlite3-dev pkg-config vim-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y apparmor bash-completion  build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev  libsqlite3-dev pkg-config vim-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/deb/amd64/ubuntu-precise/Dockerfile

@@ -6,7 +6,7 @@ FROM ubuntu:precise
 
 
 RUN apt-get update && apt-get install -y apparmor bash-completion  build-essential cmake curl ca-certificates debhelper dh-apparmor  git libapparmor-dev  libltdl-dev  libsqlite3-dev pkg-config vim-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y apparmor bash-completion  build-essential cmake curl ca-certificates debhelper dh-apparmor  git libapparmor-dev  libltdl-dev  libsqlite3-dev pkg-config vim-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/deb/amd64/ubuntu-trusty/Dockerfile

@@ -6,7 +6,7 @@ FROM ubuntu:trusty
 
 
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev  libsqlite3-dev pkg-config vim-common libsystemd-journal-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev  libsqlite3-dev pkg-config vim-common libsystemd-journal-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/deb/amd64/ubuntu-xenial/Dockerfile

@@ -6,7 +6,7 @@ FROM ubuntu:xenial
 
 
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev libsqlite3-dev pkg-config vim-common libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev libsqlite3-dev pkg-config vim-common libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/deb/amd64/ubuntu-yakkety/Dockerfile

@@ -6,7 +6,7 @@ FROM ubuntu:yakkety
 
 
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev libsqlite3-dev pkg-config vim-common libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev libsqlite3-dev pkg-config vim-common libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/deb/armhf/debian-jessie/Dockerfile

@@ -10,7 +10,7 @@ RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list
 
 
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev  libsqlite3-dev pkg-config vim-common libsystemd-journal-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev  libsqlite3-dev pkg-config vim-common libsystemd-journal-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/deb/armhf/raspbian-jessie/Dockerfile

@@ -10,7 +10,7 @@ RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list
 
 
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev  libsqlite3-dev pkg-config vim-common libsystemd-journal-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev  libsqlite3-dev pkg-config vim-common libsystemd-journal-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 # GOARM is the ARM architecture version which is unrelated to the above Golang version
 # GOARM is the ARM architecture version which is unrelated to the above Golang version
 ENV GOARM 6
 ENV GOARM 6
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" | tar xzC /usr/local

+ 1 - 1
contrib/builder/deb/armhf/ubuntu-trusty/Dockerfile

@@ -6,7 +6,7 @@ FROM armhf/ubuntu:trusty
 
 
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev  libsqlite3-dev pkg-config vim-common libsystemd-journal-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev  libsqlite3-dev pkg-config vim-common libsystemd-journal-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/deb/armhf/ubuntu-xenial/Dockerfile

@@ -6,7 +6,7 @@ FROM armhf/ubuntu:xenial
 
 
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev libsqlite3-dev pkg-config vim-common libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev libsqlite3-dev pkg-config vim-common libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/deb/armhf/ubuntu-yakkety/Dockerfile

@@ -6,7 +6,7 @@ FROM armhf/ubuntu:yakkety
 
 
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev libsqlite3-dev pkg-config vim-common libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev libsqlite3-dev pkg-config vim-common libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 28
contrib/builder/deb/ppc64le/generate.sh

@@ -59,22 +59,12 @@ for version in "${versions[@]}"; do
 		vim-common # tini dep
 		vim-common # tini dep
 	)
 	)
 
 
-	# trusty uses a different go package name then xenial and newer, so track that for later
-	goPackage=
 	case "$suite" in
 	case "$suite" in
 		trusty) 
 		trusty) 
-			# ppc64le doesn't have go binaries, so install go to bootstrap go
-			# trusty doesn't have a ppc64le golang-go package
-			packages+=( golang-1.6 )
-			goPackage='golang-1.6'
-
 			packages+=( libsystemd-journal-dev )
 			packages+=( libsystemd-journal-dev )
 			;;
 			;;
 		*)
 		*)
 			# libseccomp isn't available until ubuntu xenial and is required for "seccomp.h" & "libseccomp.so"
 			# libseccomp isn't available until ubuntu xenial and is required for "seccomp.h" & "libseccomp.so"
-			packages+=( golang-go )
-			goPackage='golang-go'
-
 			packages+=( libseccomp-dev )
 			packages+=( libseccomp-dev )
 			packages+=( libsystemd-dev )
 			packages+=( libsystemd-dev )
 			;;
 			;;
@@ -98,25 +88,8 @@ for version in "${versions[@]}"; do
 	echo "RUN apt-get update && apt-get install -y ${packages[*]} --no-install-recommends && rm -rf /var/lib/apt/lists/*" >> "$version/Dockerfile"
 	echo "RUN apt-get update && apt-get install -y ${packages[*]} --no-install-recommends && rm -rf /var/lib/apt/lists/*" >> "$version/Dockerfile"
 	echo >> "$version/Dockerfile"
 	echo >> "$version/Dockerfile"
 
 
-	# ppc64le doesn't have an official downloadable binary as of go 1.6.2. so use the
-	# older packaged go(v1.6.1) to bootstrap latest go, then remove the packaged go
-	echo "# Install Go" >> "$version/Dockerfile"
-	echo "# ppc64le doesn't have official go binaries, so use a distro packaged version of go" >> "$version/Dockerfile"
-	echo "# to build go from source." >> "$version/Dockerfile"
-	echo "# NOTE: ppc64le has compatibility issues with older versions of go, so make sure the version >= 1.6" >> "$version/Dockerfile"
-	
 	awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile.ppc64le >> "$version/Dockerfile"
 	awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile.ppc64le >> "$version/Dockerfile"
-	echo 'ENV GO_DOWNLOAD_URL https://golang.org/dl/go${GO_VERSION}.src.tar.gz' >> "$version/Dockerfile"
-	echo 'ENV GOROOT_BOOTSTRAP /usr/lib/go-1.6' >> "$version/Dockerfile"
-	echo >> "$version/Dockerfile"
-	
-	echo 'RUN curl -fsSL "$GO_DOWNLOAD_URL" -o golang.tar.gz \' >> "$version/Dockerfile"
-	echo '	&& tar -C /usr/local -xzf golang.tar.gz \' >> "$version/Dockerfile"
-	echo '	&& rm golang.tar.gz \' >> "$version/Dockerfile"
-	echo '	&& cd /usr/local/go/src && ./make.bash 2>&1 \' >> "$version/Dockerfile"
-	echo "	&& apt-get purge -y $goPackage && apt-get autoremove -y" >> "$version/Dockerfile"
-	echo >> "$version/Dockerfile"
-
+	echo 'RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile"
 	echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile"
 	echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile"
 	echo >> "$version/Dockerfile"
 	echo >> "$version/Dockerfile"
 
 

+ 3 - 15
contrib/builder/deb/ppc64le/ubuntu-trusty/Dockerfile

@@ -4,22 +4,10 @@
 
 
 FROM ppc64le/ubuntu:trusty
 FROM ppc64le/ubuntu:trusty
 
 
-RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libsqlite3-dev pkg-config vim-common golang-1.6 libsystemd-journal-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
-
-# Install Go
-# ppc64le doesn't have official go binaries, so use a distro packaged version of go
-# to build go from source.
-# NOTE: ppc64le has compatibility issues with older versions of go, so make sure the version >= 1.6
-ENV GO_VERSION 1.7.3
-ENV GO_DOWNLOAD_URL https://golang.org/dl/go${GO_VERSION}.src.tar.gz
-ENV GOROOT_BOOTSTRAP /usr/lib/go-1.6
-
-RUN curl -fsSL "$GO_DOWNLOAD_URL" -o golang.tar.gz \
-	&& tar -C /usr/local -xzf golang.tar.gz \
-	&& rm golang.tar.gz \
-	&& cd /usr/local/go/src && ./make.bash 2>&1 \
-	&& apt-get purge -y golang-1.6 && apt-get autoremove -y
+RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libsqlite3-dev pkg-config vim-common libsystemd-journal-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
+ENV GO_VERSION 1.7.4
+RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 
 ENV AUTO_GOPATH 1
 ENV AUTO_GOPATH 1

+ 3 - 15
contrib/builder/deb/ppc64le/ubuntu-xenial/Dockerfile

@@ -4,22 +4,10 @@
 
 
 FROM ppc64le/ubuntu:xenial
 FROM ppc64le/ubuntu:xenial
 
 
-RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libsqlite3-dev pkg-config vim-common golang-go libseccomp-dev libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
-
-# Install Go
-# ppc64le doesn't have official go binaries, so use a distro packaged version of go
-# to build go from source.
-# NOTE: ppc64le has compatibility issues with older versions of go, so make sure the version >= 1.6
-ENV GO_VERSION 1.7.3
-ENV GO_DOWNLOAD_URL https://golang.org/dl/go${GO_VERSION}.src.tar.gz
-ENV GOROOT_BOOTSTRAP /usr/lib/go-1.6
-
-RUN curl -fsSL "$GO_DOWNLOAD_URL" -o golang.tar.gz \
-	&& tar -C /usr/local -xzf golang.tar.gz \
-	&& rm golang.tar.gz \
-	&& cd /usr/local/go/src && ./make.bash 2>&1 \
-	&& apt-get purge -y golang-go && apt-get autoremove -y
+RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libsqlite3-dev pkg-config vim-common libseccomp-dev libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
+ENV GO_VERSION 1.7.4
+RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 
 ENV AUTO_GOPATH 1
 ENV AUTO_GOPATH 1

+ 3 - 15
contrib/builder/deb/ppc64le/ubuntu-yakkety/Dockerfile

@@ -4,22 +4,10 @@
 
 
 FROM ppc64le/ubuntu:yakkety
 FROM ppc64le/ubuntu:yakkety
 
 
-RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libsqlite3-dev pkg-config vim-common golang-go libseccomp-dev libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
-
-# Install Go
-# ppc64le doesn't have official go binaries, so use a distro packaged version of go
-# to build go from source.
-# NOTE: ppc64le has compatibility issues with older versions of go, so make sure the version >= 1.6
-ENV GO_VERSION 1.7.3
-ENV GO_DOWNLOAD_URL https://golang.org/dl/go${GO_VERSION}.src.tar.gz
-ENV GOROOT_BOOTSTRAP /usr/lib/go-1.6
-
-RUN curl -fsSL "$GO_DOWNLOAD_URL" -o golang.tar.gz \
-	&& tar -C /usr/local -xzf golang.tar.gz \
-	&& rm golang.tar.gz \
-	&& cd /usr/local/go/src && ./make.bash 2>&1 \
-	&& apt-get purge -y golang-go && apt-get autoremove -y
+RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libsqlite3-dev pkg-config vim-common libseccomp-dev libsystemd-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
+ENV GO_VERSION 1.7.4
+RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 
 ENV AUTO_GOPATH 1
 ENV AUTO_GOPATH 1

+ 1 - 1
contrib/builder/deb/s390x/ubuntu-xenial/Dockerfile

@@ -6,7 +6,7 @@ FROM s390x/ubuntu:xenial
 
 
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev libsqlite3-dev pkg-config libsystemd-dev vim-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential cmake curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libseccomp-dev libsqlite3-dev pkg-config libsystemd-dev vim-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/rpm/amd64/centos-7/Dockerfile

@@ -8,7 +8,7 @@ RUN yum groupinstall -y "Development Tools"
 RUN yum -y swap -- remove systemd-container systemd-container-libs -- install systemd systemd-libs
 RUN yum -y swap -- remove systemd-container systemd-container-libs -- install systemd systemd-libs
 RUN yum install -y btrfs-progs-devel device-mapper-devel glibc-static libseccomp-devel libselinux-devel libtool-ltdl-devel pkgconfig selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim-common
 RUN yum install -y btrfs-progs-devel device-mapper-devel glibc-static libseccomp-devel libselinux-devel libtool-ltdl-devel pkgconfig selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim-common
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/rpm/amd64/fedora-24/Dockerfile

@@ -8,7 +8,7 @@ RUN dnf -y upgrade
 RUN dnf install -y @development-tools fedora-packager
 RUN dnf install -y @development-tools fedora-packager
 RUN dnf install -y btrfs-progs-devel device-mapper-devel glibc-static libseccomp-devel libselinux-devel libtool-ltdl-devel pkgconfig selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim-common
 RUN dnf install -y btrfs-progs-devel device-mapper-devel glibc-static libseccomp-devel libselinux-devel libtool-ltdl-devel pkgconfig selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim-common
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/rpm/amd64/fedora-25/Dockerfile

@@ -8,7 +8,7 @@ RUN dnf -y upgrade
 RUN dnf install -y @development-tools fedora-packager
 RUN dnf install -y @development-tools fedora-packager
 RUN dnf install -y btrfs-progs-devel device-mapper-devel glibc-static libseccomp-devel libselinux-devel libtool-ltdl-devel pkgconfig selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim-common
 RUN dnf install -y btrfs-progs-devel device-mapper-devel glibc-static libseccomp-devel libselinux-devel libtool-ltdl-devel pkgconfig selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim-common
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/rpm/amd64/opensuse-13.2/Dockerfile

@@ -7,7 +7,7 @@ FROM opensuse:13.2
 RUN zypper --non-interactive install ca-certificates* curl gzip rpm-build
 RUN zypper --non-interactive install ca-certificates* curl gzip rpm-build
 RUN zypper --non-interactive install libbtrfs-devel device-mapper-devel glibc-static  libselinux-devel libtool-ltdl-devel pkg-config selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim systemd-rpm-macros
 RUN zypper --non-interactive install libbtrfs-devel device-mapper-devel glibc-static  libselinux-devel libtool-ltdl-devel pkg-config selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim systemd-rpm-macros
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/rpm/amd64/oraclelinux-6/Dockerfile

@@ -10,7 +10,7 @@ RUN yum install -y kernel-uek-devel-4.1.12-32.el6uek
 RUN yum groupinstall -y "Development Tools"
 RUN yum groupinstall -y "Development Tools"
 RUN yum install -y btrfs-progs-devel device-mapper-devel glibc-static  libselinux-devel libtool-ltdl-devel pkgconfig selinux-policy selinux-policy-devel sqlite-devel  tar git cmake vim-common
 RUN yum install -y btrfs-progs-devel device-mapper-devel glibc-static  libselinux-devel libtool-ltdl-devel pkgconfig selinux-policy selinux-policy-devel sqlite-devel  tar git cmake vim-common
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/rpm/amd64/oraclelinux-7/Dockerfile

@@ -7,7 +7,7 @@ FROM oraclelinux:7
 RUN yum groupinstall -y "Development Tools"
 RUN yum groupinstall -y "Development Tools"
 RUN yum install -y --enablerepo=ol7_optional_latest btrfs-progs-devel device-mapper-devel glibc-static libseccomp-devel libselinux-devel libtool-ltdl-devel pkgconfig selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim-common
 RUN yum install -y --enablerepo=ol7_optional_latest btrfs-progs-devel device-mapper-devel glibc-static libseccomp-devel libselinux-devel libtool-ltdl-devel pkgconfig selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim-common
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 1 - 1
contrib/builder/rpm/amd64/photon-1.0/Dockerfile

@@ -7,7 +7,7 @@ FROM photon:1.0
 RUN tdnf install -y wget curl ca-certificates gzip make rpm-build sed gcc linux-api-headers glibc-devel binutils libseccomp libltdl-devel elfutils
 RUN tdnf install -y wget curl ca-certificates gzip make rpm-build sed gcc linux-api-headers glibc-devel binutils libseccomp libltdl-devel elfutils
 RUN tdnf install -y btrfs-progs-devel device-mapper-devel glibc-static libseccomp-devel libselinux-devel libtool-ltdl-devel pkg-config selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim-common
 RUN tdnf install -y btrfs-progs-devel device-mapper-devel glibc-static libseccomp-devel libselinux-devel libtool-ltdl-devel pkg-config selinux-policy selinux-policy-devel sqlite-devel systemd-devel tar git cmake vim-common
 
 
-ENV GO_VERSION 1.7.3
+ENV GO_VERSION 1.7.4
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local
 ENV PATH $PATH:/usr/local/go/bin
 ENV PATH $PATH:/usr/local/go/bin
 
 

+ 89 - 35
contrib/completion/bash/docker

@@ -361,18 +361,33 @@ __docker_complete_stacks() {
 # An optional first option `--id|--name` may be used to limit the
 # An optional first option `--id|--name` may be used to limit the
 # output to the IDs or names of matching items. This setting takes
 # output to the IDs or names of matching items. This setting takes
 # precedence over the environment setting.
 # precedence over the environment setting.
+# Completions may be added with `--add`, e.g. `--add self`.
 __docker_nodes() {
 __docker_nodes() {
+	local add=()
 	local fields='$2'  # default: node name only
 	local fields='$2'  # default: node name only
 	[ "${DOCKER_COMPLETION_SHOW_NODE_IDS}" = yes ] && fields='$1,$2' # ID and name
 	[ "${DOCKER_COMPLETION_SHOW_NODE_IDS}" = yes ] && fields='$1,$2' # ID and name
 
 
-	if [ "$1" = "--id" ] ; then
-		fields='$1' # IDs only
-		shift
-	elif [ "$1" = "--name" ] ; then
-		fields='$2' # names only
-		shift
-	fi
-	__docker_q node ls "$@" | tr -d '*' | awk "NR>1 {print $fields}"
+	while true ; do
+		case "$1" in
+			--id)
+				fields='$1' # IDs only
+				shift
+				;;
+			--name)
+				fields='$2' # names only
+				shift
+				;;
+			--add)
+				add+=("$2")
+				shift 2
+				;;
+			*)
+				break
+				;;
+		esac
+	done
+
+	echo $(__docker_q node ls "$@" | tr -d '*' | awk "NR>1 {print $fields}") "${add[@]}"
 }
 }
 
 
 # __docker_complete_nodes applies completion of nodes based on the current
 # __docker_complete_nodes applies completion of nodes based on the current
@@ -388,8 +403,7 @@ __docker_complete_nodes() {
 }
 }
 
 
 __docker_complete_nodes_plus_self() {
 __docker_complete_nodes_plus_self() {
-	__docker_complete_nodes "$@"
-	COMPREPLY+=( self )
+	__docker_complete_nodes --add self "$@"
 }
 }
 
 
 # __docker_services returns a list of all services. Additional options to
 # __docker_services returns a list of all services. Additional options to
@@ -1327,6 +1341,7 @@ _docker_container_run() {
 		--expose
 		--expose
 		--group-add
 		--group-add
 		--hostname -h
 		--hostname -h
+		--init-path
 		--ip
 		--ip
 		--ip6
 		--ip6
 		--ipc
 		--ipc
@@ -1372,6 +1387,7 @@ _docker_container_run() {
 	local boolean_options="
 	local boolean_options="
 		--disable-content-trust=false
 		--disable-content-trust=false
 		--help
 		--help
+		--init
 		--interactive -i
 		--interactive -i
 		--oom-kill-disable
 		--oom-kill-disable
 		--privileged
 		--privileged
@@ -1438,7 +1454,7 @@ _docker_container_run() {
 			__docker_complete_capabilities
 			__docker_complete_capabilities
 			return
 			return
 			;;
 			;;
-		--cidfile|--env-file|--label-file)
+		--cidfile|--env-file|--init-path|--label-file)
 			_filedir
 			_filedir
 			return
 			return
 			;;
 			;;
@@ -1728,6 +1744,7 @@ _docker_daemon() {
 		--experimental
 		--experimental
 		--help
 		--help
 		--icc=false
 		--icc=false
+		--init
 		--ip-forward=false
 		--ip-forward=false
 		--ip-masq=false
 		--ip-masq=false
 		--iptables=false
 		--iptables=false
@@ -2004,6 +2021,7 @@ _docker_image_build() {
 		--quiet -q
 		--quiet -q
 		--rm
 		--rm
 	"
 	"
+	__docker_is_experimental && boolean_options+="--squash"
 
 
 	local all_options="$options_with_args $boolean_options"
 	local all_options="$options_with_args $boolean_options"
 
 
@@ -2683,11 +2701,15 @@ _docker_service_ps() {
 			__docker_complete_services --cur "${cur##*=}" --name
 			__docker_complete_services --cur "${cur##*=}" --name
 			return
 			return
 			;;
 			;;
+		node)
+			__docker_complete_nodes_plus_self --cur "${cur##*=}"
+			return
+			;;
 	esac
 	esac
 
 
 	case "$prev" in
 	case "$prev" in
 		--filter|-f)
 		--filter|-f)
-			COMPREPLY=( $( compgen -W "desired-state id name" -S = -- "$cur" ) )
+			COMPREPLY=( $( compgen -W "desired-state id name node" -S = -- "$cur" ) )
 			__docker_nospace
 			__docker_nospace
 			return
 			return
 			;;
 			;;
@@ -2727,7 +2749,6 @@ _docker_service_update() {
 		--mount
 		--mount
 		--network
 		--network
 		--no-healthcheck
 		--no-healthcheck
-		--publish -p
 		--replicas
 		--replicas
 		--reserve-cpu
 		--reserve-cpu
 		--reserve-memory
 		--reserve-memory
@@ -2765,7 +2786,7 @@ _docker_service_update() {
 			--host
 			--host
 			--mode
 			--mode
 			--name
 			--name
-			--publish
+			--publish -p
 			--secret
 			--secret
 		"
 		"
 
 
@@ -2907,6 +2928,8 @@ _docker_swarm() {
 		join
 		join
 		join-token
 		join-token
 		leave
 		leave
+		unlock
+		unlock-key
 		update
 		update
 	"
 	"
 	__docker_subcommands "$subcommands" && return
 	__docker_subcommands "$subcommands" && return
@@ -2932,6 +2955,13 @@ _docker_swarm_init() {
 			fi
 			fi
 			return
 			return
 			;;
 			;;
+		--availability)
+			COMPREPLY=( $( compgen -W "active drain pause" -- "$cur" ) )
+			return
+			;;
+		--cert-expiry|--dispatcher-heartbeat|--external-ca|--max-snapshots|--snapshot-interval|--task-history-limit)
+			return
+			;;
 		--listen-addr)
 		--listen-addr)
 			if [[ $cur == *: ]] ; then
 			if [[ $cur == *: ]] ; then
 				COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )
 				COMPREPLY=( $( compgen -W "2377" -- "${cur##*:}" ) )
@@ -2945,7 +2975,7 @@ _docker_swarm_init() {
 
 
 	case "$cur" in
 	case "$cur" in
 		-*)
 		-*)
-			COMPREPLY=( $( compgen -W "--advertise-addr --force-new-cluster --help --listen-addr" -- "$cur" ) )
+			COMPREPLY=( $( compgen -W "--advertise-addr --autolock --availability --cert-expiry --dispatcher-heartbeat --external-ca --force-new-cluster --help --listen-addr --max-snapshots --snapshot-interval --task-history-limit" -- "$cur" ) )
 			;;
 			;;
 	esac
 	esac
 }
 }
@@ -3007,16 +3037,32 @@ _docker_swarm_leave() {
 	esac
 	esac
 }
 }
 
 
+_docker_swarm_unlock() {
+	case "$cur" in
+		-*)
+			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
+			;;
+	esac
+}
+
+_docker_swarm_unlock-key() {
+	case "$cur" in
+		-*)
+			COMPREPLY=( $( compgen -W "--help --quiet -q --rotate" -- "$cur" ) )
+			;;
+	esac
+}
+
 _docker_swarm_update() {
 _docker_swarm_update() {
 	case "$prev" in
 	case "$prev" in
-		--cert-expiry|--dispatcher-heartbeat|--max-snapshots|--snapshot-interval|--task-history-limit)
+		--cert-expiry|--dispatcher-heartbeat|--external-ca|--max-snapshots|--snapshot-interval|--task-history-limit)
 			return
 			return
 			;;
 			;;
 	esac
 	esac
 
 
 	case "$cur" in
 	case "$cur" in
 		-*)
 		-*)
-			COMPREPLY=( $( compgen -W "--cert-expiry --dispatcher-heartbeat --help --max-snapshots --snapshot-interval --task-history-limit" -- "$cur" ) )
+			COMPREPLY=( $( compgen -W "--autolock --cert-expiry --dispatcher-heartbeat --external-ca --help --max-snapshots --snapshot-interval --task-history-limit" -- "$cur" ) )
 			;;
 			;;
 	esac
 	esac
 }
 }
@@ -3289,7 +3335,7 @@ _docker_plugin_install() {
 
 
 	case "$cur" in
 	case "$cur" in
 		-*)
 		-*)
-			COMPREPLY=( $( compgen -W "--alias --disable --grant-all-permissions --help" -- "$cur" ) )
+			COMPREPLY=( $( compgen -W "--alias --disable --disable-content-trust=false --grant-all-permissions --help" -- "$cur" ) )
 			;;
 			;;
 	esac
 	esac
 }
 }
@@ -3969,11 +4015,30 @@ _docker() {
 	local previous_extglob_setting=$(shopt -p extglob)
 	local previous_extglob_setting=$(shopt -p extglob)
 	shopt -s extglob
 	shopt -s extglob
 
 
-	local commands=(
-		attach
+	local management_commands=(
+		container
+		image
+		network
+		node
+		plugin
+		secret
+		service
+		stack
+		system
+		volume
+	)
+
+	local top_level_commands=(
 		build
 		build
+		login
+		logout
+		run
+		search
+		version
+	)
+
+	local legacy_commands=(
 		commit
 		commit
-		container
 		cp
 		cp
 		create
 		create
 		diff
 		diff
@@ -3981,20 +4046,14 @@ _docker() {
 		exec
 		exec
 		export
 		export
 		history
 		history
-		image
 		images
 		images
 		import
 		import
 		info
 		info
 		inspect
 		inspect
 		kill
 		kill
 		load
 		load
-		login
-		logout
 		logs
 		logs
-		network
-		node
 		pause
 		pause
-		plugin
 		port
 		port
 		ps
 		ps
 		pull
 		pull
@@ -4003,23 +4062,15 @@ _docker() {
 		restart
 		restart
 		rm
 		rm
 		rmi
 		rmi
-		run
 		save
 		save
-		search
-		secret
-		service
-		stack
 		start
 		start
 		stats
 		stats
 		stop
 		stop
 		swarm
 		swarm
-		system
 		tag
 		tag
 		top
 		top
 		unpause
 		unpause
 		update
 		update
-		version
-		volume
 		wait
 		wait
 	)
 	)
 
 
@@ -4027,6 +4078,9 @@ _docker() {
 		deploy
 		deploy
 	)
 	)
 
 
+	local commands=(${management_commands[*]} ${top_level_commands[*]})
+	[ -z "$DOCKER_HIDE_LEGACY_COMMANDS" ] && commands+=(${legacy_commands[*]})
+
 	# These options are valid as global options for all client commands
 	# These options are valid as global options for all client commands
 	# and valid as command options for `docker daemon`
 	# and valid as command options for `docker daemon`
 	local global_boolean_options="
 	local global_boolean_options="

+ 40 - 7
contrib/completion/zsh/_docker

@@ -474,6 +474,26 @@ __docker_complete_events_filter() {
     return ret
     return ret
 }
 }
 
 
+__docker_complete_prune_filters() {
+    [[ $PREFIX = -* ]] && return 1
+    integer ret=1
+    declare -a opts
+
+    opts=('until')
+
+    if compset -P '*='; then
+        case "${${words[-1]%=*}#*=}" in
+            *)
+                _message 'value' && ret=0
+                ;;
+        esac
+    else
+        _describe -t filter-opts "filter options" opts -qS "=" && ret=0
+    fi
+
+    return ret
+}
+
 # BO container
 # BO container
 
 
 __docker_container_commands() {
 __docker_container_commands() {
@@ -541,6 +561,7 @@ __docker_container_subcommand() {
         "($help)*--group=[Set one or more supplementary user groups for the container]:group:_groups"
         "($help)*--group=[Set one or more supplementary user groups for the container]:group:_groups"
         "($help -h --hostname)"{-h=,--hostname=}"[Container host name]:hostname:_hosts"
         "($help -h --hostname)"{-h=,--hostname=}"[Container host name]:hostname:_hosts"
         "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]"
         "($help -i --interactive)"{-i,--interactive}"[Keep stdin open even if not attached]"
+        "($help)--init[Run an init inside the container that forwards signals and reaps processes]"
         "($help)--ip=[Container IPv4 address]:IPv4: "
         "($help)--ip=[Container IPv4 address]:IPv4: "
         "($help)--ip6=[Container IPv6 address]:IPv6: "
         "($help)--ip6=[Container IPv6 address]:IPv6: "
         "($help)--ipc=[IPC namespace to use]:IPC namespace: "
         "($help)--ipc=[IPC namespace to use]:IPC namespace: "
@@ -731,6 +752,7 @@ __docker_container_subcommand() {
         (prune)
         (prune)
             _arguments $(__docker_arguments) \
             _arguments $(__docker_arguments) \
                 $opts_help \
                 $opts_help \
+                "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \
                 "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0
                 "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0
             ;;
             ;;
         (rename)
         (rename)
@@ -977,6 +999,7 @@ __docker_image_subcommand() {
             _arguments $(__docker_arguments) \
             _arguments $(__docker_arguments) \
                 $opts_help \
                 $opts_help \
                 "($help -a --all)"{-a,--all}"[Remove all unused images, not just dangling ones]" \
                 "($help -a --all)"{-a,--all}"[Remove all unused images, not just dangling ones]" \
+                "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \
                 "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0
                 "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0
             ;;
             ;;
         (pull)
         (pull)
@@ -1204,6 +1227,7 @@ __docker_network_subcommand() {
         (prune)
         (prune)
             _arguments $(__docker_arguments) \
             _arguments $(__docker_arguments) \
                 $opts_help \
                 $opts_help \
+                "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \
                 "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0
                 "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0
             ;;
             ;;
         (rm)
         (rm)
@@ -1497,9 +1521,15 @@ __docker_plugin_subcommand() {
     opts_help=("(: -)--help[Print usage]")
     opts_help=("(: -)--help[Print usage]")
 
 
     case "$words[1]" in
     case "$words[1]" in
-        (disable|enable|inspect|install|ls|push|rm)
+        (disable|enable|inspect|ls|push|rm)
+            _arguments $(__docker_arguments) \
+                $opts_help \
+                "($help -)1:plugin:__docker_complete_plugins" && ret=0
+            ;;
+        (install)
             _arguments $(__docker_arguments) \
             _arguments $(__docker_arguments) \
                 $opts_help \
                 $opts_help \
+                "($help)--alias=[Local name for plugin]:alias: " \
                 "($help -)1:plugin:__docker_complete_plugins" && ret=0
                 "($help -)1:plugin:__docker_complete_plugins" && ret=0
             ;;
             ;;
         (set)
         (set)
@@ -1588,7 +1618,7 @@ __docker_secret_subcommand() {
 
 
     case "$words[1]" in
     case "$words[1]" in
         (create)
         (create)
-            _arguments $(__docker_arguments) \
+            _arguments $(__docker_arguments) -A '-*' \
                 $opts_help \
                 $opts_help \
                 "($help)*"{-l=,--label=}"[Secret labels]:label: " \
                 "($help)*"{-l=,--label=}"[Secret labels]:label: " \
                 "($help -):secret: " && ret=0
                 "($help -):secret: " && ret=0
@@ -2060,9 +2090,10 @@ __docker_swarm_subcommand() {
                 "($help)--task-history-limit=[Task history retention limit]:limit: " && ret=0
                 "($help)--task-history-limit=[Task history retention limit]:limit: " && ret=0
             ;;
             ;;
         (join)
         (join)
-            _arguments $(__docker_arguments) \
+            _arguments $(__docker_arguments) -A '-*' \
                 $opts_help \
                 $opts_help \
-                "($help)--advertise-addr[Advertised address]:ip\:port: " \
+                "($help)--advertise-addr=[Advertised address]:ip\:port: " \
+                "($help)--availability=[Availability of the node]:availability:(active drain pause)" \
                 "($help)--listen-addr=[Listen address]:ip\:port: " \
                 "($help)--listen-addr=[Listen address]:ip\:port: " \
                 "($help)--token=[Token for entry into the swarm]:secret: " \
                 "($help)--token=[Token for entry into the swarm]:secret: " \
                 "($help -):host\:port: " && ret=0
                 "($help -):host\:port: " && ret=0
@@ -2142,6 +2173,7 @@ __docker_system_subcommand() {
             _arguments $(__docker_arguments) \
             _arguments $(__docker_arguments) \
                 $opts_help \
                 $opts_help \
                 "($help -a --all)"{-a,--all}"[Remove all unused data, not just dangling ones]" \
                 "($help -a --all)"{-a,--all}"[Remove all unused data, not just dangling ones]" \
+                "($help)*--filter=[Filter values]:filter:__docker_complete_prune_filters" \
                 "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0
                 "($help -f --force)"{-f,--force}"[Do not prompt for confirmation]" && ret=0
             ;;
             ;;
         (help)
         (help)
@@ -2370,6 +2402,7 @@ __docker_subcommand() {
                 "($help -g --graph)"{-g=,--graph=}"[Root of the Docker runtime]:path:_directories" \
                 "($help -g --graph)"{-g=,--graph=}"[Root of the Docker runtime]:path:_directories" \
                 "($help -H --host)"{-H=,--host=}"[tcp://host:port to bind/connect to]:host: " \
                 "($help -H --host)"{-H=,--host=}"[tcp://host:port to bind/connect to]:host: " \
                 "($help)--icc[Enable inter-container communication]" \
                 "($help)--icc[Enable inter-container communication]" \
+                "($help)--init[Run an init inside containers to forward signals and reap processes]" \
                 "($help)--init-path=[Path to the docker-init binary]:docker-init binary:_files" \
                 "($help)--init-path=[Path to the docker-init binary]:docker-init binary:_files" \
                 "($help)*--insecure-registry=[Enable insecure registry communication]:registry: " \
                 "($help)*--insecure-registry=[Enable insecure registry communication]:registry: " \
                 "($help)--ip=[Default IP when binding container ports]" \
                 "($help)--ip=[Default IP when binding container ports]" \
@@ -2492,14 +2525,14 @@ __docker_subcommand() {
             esac
             esac
             ;;
             ;;
         (login)
         (login)
-            _arguments $(__docker_arguments) \
+            _arguments $(__docker_arguments) -A '-*' \
                 $opts_help \
                 $opts_help \
                 "($help -p --password)"{-p=,--password=}"[Password]:password: " \
                 "($help -p --password)"{-p=,--password=}"[Password]:password: " \
                 "($help -u --user)"{-u=,--user=}"[Username]:username: " \
                 "($help -u --user)"{-u=,--user=}"[Username]:username: " \
                 "($help -)1:server: " && ret=0
                 "($help -)1:server: " && ret=0
             ;;
             ;;
         (logout)
         (logout)
-            _arguments $(__docker_arguments) \
+            _arguments $(__docker_arguments) -A '-*' \
                 $opts_help \
                 $opts_help \
                 "($help -)1:server: " && ret=0
                 "($help -)1:server: " && ret=0
             ;;
             ;;
@@ -2563,7 +2596,7 @@ __docker_subcommand() {
             __docker_image_subcommand && ret=0
             __docker_image_subcommand && ret=0
             ;;
             ;;
         (search)
         (search)
-            _arguments $(__docker_arguments) \
+            _arguments $(__docker_arguments) -A '-*' \
                 $opts_help \
                 $opts_help \
                 "($help)*"{-f=,--filter=}"[Filter values]:filter:->filter-options" \
                 "($help)*"{-f=,--filter=}"[Filter values]:filter:->filter-options" \
                 "($help)--limit=[Maximum returned search results]:limit:(1 5 10 25 50)" \
                 "($help)--limit=[Maximum returned search results]:limit:(1 5 10 25 50)" \

+ 3 - 2
daemon/cluster/cluster.go

@@ -352,7 +352,7 @@ func (c *Cluster) startNewNode(conf nodeStartConfig) (*node, error) {
 	c.actualLocalAddr = actualLocalAddr // not saved
 	c.actualLocalAddr = actualLocalAddr // not saved
 	c.saveState(conf)
 	c.saveState(conf)
 
 
-	c.config.Backend.SetClusterProvider(c)
+	c.config.Backend.DaemonJoinsCluster(c)
 	go func() {
 	go func() {
 		err := detectLockedError(n.Err(ctx))
 		err := detectLockedError(n.Err(ctx))
 		if err != nil {
 		if err != nil {
@@ -725,6 +725,7 @@ func (c *Cluster) Leave(force bool) error {
 	if err := c.clearState(); err != nil {
 	if err := c.clearState(); err != nil {
 		return err
 		return err
 	}
 	}
+
 	return nil
 	return nil
 }
 }
 
 
@@ -752,7 +753,7 @@ func (c *Cluster) clearState() error {
 	if err := os.MkdirAll(c.root, 0700); err != nil {
 	if err := os.MkdirAll(c.root, 0700); err != nil {
 		return err
 		return err
 	}
 	}
-	c.config.Backend.SetClusterProvider(nil)
+	c.config.Backend.DaemonLeavesCluster()
 	return nil
 	return nil
 }
 }
 
 

+ 2 - 1
daemon/cluster/executor/backend.go

@@ -47,7 +47,8 @@ type Backend interface {
 	VolumeCreate(name, driverName string, opts, labels map[string]string) (*types.Volume, error)
 	VolumeCreate(name, driverName string, opts, labels map[string]string) (*types.Volume, error)
 	Containers(config *types.ContainerListOptions) ([]*types.Container, error)
 	Containers(config *types.ContainerListOptions) ([]*types.Container, error)
 	SetNetworkBootstrapKeys([]*networktypes.EncryptionKey) error
 	SetNetworkBootstrapKeys([]*networktypes.EncryptionKey) error
-	SetClusterProvider(provider cluster.Provider)
+	DaemonJoinsCluster(provider cluster.Provider)
+	DaemonLeavesCluster()
 	IsSwarmCompatible() error
 	IsSwarmCompatible() error
 	SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan interface{})
 	SubscribeToEvents(since, until time.Time, filter filters.Args) ([]events.Message, chan interface{})
 	UnsubscribeFromEvents(listener chan interface{})
 	UnsubscribeFromEvents(listener chan interface{})

+ 16 - 2
daemon/daemon.go

@@ -446,8 +446,22 @@ func (daemon *Daemon) registerLink(parent, child *container.Container, alias str
 	return nil
 	return nil
 }
 }
 
 
-// SetClusterProvider sets a component for querying the current cluster state.
-func (daemon *Daemon) SetClusterProvider(clusterProvider cluster.Provider) {
+// DaemonJoinsCluster informs the daemon has joined the cluster and provides
+// the handler to query the cluster component
+func (daemon *Daemon) DaemonJoinsCluster(clusterProvider cluster.Provider) {
+	daemon.setClusterProvider(clusterProvider)
+}
+
+// DaemonLeavesCluster informs the daemon has left the cluster
+func (daemon *Daemon) DaemonLeavesCluster() {
+	// Daemon is in charge of removing the attachable networks with
+	// connected containers when the node leaves the swarm
+	daemon.clearAttachableNetworks()
+	daemon.setClusterProvider(nil)
+}
+
+// setClusterProvider sets a component for querying the current cluster state.
+func (daemon *Daemon) setClusterProvider(clusterProvider cluster.Provider) {
 	daemon.clusterProvider = clusterProvider
 	daemon.clusterProvider = clusterProvider
 	// call this in a goroutine to allow netcontroller handle this event async
 	// call this in a goroutine to allow netcontroller handle this event async
 	// and not block if it is in the middle of talking with cluster
 	// and not block if it is in the middle of talking with cluster

+ 13 - 4
daemon/daemon_unix.go

@@ -1190,6 +1190,12 @@ func (daemon *Daemon) initCgroupsPath(path string) error {
 		return nil
 		return nil
 	}
 	}
 
 
+	if daemon.configStore.CPURealtimePeriod == 0 && daemon.configStore.CPURealtimeRuntime == 0 {
+		return nil
+	}
+
+	// Recursively create cgroup to ensure that the system and all parent cgroups have values set
+	// for the period and runtime as this limits what the children can be set to.
 	daemon.initCgroupsPath(filepath.Dir(path))
 	daemon.initCgroupsPath(filepath.Dir(path))
 
 
 	_, root, err := cgroups.FindCgroupMountpointAndRoot("cpu")
 	_, root, err := cgroups.FindCgroupMountpointAndRoot("cpu")
@@ -1198,16 +1204,19 @@ func (daemon *Daemon) initCgroupsPath(path string) error {
 	}
 	}
 
 
 	path = filepath.Join(root, path)
 	path = filepath.Join(root, path)
-	sysinfo := sysinfo.New(false)
-	if err := os.MkdirAll(path, 0755); err != nil && !os.IsExist(err) {
-		return err
-	}
+	sysinfo := sysinfo.New(true)
 	if sysinfo.CPURealtimePeriod && daemon.configStore.CPURealtimePeriod != 0 {
 	if sysinfo.CPURealtimePeriod && daemon.configStore.CPURealtimePeriod != 0 {
+		if err := os.MkdirAll(path, 0755); err != nil && !os.IsExist(err) {
+			return err
+		}
 		if err := ioutil.WriteFile(filepath.Join(path, "cpu.rt_period_us"), []byte(strconv.FormatInt(daemon.configStore.CPURealtimePeriod, 10)), 0700); err != nil {
 		if err := ioutil.WriteFile(filepath.Join(path, "cpu.rt_period_us"), []byte(strconv.FormatInt(daemon.configStore.CPURealtimePeriod, 10)), 0700); err != nil {
 			return err
 			return err
 		}
 		}
 	}
 	}
 	if sysinfo.CPURealtimeRuntime && daemon.configStore.CPURealtimeRuntime != 0 {
 	if sysinfo.CPURealtimeRuntime && daemon.configStore.CPURealtimeRuntime != 0 {
+		if err := os.MkdirAll(path, 0755); err != nil && !os.IsExist(err) {
+			return err
+		}
 		if err := ioutil.WriteFile(filepath.Join(path, "cpu.rt_runtime_us"), []byte(strconv.FormatInt(daemon.configStore.CPURealtimeRuntime, 10)), 0700); err != nil {
 		if err := ioutil.WriteFile(filepath.Join(path, "cpu.rt_runtime_us"), []byte(strconv.FormatInt(daemon.configStore.CPURealtimeRuntime, 10)), 0700); err != nil {
 			return err
 			return err
 		}
 		}

+ 1 - 1
daemon/images.go

@@ -205,7 +205,7 @@ func (daemon *Daemon) Images(imageFilters filters.Args, all bool, withExtraAttrs
 	}
 	}
 
 
 	if withExtraAttrs {
 	if withExtraAttrs {
-		// Get Shared and Unique sizes
+		// Get Shared sizes
 		for img, newImage := range imagesMap {
 		for img, newImage := range imagesMap {
 			rootFS := *img.RootFS
 			rootFS := *img.RootFS
 			rootFS.DiffIDs = nil
 			rootFS.DiffIDs = nil

+ 28 - 0
daemon/network.go

@@ -468,3 +468,31 @@ func (daemon *Daemon) deleteNetwork(networkID string, dynamic bool) error {
 func (daemon *Daemon) GetNetworks() []libnetwork.Network {
 func (daemon *Daemon) GetNetworks() []libnetwork.Network {
 	return daemon.getAllNetworks()
 	return daemon.getAllNetworks()
 }
 }
+
+// clearAttachableNetworks removes the attachable networks
+// after disconnecting any connected container
+func (daemon *Daemon) clearAttachableNetworks() {
+	for _, n := range daemon.GetNetworks() {
+		if !n.Info().Attachable() {
+			continue
+		}
+		for _, ep := range n.Endpoints() {
+			epInfo := ep.Info()
+			if epInfo == nil {
+				continue
+			}
+			sb := epInfo.Sandbox()
+			if sb == nil {
+				continue
+			}
+			containerID := sb.ContainerID()
+			if err := daemon.DisconnectContainerFromNetwork(containerID, n.ID(), true); err != nil {
+				logrus.Warnf("Failed to disconnect container %s from swarm network %s on cluster leave: %v",
+					containerID, n.Name(), err)
+			}
+		}
+		if err := daemon.DeleteManagedNetwork(n.ID()); err != nil {
+			logrus.Warnf("Failed to remove swarm network %s on cluster leave: %v", n.Name(), err)
+		}
+	}
+}

+ 1 - 1
daemon/oci_linux.go

@@ -581,7 +581,7 @@ func (daemon *Daemon) populateCommonSpec(s *specs.Spec, c *container.Container)
 	if c.HostConfig.PidMode.IsPrivate() {
 	if c.HostConfig.PidMode.IsPrivate() {
 		if (c.HostConfig.Init != nil && *c.HostConfig.Init) ||
 		if (c.HostConfig.Init != nil && *c.HostConfig.Init) ||
 			(c.HostConfig.Init == nil && daemon.configStore.Init) {
 			(c.HostConfig.Init == nil && daemon.configStore.Init) {
-			s.Process.Args = append([]string{"/dev/init", c.Path}, c.Args...)
+			s.Process.Args = append([]string{"/dev/init", "--", c.Path}, c.Args...)
 			var path string
 			var path string
 			if daemon.configStore.InitPath == "" && c.HostConfig.InitPath == "" {
 			if daemon.configStore.InitPath == "" && c.HostConfig.InitPath == "" {
 				path, err = exec.LookPath(DefaultInitBinary)
 				path, err = exec.LookPath(DefaultInitBinary)

+ 4 - 0
distribution/registry.go

@@ -23,7 +23,11 @@ import (
 var ImageTypes = []string{
 var ImageTypes = []string{
 	schema2.MediaTypeImageConfig,
 	schema2.MediaTypeImageConfig,
 	// Handle unexpected values from https://github.com/docker/distribution/issues/1621
 	// Handle unexpected values from https://github.com/docker/distribution/issues/1621
+	// (see also https://github.com/docker/docker/issues/22378,
+	// https://github.com/docker/docker/issues/30083)
 	"application/octet-stream",
 	"application/octet-stream",
+	"application/json",
+	"text/html",
 	// Treat defaulted values as images, newer types cannot be implied
 	// Treat defaulted values as images, newer types cannot be implied
 	"",
 	"",
 }
 }

+ 164 - 0
docs/extend/EBS_volume.md

@@ -0,0 +1,164 @@
+---
+description: Volume plugin for Amazon EBS
+keywords: "API, Usage, plugins, documentation, developer, amazon, ebs, rexray, volume"
+title: Volume plugin for Amazon EBS
+---
+
+<!-- This file is maintained within the docker/docker Github
+     repository at https://github.com/docker/docker/. Make all
+     pull requests against that repo. If you see this file in
+     another repository, consider it read-only there, as it will
+     periodically be overwritten by the definitive file. Pull
+     requests which include edits to this file in other repositories
+     will be rejected.
+-->
+
+# A proof-of-concept Rexray plugin
+
+In this example, a simple Rexray plugin will be created for the purposes of using
+it on an Amazon EC2 instance with EBS. It is not meant to be a complete Rexray plugin.
+
+The example source is available at [https://github.com/tiborvass/rexray-plugin](https://github.com/tiborvass/rexray-plugin).
+
+To learn more about Rexray: [https://github.com/codedellemc/rexray](https://github.com/codedellemc/rexray)
+
+## 1. Make a Docker image
+
+The following is the Dockerfile used to containerize rexray.
+
+```Dockerfile
+FROM debian:jessie
+RUN apt-get update && apt-get install -y --no-install-recommends wget ca-certificates
+RUN wget https://dl.bintray.com/emccode/rexray/stable/0.6.4/rexray-Linux-x86_64-0.6.4.tar.gz -O rexray.tar.gz && tar -xvzf rexray.tar.gz -C /usr/bin && rm rexray.tar.gz
+RUN mkdir -p /run/docker/plugins /var/lib/libstorage/volumes
+ENTRYPOINT ["rexray"]
+CMD ["--help"]
+```
+
+To build it you can run `image=$(cat Dockerfile | docker build -q -)` and `$image`
+will reference the containerized rexray image.
+
+## 2. Extract rootfs
+
+```sh
+$ TMPDIR=/tmp/rexray  # for the purpose of this example
+$  # create container without running it, to extract the rootfs from image
+$ docker create --name rexray "$image"
+$  # save the rootfs to a tar archive
+$ docker export -o $TMPDIR/rexray.tar rexray
+$  # extract rootfs from tar archive to a rootfs folder
+$ ( mkdir -p $TMPDIR/rootfs; cd $TMPDIR/rootfs; tar xf ../rexray.tar )
+```
+
+## 3. Add plugin configuration
+
+We have to put the following JSON to `$TMPDIR/config.json`:
+
+```json
+{
+      "Args": {
+        "Description": "",
+        "Name": "",
+        "Settable": null,
+        "Value": null
+      },
+      "Description": "A proof-of-concept EBS plugin (using rexray) for Docker",
+      "Documentation": "https://github.com/tiborvass/rexray-plugin",
+      "Entrypoint": [
+        "/usr/bin/rexray", "service", "start", "-f"
+      ],
+      "Env": [
+        {
+          "Description": "",
+          "Name": "REXRAY_SERVICE",
+          "Settable": [
+            "value"
+          ],
+          "Value": "ebs"
+        },
+        {
+          "Description": "",
+          "Name": "EBS_ACCESSKEY",
+          "Settable": [
+            "value"
+          ],
+          "Value": ""
+        },
+        {
+          "Description": "",
+          "Name": "EBS_SECRETKEY",
+          "Settable": [
+            "value"
+          ],
+          "Value": ""
+        }
+      ],
+      "Interface": {
+        "Socket": "rexray.sock",
+        "Types": [
+          "docker.volumedriver/1.0"
+        ]
+      },
+      "Linux": {
+        "AllowAllDevices": true,
+        "Capabilities": ["CAP_SYS_ADMIN"],
+        "Devices": null
+      },
+      "Mounts": [
+        {
+          "Source": "/dev",
+          "Destination": "/dev",
+          "Type": "bind",
+          "Options": ["rbind"]
+        }
+      ],
+      "Network": {
+        "Type": "host"
+      },
+      "PropagatedMount": "/var/lib/libstorage/volumes",
+      "User": {},
+      "WorkDir": ""
+}
+```
+
+Please note a couple of points:
+- `PropagatedMount` is needed so that the docker daemon can see mounts done by the
+rexray plugin from within the container, otherwise the docker daemon is not able
+to mount a docker volume.
+- The rexray plugin needs dynamic access to host devices. For that reason, we
+have to give it access to all devices under `/dev` and set `AllowAllDevices` to
+true for proper access.
+- The user of this simple plugin can change only 3 settings: `REXRAY_SERVICE`,
+`EBS_ACCESSKEY` and `EBS_SECRETKEY`. This is because of the reduced scope of this
+plugin. Ideally other rexray parameters could also be set.
+
+## 4. Create plugin
+
+`docker plugin create tiborvass/rexray-plugin "$TMPDIR"` will create the plugin.
+
+```sh
+$ docker plugin ls
+ID                  NAME                             DESCRIPTION                         ENABLED
+2475a4bd0ca5        tiborvass/rexray-plugin:latest   A rexray volume plugin for Docker   false
+```
+
+## 5. Test plugin
+
+```sh
+$ docker plugin set tiborvass/rexray-plugin EBS_ACCESSKEY=$AWS_ACCESSKEY EBS_SECRETKEY=$AWS_SECRETKEY`
+$ docker plugin enable tiborvass/rexray-plugin
+$ docker volume create -d tiborvass/rexray-plugin my-ebs-volume
+$ docker volume ls
+DRIVER                              VOLUME NAME
+tiborvass/rexray-plugin:latest      my-ebs-volume
+$ docker run --rm -v my-ebs-volume:/volume busybox sh -c 'echo bye > /volume/hi'
+$ docker run --rm -v my-ebs-volume:/volume busybox cat /volume/hi
+bye
+```
+
+## 6. Push plugin
+
+First, ensure you are logged in with `docker login`. Then you can run:
+`docker plugin push tiborvass/rexray-plugin` to push it like a regular docker
+image to a registry, to make it available for others to install via
+`docker plugin install tiborvass/rexray-plugin EBS_ACCESSKEY=$AWS_ACCESSKEY EBS_SECRETKEY=$AWS_SECRETKEY`.

+ 2 - 2
docs/extend/index.md

@@ -154,7 +154,7 @@ This plugin is a volume driver. It requires a `host` network and the
 entrypoint and uses the `/run/docker/plugins/sshfs.sock` socket to communicate
 entrypoint and uses the `/run/docker/plugins/sshfs.sock` socket to communicate
 with Docker Engine. This plugin has no runtime parameters.
 with Docker Engine. This plugin has no runtime parameters.
 
 
-### Creating the plugin
+#### Creating the plugin
 
 
 A new plugin can be created by running
 A new plugin can be created by running
 `docker plugin create <plugin-name> ./path/to/plugin/data` where the plugin
 `docker plugin create <plugin-name> ./path/to/plugin/data` where the plugin
@@ -163,4 +163,4 @@ in subdirectory `rootfs`.
 
 
 After that the plugin `<plugin-name>` will show up in `docker plugin ls`.
 After that the plugin `<plugin-name>` will show up in `docker plugin ls`.
 Plugins can be pushed to remote registries with
 Plugins can be pushed to remote registries with
-`docker plugin push <plugin-name>`.
+`docker plugin push <plugin-name>`.

+ 2 - 0
docs/reference/commandline/create.md

@@ -63,6 +63,8 @@ Options:
       --health-timeout duration     Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
       --health-timeout duration     Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
       --help                        Print usage
       --help                        Print usage
   -h, --hostname string             Container host name
   -h, --hostname string             Container host name
+      --init                        Run an init inside the container that forwards signals and reaps processes
+      --init-path string            Path to the docker-init binary
   -i, --interactive                 Keep STDIN open even if not attached
   -i, --interactive                 Keep STDIN open even if not attached
       --io-maxbandwidth string      Maximum IO bandwidth limit for the system drive (Windows only)
       --io-maxbandwidth string      Maximum IO bandwidth limit for the system drive (Windows only)
       --io-maxiops uint             Maximum IOps limit for the system drive (Windows only)
       --io-maxiops uint             Maximum IOps limit for the system drive (Windows only)

+ 2 - 0
docs/reference/commandline/run.md

@@ -67,6 +67,8 @@ Options:
       --health-timeout duration     Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
       --health-timeout duration     Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
       --help                        Print usage
       --help                        Print usage
   -h, --hostname string             Container host name
   -h, --hostname string             Container host name
+      --init                        Run an init inside the container that forwards signals and reaps processes
+      --init-path string            Path to the docker-init binary
   -i, --interactive                 Keep STDIN open even if not attached
   -i, --interactive                 Keep STDIN open even if not attached
       --io-maxbandwidth string      Maximum IO bandwidth limit for the system drive (Windows only)
       --io-maxbandwidth string      Maximum IO bandwidth limit for the system drive (Windows only)
                                     (Windows only). The format is `<number><unit>`.
                                     (Windows only). The format is `<number><unit>`.

+ 1 - 1
docs/reference/commandline/service_create.md

@@ -137,7 +137,7 @@ Create a service specifying the secret, target, user/group ID and mode:
 ```bash
 ```bash
 $ docker service create --name redis \
 $ docker service create --name redis \
     --secret source=ssh-key,target=ssh \
     --secret source=ssh-key,target=ssh \
-    --secret src=app-key,target=app,uid=1000,gid=1001,mode=0400 \
+    --secret source=app-key,target=app,uid=1000,gid=1001,mode=0400 \
     redis:3.0.6
     redis:3.0.6
 4cdgfyky7ozwh3htjfw0d12qv
 4cdgfyky7ozwh3htjfw0d12qv
 ```
 ```

+ 1 - 1
hack/dockerfile/install-binaries.sh

@@ -85,7 +85,7 @@ do
 			git clone https://github.com/krallin/tini.git "$GOPATH/tini"
 			git clone https://github.com/krallin/tini.git "$GOPATH/tini"
 			cd "$GOPATH/tini"
 			cd "$GOPATH/tini"
 			git checkout -q "$TINI_COMMIT"
 			git checkout -q "$TINI_COMMIT"
-			cmake -DMINIMAL=ON .
+			cmake .
 			make tini-static
 			make tini-static
 			cp tini-static /usr/local/bin/docker-init
 			cp tini-static /usr/local/bin/docker-init
 			;;
 			;;

+ 55 - 0
integration-cli/docker_api_swarm_test.go

@@ -3,6 +3,7 @@
 package main
 package main
 
 
 import (
 import (
+	"encoding/json"
 	"fmt"
 	"fmt"
 	"net/http"
 	"net/http"
 	"os"
 	"os"
@@ -13,6 +14,7 @@ import (
 	"syscall"
 	"syscall"
 	"time"
 	"time"
 
 
+	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/pkg/integration/checker"
 	"github.com/docker/docker/pkg/integration/checker"
 	"github.com/go-check/check"
 	"github.com/go-check/check"
@@ -1310,3 +1312,56 @@ func (s *DockerSwarmSuite) TestAPISwarmSecretsDelete(c *check.C) {
 	c.Assert(err, checker.IsNil)
 	c.Assert(err, checker.IsNil)
 	c.Assert(status, checker.Equals, http.StatusNotFound, check.Commentf("secret delete: %s", string(out)))
 	c.Assert(status, checker.Equals, http.StatusNotFound, check.Commentf("secret delete: %s", string(out)))
 }
 }
+
+// Test case for 30242, where duplicate networks, with different drivers `bridge` and `overlay`,
+// caused both scopes to be `swarm` for `docker network inspect` and `docker network ls`.
+// This test makes sure the fixes correctly output scopes instead.
+func (s *DockerSwarmSuite) TestAPIDuplicateNetworks(c *check.C) {
+	d := s.AddDaemon(c, true, true)
+
+	name := "foo"
+	networkCreateRequest := types.NetworkCreateRequest{
+		Name: name,
+		NetworkCreate: types.NetworkCreate{
+			CheckDuplicate: false,
+		},
+	}
+
+	var n1 types.NetworkCreateResponse
+	networkCreateRequest.NetworkCreate.Driver = "bridge"
+
+	status, out, err := d.SockRequest("POST", "/networks/create", networkCreateRequest)
+	c.Assert(err, checker.IsNil, check.Commentf(string(out)))
+	c.Assert(status, checker.Equals, http.StatusCreated, check.Commentf(string(out)))
+
+	c.Assert(json.Unmarshal(out, &n1), checker.IsNil)
+
+	var n2 types.NetworkCreateResponse
+	networkCreateRequest.NetworkCreate.Driver = "overlay"
+
+	status, out, err = d.SockRequest("POST", "/networks/create", networkCreateRequest)
+	c.Assert(err, checker.IsNil, check.Commentf(string(out)))
+	c.Assert(status, checker.Equals, http.StatusCreated, check.Commentf(string(out)))
+
+	c.Assert(json.Unmarshal(out, &n2), checker.IsNil)
+
+	var r1 types.NetworkResource
+
+	status, out, err = d.SockRequest("GET", "/networks/"+n1.ID, nil)
+	c.Assert(err, checker.IsNil, check.Commentf(string(out)))
+	c.Assert(status, checker.Equals, http.StatusOK, check.Commentf(string(out)))
+
+	c.Assert(json.Unmarshal(out, &r1), checker.IsNil)
+
+	c.Assert(r1.Scope, checker.Equals, "local")
+
+	var r2 types.NetworkResource
+
+	status, out, err = d.SockRequest("GET", "/networks/"+n2.ID, nil)
+	c.Assert(err, checker.IsNil, check.Commentf(string(out)))
+	c.Assert(status, checker.Equals, http.StatusOK, check.Commentf(string(out)))
+
+	c.Assert(json.Unmarshal(out, &r2), checker.IsNil)
+
+	c.Assert(r2.Scope, checker.Equals, "swarm")
+}

+ 7 - 0
integration-cli/docker_cli_ps_test.go

@@ -943,3 +943,10 @@ func (s *DockerSuite) TestPsFilterMissingArgErrorCode(c *check.C) {
 	_, errCode, _ := dockerCmdWithError("ps", "--filter")
 	_, errCode, _ := dockerCmdWithError("ps", "--filter")
 	c.Assert(errCode, checker.Equals, 125)
 	c.Assert(errCode, checker.Equals, 125)
 }
 }
+
+// Test case for 30291
+func (s *DockerSuite) TestPsFormatTemplateWithArg(c *check.C) {
+	runSleepingContainer(c, "-d", "--name", "top", "--label", "some.label=label.foo-bar")
+	out, _ := dockerCmd(c, "ps", "--format", `{{.Names}} {{.Label "some.label"}}`)
+	c.Assert(strings.TrimSpace(out), checker.Equals, "top label.foo-bar")
+}

+ 27 - 0
integration-cli/docker_cli_swarm_test.go

@@ -393,6 +393,33 @@ func (s *DockerSwarmSuite) TestOverlayAttachable(c *check.C) {
 	c.Assert(strings.TrimSpace(out), checker.Equals, "true")
 	c.Assert(strings.TrimSpace(out), checker.Equals, "true")
 }
 }
 
 
+func (s *DockerSwarmSuite) TestOverlayAttachableOnSwarmLeave(c *check.C) {
+	d := s.AddDaemon(c, true, true)
+
+	// Create an attachable swarm network
+	nwName := "attovl"
+	out, err := d.Cmd("network", "create", "-d", "overlay", "--attachable", nwName)
+	c.Assert(err, checker.IsNil, check.Commentf(out))
+
+	// Connect a container to the network
+	out, err = d.Cmd("run", "-d", "--network", nwName, "--name", "c1", "busybox", "top")
+	c.Assert(err, checker.IsNil, check.Commentf(out))
+
+	// Leave the swarm
+	err = d.Leave(true)
+	c.Assert(err, checker.IsNil)
+
+	// Check the container is disconnected
+	out, err = d.Cmd("inspect", "c1", "--format", "{{.NetworkSettings.Networks."+nwName+"}}")
+	c.Assert(err, checker.IsNil)
+	c.Assert(strings.TrimSpace(out), checker.Equals, "<no value>")
+
+	// Check the network is gone
+	out, err = d.Cmd("network", "ls", "--format", "{{.Name}}")
+	c.Assert(err, checker.IsNil)
+	c.Assert(out, checker.Not(checker.Contains), nwName)
+}
+
 func (s *DockerSwarmSuite) TestSwarmRemoveInternalNetwork(c *check.C) {
 func (s *DockerSwarmSuite) TestSwarmRemoveInternalNetwork(c *check.C) {
 	d := s.AddDaemon(c, true, true)
 	d := s.AddDaemon(c, true, true)
 
 

+ 17 - 3
libcontainerd/client_linux.go

@@ -45,7 +45,7 @@ func (clnt *client) GetServerVersion(ctx context.Context) (*ServerVersion, error
 // AddProcess is the handler for adding a process to an already running
 // AddProcess is the handler for adding a process to an already running
 // container. It's called through docker exec. It returns the system pid of the
 // container. It's called through docker exec. It returns the system pid of the
 // exec'd process.
 // exec'd process.
-func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendlyName string, specp Process, attachStdio StdioCallback) (int, error) {
+func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendlyName string, specp Process, attachStdio StdioCallback) (pid int, err error) {
 	clnt.lock(containerID)
 	clnt.lock(containerID)
 	defer clnt.unlock(containerID)
 	defer clnt.unlock(containerID)
 	container, err := clnt.getContainer(containerID)
 	container, err := clnt.getContainer(containerID)
@@ -101,7 +101,14 @@ func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendly
 		Rlimits:         convertRlimits(sp.Rlimits),
 		Rlimits:         convertRlimits(sp.Rlimits),
 	}
 	}
 
 
-	iopipe, err := p.openFifos(sp.Terminal)
+	fifoCtx, cancel := context.WithCancel(context.Background())
+	defer func() {
+		if err != nil {
+			cancel()
+		}
+	}()
+
+	iopipe, err := p.openFifos(fifoCtx, sp.Terminal)
 	if err != nil {
 	if err != nil {
 		return -1, err
 		return -1, err
 	}
 	}
@@ -335,7 +342,14 @@ func (clnt *client) restore(cont *containerd.Container, lastEvent *containerd.Ev
 		}
 		}
 	}
 	}
 
 
-	iopipe, err := container.openFifos(terminal)
+	fifoCtx, cancel := context.WithCancel(context.Background())
+	defer func() {
+		if err != nil {
+			cancel()
+		}
+	}()
+
+	iopipe, err := container.openFifos(fifoCtx, terminal)
 	if err != nil {
 	if err != nil {
 		return err
 		return err
 	}
 	}

+ 9 - 2
libcontainerd/container_unix.go

@@ -90,7 +90,7 @@ func (ctr *container) spec() (*specs.Spec, error) {
 	return &spec, nil
 	return &spec, nil
 }
 }
 
 
-func (ctr *container) start(checkpoint string, checkpointDir string, attachStdio StdioCallback) error {
+func (ctr *container) start(checkpoint string, checkpointDir string, attachStdio StdioCallback) (err error) {
 	spec, err := ctr.spec()
 	spec, err := ctr.spec()
 	if err != nil {
 	if err != nil {
 		return nil
 		return nil
@@ -100,7 +100,14 @@ func (ctr *container) start(checkpoint string, checkpointDir string, attachStdio
 	defer cancel()
 	defer cancel()
 	ready := make(chan struct{})
 	ready := make(chan struct{})
 
 
-	iopipe, err := ctr.openFifos(spec.Process.Terminal)
+	fifoCtx, cancel := context.WithCancel(context.Background())
+	defer func() {
+		if err != nil {
+			cancel()
+		}
+	}()
+
+	iopipe, err := ctr.openFifos(fifoCtx, spec.Process.Terminal)
 	if err != nil {
 	if err != nil {
 		return err
 		return err
 	}
 	}

+ 1 - 4
libcontainerd/process_unix.go

@@ -9,7 +9,6 @@ import (
 	"path/filepath"
 	"path/filepath"
 	goruntime "runtime"
 	goruntime "runtime"
 	"strings"
 	"strings"
-	"time"
 
 
 	containerd "github.com/docker/containerd/api/grpc/types"
 	containerd "github.com/docker/containerd/api/grpc/types"
 	"github.com/tonistiigi/fifo"
 	"github.com/tonistiigi/fifo"
@@ -31,13 +30,11 @@ type process struct {
 	dir string
 	dir string
 }
 }
 
 
-func (p *process) openFifos(terminal bool) (pipe *IOPipe, err error) {
+func (p *process) openFifos(ctx context.Context, terminal bool) (pipe *IOPipe, err error) {
 	if err := os.MkdirAll(p.dir, 0700); err != nil {
 	if err := os.MkdirAll(p.dir, 0700); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
 
 
-	ctx, _ := context.WithTimeout(context.Background(), 15*time.Second)
-
 	io := &IOPipe{}
 	io := &IOPipe{}
 
 
 	io.Stdin, err = fifo.OpenFifo(ctx, p.fifo(unix.Stdin), unix.O_WRONLY|unix.O_CREAT|unix.O_NONBLOCK, 0700)
 	io.Stdin, err = fifo.OpenFifo(ctx, p.fifo(unix.Stdin), unix.O_WRONLY|unix.O_CREAT|unix.O_NONBLOCK, 0700)

+ 9 - 1
man/docker-run.1.md

@@ -41,6 +41,8 @@ docker-run - Run a command in a new container
 [**--group-add**[=*[]*]]
 [**--group-add**[=*[]*]]
 [**-h**|**--hostname**[=*HOSTNAME*]]
 [**-h**|**--hostname**[=*HOSTNAME*]]
 [**--help**]
 [**--help**]
+[**--init**]
+[**--init-path**[=*[]*]]
 [**-i**|**--interactive**]
 [**-i**|**--interactive**]
 [**--ip**[=*IPv4-ADDRESS*]]
 [**--ip**[=*IPv4-ADDRESS*]]
 [**--ip6**[=*IPv6-ADDRESS*]]
 [**--ip6**[=*IPv6-ADDRESS*]]
@@ -309,7 +311,13 @@ redirection on the host system.
    Sets the container host name that is available inside the container.
    Sets the container host name that is available inside the container.
 
 
 **--help**
 **--help**
-  Print usage statement
+   Print usage statement
+
+**--init**
+   Run an init inside the container that forwards signals and reaps processes
+
+**--init-path**=""
+   Path to the docker-init binary
 
 
 **-i**, **--interactive**=*true*|*false*
 **-i**, **--interactive**=*true*|*false*
    Keep STDIN open even if not attached. The default is *false*.
    Keep STDIN open even if not attached. The default is *false*.

+ 1 - 1
opts/secret.go

@@ -50,7 +50,7 @@ func (o *SecretOpt) Set(value string) error {
 
 
 		value := parts[1]
 		value := parts[1]
 		switch key {
 		switch key {
-		case "source":
+		case "source", "src":
 			options.Source = value
 			options.Source = value
 		case "target":
 		case "target":
 			tDir, _ := filepath.Split(value)
 			tDir, _ := filepath.Split(value)

+ 12 - 0
opts/secret_test.go

@@ -35,6 +35,18 @@ func TestSecretOptionsSourceTarget(t *testing.T) {
 	assert.Equal(t, req.Target, "testing")
 	assert.Equal(t, req.Target, "testing")
 }
 }
 
 
+func TestSecretOptionsShorthand(t *testing.T) {
+	var opt SecretOpt
+
+	testCase := "src=foo,target=testing"
+	assert.NilError(t, opt.Set(testCase))
+
+	reqs := opt.Value()
+	assert.Equal(t, len(reqs), 1)
+	req := reqs[0]
+	assert.Equal(t, req.Source, "foo")
+}
+
 func TestSecretOptionsCustomUidGid(t *testing.T) {
 func TestSecretOptionsCustomUidGid(t *testing.T) {
 	var opt SecretOpt
 	var opt SecretOpt
 
 

+ 7 - 0
pkg/plugins/plugin_test.go

@@ -1,6 +1,7 @@
 package plugins
 package plugins
 
 
 import (
 import (
+	"errors"
 	"path/filepath"
 	"path/filepath"
 	"runtime"
 	"runtime"
 	"sync"
 	"sync"
@@ -20,6 +21,12 @@ func TestPluginAddHandler(t *testing.T) {
 	testActive(t, p)
 	testActive(t, p)
 }
 }
 
 
+func TestPluginWaitBadPlugin(t *testing.T) {
+	p := &Plugin{activateWait: sync.NewCond(&sync.Mutex{})}
+	p.activateErr = errors.New("some junk happened")
+	testActive(t, p)
+}
+
 func testActive(t *testing.T, p *Plugin) {
 func testActive(t *testing.T, p *Plugin) {
 	done := make(chan struct{})
 	done := make(chan struct{})
 	go func() {
 	go func() {

+ 1 - 7
pkg/plugins/plugins.go

@@ -78,12 +78,6 @@ type Plugin struct {
 	handlersRun bool
 	handlersRun bool
 }
 }
 
 
-// BasePath returns the path to which all paths returned by the plugin are relative to.
-// For v1 plugins, this always returns the host's root directory.
-func (p *Plugin) BasePath() string {
-	return "/"
-}
-
 // Name returns the name of the plugin.
 // Name returns the name of the plugin.
 func (p *Plugin) Name() string {
 func (p *Plugin) Name() string {
 	return p.name
 	return p.name
@@ -175,7 +169,7 @@ func (p *Plugin) activateWithLock() error {
 
 
 func (p *Plugin) waitActive() error {
 func (p *Plugin) waitActive() error {
 	p.activateWait.L.Lock()
 	p.activateWait.L.Lock()
-	for !p.activated() {
+	for !p.activated() && p.activateErr == nil {
 		p.activateWait.Wait()
 		p.activateWait.Wait()
 	}
 	}
 	p.activateWait.L.Unlock()
 	p.activateWait.L.Unlock()

+ 7 - 0
pkg/plugins/plugins_linux.go

@@ -0,0 +1,7 @@
+package plugins
+
+// BasePath returns the path to which all paths returned by the plugin are relative to.
+// For v1 plugins, this always returns the host's root directory.
+func (p *Plugin) BasePath() string {
+	return "/"
+}

+ 8 - 0
pkg/plugins/plugins_windows.go

@@ -0,0 +1,8 @@
+package plugins
+
+// BasePath returns the path to which all paths returned by the plugin are relative to.
+// For Windows v1 plugins, this returns an empty string, since the plugin is already aware
+// of the absolute path of the mount.
+func (p *Plugin) BasePath() string {
+	return ""
+}

+ 5 - 5
pkg/sysinfo/sysinfo_linux.go

@@ -82,23 +82,23 @@ func checkCgroupMem(cgMounts map[string]string, quiet bool) cgroupMemInfo {
 
 
 	swapLimit := cgroupEnabled(mountPoint, "memory.memsw.limit_in_bytes")
 	swapLimit := cgroupEnabled(mountPoint, "memory.memsw.limit_in_bytes")
 	if !quiet && !swapLimit {
 	if !quiet && !swapLimit {
-		logrus.Warn("Your kernel does not support swap memory limit.")
+		logrus.Warn("Your kernel does not support swap memory limit")
 	}
 	}
 	memoryReservation := cgroupEnabled(mountPoint, "memory.soft_limit_in_bytes")
 	memoryReservation := cgroupEnabled(mountPoint, "memory.soft_limit_in_bytes")
 	if !quiet && !memoryReservation {
 	if !quiet && !memoryReservation {
-		logrus.Warn("Your kernel does not support memory reservation.")
+		logrus.Warn("Your kernel does not support memory reservation")
 	}
 	}
 	oomKillDisable := cgroupEnabled(mountPoint, "memory.oom_control")
 	oomKillDisable := cgroupEnabled(mountPoint, "memory.oom_control")
 	if !quiet && !oomKillDisable {
 	if !quiet && !oomKillDisable {
-		logrus.Warn("Your kernel does not support oom control.")
+		logrus.Warn("Your kernel does not support oom control")
 	}
 	}
 	memorySwappiness := cgroupEnabled(mountPoint, "memory.swappiness")
 	memorySwappiness := cgroupEnabled(mountPoint, "memory.swappiness")
 	if !quiet && !memorySwappiness {
 	if !quiet && !memorySwappiness {
-		logrus.Warn("Your kernel does not support memory swappiness.")
+		logrus.Warn("Your kernel does not support memory swappiness")
 	}
 	}
 	kernelMemory := cgroupEnabled(mountPoint, "memory.kmem.limit_in_bytes")
 	kernelMemory := cgroupEnabled(mountPoint, "memory.kmem.limit_in_bytes")
 	if !quiet && !kernelMemory {
 	if !quiet && !kernelMemory {
-		logrus.Warn("Your kernel does not support kernel memory limit.")
+		logrus.Warn("Your kernel does not support kernel memory limit")
 	}
 	}
 
 
 	return cgroupMemInfo{
 	return cgroupMemInfo{