فهرست منبع

Merge pull request #29002 from vieux/1.13.0-rc3-cherrypicks

1.13.0-rc3 cherry-picks: part2
Victor Vieux 8 سال پیش
والد
کامیت
e81d02e4cd
89فایلهای تغییر یافته به همراه1730 افزوده شده و 1312 حذف شده
  1. 0 1
      CHANGELOG.md
  2. 4 0
      Dockerfile.ppc64le
  3. 1 1
      Makefile
  4. 1 0
      api/server/router/swarm/cluster_routes.go
  5. 172 167
      api/swagger.yaml
  6. 8 2
      builder/dockerfile/dispatchers.go
  7. 116 112
      builder/dockerfile/envVarTest
  8. 13 1
      builder/dockerfile/shell_parser.go
  9. 19 7
      builder/dockerfile/shell_parser_test.go
  10. 0 7
      cli/command/node/ps.go
  11. 3 18
      cli/command/plugin/inspect.go
  12. 2 2
      cli/command/secret/create.go
  13. 1 1
      cli/command/secret/inspect.go
  14. 4 3
      cli/command/secret/ls.go
  15. 4 3
      cli/command/secret/remove.go
  16. 0 8
      cli/command/service/ps.go
  17. 1 1
      cli/command/stack/common.go
  18. 55 11
      cli/command/stack/deploy.go
  19. 1 1
      cli/command/stack/remove.go
  20. 1 1
      container/stream/streams.go
  21. 221 14
      contrib/completion/bash/docker
  22. 0 2
      contrib/completion/fish/docker.fish
  23. 158 1
      contrib/completion/zsh/_docker
  24. 4 0
      daemon/cluster/cluster.go
  25. 14 2
      daemon/cluster/convert/container.go
  26. 6 0
      daemon/cluster/executor/container/adapter.go
  27. 5 0
      daemon/commit.go
  28. 3 3
      daemon/container.go
  29. 17 22
      daemon/daemon.go
  30. 0 41
      daemon/links.go
  31. 72 0
      daemon/links_linux.go
  32. 0 0
      daemon/links_linux_test.go
  33. 10 0
      daemon/links_notlinux.go
  34. 1 1
      daemon/logger/logger.go
  35. 26 0
      daemon/logger/logger_test.go
  36. 4 0
      distribution/errors.go
  37. 0 3
      distribution/pull_v2.go
  38. 3 3
      distribution/push_v2.go
  39. 8 5
      distribution/push_v2_test.go
  40. 53 55
      docs/api/v1.18.md
  41. 52 54
      docs/api/v1.19.md
  42. 56 58
      docs/api/v1.20.md
  43. 67 69
      docs/api/v1.21.md
  44. 69 71
      docs/api/v1.22.md
  45. 68 70
      docs/api/v1.23.md
  46. 97 99
      docs/api/v1.24.md
  47. 5 1
      docs/api/version-history.md
  48. 1 1
      docs/deprecated.md
  49. 0 1
      docs/reference/commandline/create.md
  50. 1 1
      docs/reference/commandline/node_ps.md
  51. 3 3
      docs/reference/commandline/plugin_inspect.md
  52. 1 17
      docs/reference/commandline/run.md
  53. 2 2
      docs/reference/commandline/secret_ls.md
  54. 0 1
      docs/reference/commandline/service_ps.md
  55. 1 1
      docs/reference/glossary.md
  56. 2 2
      hack/validate/swagger-gen
  57. 3 1
      image/tarexport/save.go
  58. 1 1
      integration-cli/daemon_swarm.go
  59. 21 5
      integration-cli/docker_api_containers_test.go
  60. 16 0
      integration-cli/docker_cli_build_test.go
  61. 49 0
      integration-cli/docker_cli_plugins_test.go
  62. 27 3
      integration-cli/docker_cli_restart_test.go
  63. 0 178
      integration-cli/docker_cli_run_test.go
  64. 4 1
      integration-cli/docker_cli_service_create_test.go
  65. 0 82
      integration-cli/docker_cli_swarm_test.go
  66. 28 27
      libcontainerd/client_linux.go
  67. 4 0
      libcontainerd/process_unix.go
  68. 1 1
      man/docker-build.1.md
  69. 0 1
      man/docker-create.1.md
  70. 1 1
      man/docker-login.1.md
  71. 1 1
      man/docker-pause.1.md
  72. 0 1
      man/docker-run.1.md
  73. 1 1
      man/docker-unpause.1.md
  74. 1 1
      man/docker-version.1.md
  75. 5 1
      pkg/graphdb/conn_sqlite3_linux.go
  76. 0 7
      pkg/graphdb/conn_sqlite3_unix.go
  77. 0 7
      pkg/graphdb/conn_sqlite3_windows.go
  78. 0 8
      pkg/graphdb/conn_unsupported.go
  79. 0 0
      pkg/graphdb/graphdb_linux.go
  80. 0 0
      pkg/graphdb/graphdb_linux_test.go
  81. 0 0
      pkg/graphdb/sort_linux.go
  82. 0 0
      pkg/graphdb/sort_linux_test.go
  83. 3 0
      pkg/graphdb/unsupported.go
  84. 0 0
      pkg/graphdb/utils_linux.go
  85. 41 18
      pkg/namesgenerator/names-generator.go
  86. 13 7
      pkg/signal/trap.go
  87. 45 4
      plugin/backend_linux.go
  88. 29 0
      plugin/store/store.go
  89. 0 5
      runconfig/opts/parse.go

+ 0 - 1
CHANGELOG.md

@@ -99,7 +99,6 @@ be found.
 + Add `Isolation` to the /info endpoint [#26255](https://github.com/docker/docker/pull/26255)
 + Add `Isolation` to the /info endpoint [#26255](https://github.com/docker/docker/pull/26255)
 + Add `userns` to the /info endpoint [#27840](https://github.com/docker/docker/pull/27840)
 + Add `userns` to the /info endpoint [#27840](https://github.com/docker/docker/pull/27840)
 - Do not allow more than one mode be requested at once in the services endpoint [#26643](https://github.com/docker/docker/pull/26643)
 - Do not allow more than one mode be requested at once in the services endpoint [#26643](https://github.com/docker/docker/pull/26643)
-+ Add `--mount` flag to `docker create` and `docker run` [#26825](https://github.com/docker/docker/pull/26825)[#28150](https://github.com/docker/docker/pull/28150)
 + Add capability to /containers/create API to specify mounts in a more granular and safer way [#22373](https://github.com/docker/docker/pull/22373)
 + Add capability to /containers/create API to specify mounts in a more granular and safer way [#22373](https://github.com/docker/docker/pull/22373)
 + Add `--format` flag to `network ls` and `volume ls` [#23475](https://github.com/docker/docker/pull/23475)
 + Add `--format` flag to `network ls` and `volume ls` [#23475](https://github.com/docker/docker/pull/23475)
 * Allow the top-level `docker inspect` command to inspect any kind of resource [#23614](https://github.com/docker/docker/pull/23614)
 * Allow the top-level `docker inspect` command to inspect any kind of resource [#23614](https://github.com/docker/docker/pull/23614)

+ 4 - 0
Dockerfile.ppc64le

@@ -18,6 +18,10 @@
 # ppc64le/golang is a debian:jessie based image with golang installed
 # ppc64le/golang is a debian:jessie based image with golang installed
 FROM ppc64le/golang:1.6.3
 FROM ppc64le/golang:1.6.3
 
 
+# allow replacing httpredir or deb mirror
+ARG APT_MIRROR=deb.debian.org
+RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list
+
 # Packaged dependencies
 # Packaged dependencies
 RUN apt-get update && apt-get install -y \
 RUN apt-get update && apt-get install -y \
 	apparmor \
 	apparmor \

+ 1 - 1
Makefile

@@ -144,4 +144,4 @@ swagger-gen:
 		-w /go/src/github.com/docker/docker \
 		-w /go/src/github.com/docker/docker \
 		--entrypoint hack/generate-swagger-api.sh \
 		--entrypoint hack/generate-swagger-api.sh \
 		-e GOPATH=/go \
 		-e GOPATH=/go \
-		quay.io/goswagger/swagger
+		quay.io/goswagger/swagger:0.7.4

+ 1 - 0
api/server/router/swarm/cluster_routes.go

@@ -383,6 +383,7 @@ func (sr *swarmRouter) removeSecret(ctx context.Context, w http.ResponseWriter,
 	if err := sr.backend.RemoveSecret(vars["id"]); err != nil {
 	if err := sr.backend.RemoveSecret(vars["id"]); err != nil {
 		return err
 		return err
 	}
 	}
+	w.WriteHeader(http.StatusNoContent)
 
 
 	return nil
 	return nil
 }
 }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 172 - 167
api/swagger.yaml


+ 8 - 2
builder/dockerfile/dispatchers.go

@@ -71,14 +71,20 @@ func env(b *Builder, args []string, attributes map[string]bool, original string)
 		if len(args[j]) == 0 {
 		if len(args[j]) == 0 {
 			return errBlankCommandNames("ENV")
 			return errBlankCommandNames("ENV")
 		}
 		}
-
 		newVar := args[j] + "=" + args[j+1] + ""
 		newVar := args[j] + "=" + args[j+1] + ""
 		commitStr += " " + newVar
 		commitStr += " " + newVar
 
 
 		gotOne := false
 		gotOne := false
 		for i, envVar := range b.runConfig.Env {
 		for i, envVar := range b.runConfig.Env {
 			envParts := strings.SplitN(envVar, "=", 2)
 			envParts := strings.SplitN(envVar, "=", 2)
-			if envParts[0] == args[j] {
+			compareFrom := envParts[0]
+			compareTo := args[j]
+			if runtime.GOOS == "windows" {
+				// Case insensitive environment variables on Windows
+				compareFrom = strings.ToUpper(compareFrom)
+				compareTo = strings.ToUpper(compareTo)
+			}
+			if compareFrom == compareTo {
 				b.runConfig.Env[i] = newVar
 				b.runConfig.Env[i] = newVar
 				gotOne = true
 				gotOne = true
 				break
 				break

+ 116 - 112
builder/dockerfile/envVarTest

@@ -1,112 +1,116 @@
-hello                    |     hello
-he'll'o                  |     hello
-he'llo                   |     hello
-he\'llo                  |     he'llo
-he\\'llo                 |     he\llo
-abc\tdef                 |     abctdef
-"abc\tdef"               |     abc\tdef
-'abc\tdef'               |     abc\tdef
-hello\                   |     hello
-hello\\                  |     hello\
-"hello                   |     hello
-"hello\"                 |     hello"
-"hel'lo"                 |     hel'lo
-'hello                   |     hello
-'hello\'                 |     hello\
-"''"                     |     ''
-$.                       |     $.
-$1                       |
-he$1x                    |     hex
-he$.x                    |     he$.x
-he$pwd.                  |     he.
-he$PWD                   |     he/home
-he\$PWD                  |     he$PWD
-he\\$PWD                 |     he\/home
-he\${}                   |     he${}
-he\${}xx                 |     he${}xx
-he${}                    |     he
-he${}xx                  |     hexx
-he${hi}                  |     he
-he${hi}xx                |     hexx
-he${PWD}                 |     he/home
-he${.}                   |     error
-he${XXX:-000}xx          |     he000xx
-he${PWD:-000}xx          |     he/homexx
-he${XXX:-$PWD}xx         |     he/homexx
-he${XXX:-${PWD:-yyy}}xx  |     he/homexx
-he${XXX:-${YYY:-yyy}}xx  |     heyyyxx
-he${XXX:YYY}             |     error
-he${XXX:+${PWD}}xx       |     hexx
-he${PWD:+${XXX}}xx       |     hexx
-he${PWD:+${SHELL}}xx     |     hebashxx
-he${XXX:+000}xx          |     hexx
-he${PWD:+000}xx          |     he000xx
-'he${XX}'                |     he${XX}
-"he${PWD}"               |     he/home
-"he'$PWD'"               |     he'/home'
-"$PWD"                   |     /home
-'$PWD'                   |     $PWD
-'\$PWD'                  |     \$PWD
-'"hello"'                |     "hello"
-he\$PWD                  |     he$PWD
-"he\$PWD"                |     he$PWD
-'he\$PWD'                |     he\$PWD
-he${PWD                  |     error
-he${PWD:=000}xx          |     error
-he${PWD:+${PWD}:}xx      |     he/home:xx
-he${XXX:-\$PWD:}xx       |     he$PWD:xx
-he${XXX:-\${PWD}z}xx     |     he${PWDz}xx
-안녕하세요                 |     안녕하세요
-안'녕'하세요               |     안녕하세요
-안'녕하세요                |     안녕하세요
-안녕\'하세요               |     안녕'하세요
-안\\'녕하세요              |     안\녕하세요
-안녕\t하세요               |     안녕t하세요
-"안녕\t하세요"             |     안녕\t하세요
-'안녕\t하세요              |     안녕\t하세요
-안녕하세요\                |     안녕하세요
-안녕하세요\\               |     안녕하세요\
-"안녕하세요                |     안녕하세요
-"안녕하세요\"              |     안녕하세요"
-"안녕'하세요"              |     안녕'하세요
-'안녕하세요                |     안녕하세요
-'안녕하세요\'              |     안녕하세요\
-안녕$1x                    |     안녕x
-안녕$.x                    |     안녕$.x
-안녕$pwd.                  |     안녕.
-안녕$PWD                   |     안녕/home
-안녕\$PWD                  |     안녕$PWD
-안녕\\$PWD                 |     안녕\/home
-안녕\${}                   |     안녕${}
-안녕\${}xx                 |     안녕${}xx
-안녕${}                    |     안녕
-안녕${}xx                  |     안녕xx
-안녕${hi}                  |     안녕
-안녕${hi}xx                |     안녕xx
-안녕${PWD}                 |     안녕/home
-안녕${.}                   |     error
-안녕${XXX:-000}xx          |     안녕000xx
-안녕${PWD:-000}xx          |     안녕/homexx
-안녕${XXX:-$PWD}xx         |     안녕/homexx
-안녕${XXX:-${PWD:-yyy}}xx  |     안녕/homexx
-안녕${XXX:-${YYY:-yyy}}xx  |     안녕yyyxx
-안녕${XXX:YYY}             |     error
-안녕${XXX:+${PWD}}xx       |     안녕xx
-안녕${PWD:+${XXX}}xx       |     안녕xx
-안녕${PWD:+${SHELL}}xx     |     안녕bashxx
-안녕${XXX:+000}xx          |     안녕xx
-안녕${PWD:+000}xx          |     안녕000xx
-'안녕${XX}'                |     안녕${XX}
-"안녕${PWD}"               |     안녕/home
-"안녕'$PWD'"               |     안녕'/home'
-'"안녕"'                   |     "안녕"
-안녕\$PWD                  |     안녕$PWD
-"안녕\$PWD"                |     안녕$PWD
-'안녕\$PWD'                |     안녕\$PWD
-안녕${PWD                  |     error
-안녕${PWD:=000}xx          |     error
-안녕${PWD:+${PWD}:}xx      |     안녕/home:xx
-안녕${XXX:-\$PWD:}xx       |     안녕$PWD:xx
-안녕${XXX:-\${PWD}z}xx     |     안녕${PWDz}xx
-$KOREAN                    |     한국어
-안녕$KOREAN                |     안녕한국어
+A|hello                    |     hello
+A|he'll'o                  |     hello
+A|he'llo                   |     hello
+A|he\'llo                  |     he'llo
+A|he\\'llo                 |     he\llo
+A|abc\tdef                 |     abctdef
+A|"abc\tdef"               |     abc\tdef
+A|'abc\tdef'               |     abc\tdef
+A|hello\                   |     hello
+A|hello\\                  |     hello\
+A|"hello                   |     hello
+A|"hello\"                 |     hello"
+A|"hel'lo"                 |     hel'lo
+A|'hello                   |     hello
+A|'hello\'                 |     hello\
+A|"''"                     |     ''
+A|$.                       |     $.
+A|$1                       |
+A|he$1x                    |     hex
+A|he$.x                    |     he$.x
+# Next one is different on Windows as $pwd==$PWD
+U|he$pwd.                  |     he.
+W|he$pwd.                  |     he/home.
+A|he$PWD                   |     he/home
+A|he\$PWD                  |     he$PWD
+A|he\\$PWD                 |     he\/home
+A|he\${}                   |     he${}
+A|he\${}xx                 |     he${}xx
+A|he${}                    |     he
+A|he${}xx                  |     hexx
+A|he${hi}                  |     he
+A|he${hi}xx                |     hexx
+A|he${PWD}                 |     he/home
+A|he${.}                   |     error
+A|he${XXX:-000}xx          |     he000xx
+A|he${PWD:-000}xx          |     he/homexx
+A|he${XXX:-$PWD}xx         |     he/homexx
+A|he${XXX:-${PWD:-yyy}}xx  |     he/homexx
+A|he${XXX:-${YYY:-yyy}}xx  |     heyyyxx
+A|he${XXX:YYY}             |     error
+A|he${XXX:+${PWD}}xx       |     hexx
+A|he${PWD:+${XXX}}xx       |     hexx
+A|he${PWD:+${SHELL}}xx     |     hebashxx
+A|he${XXX:+000}xx          |     hexx
+A|he${PWD:+000}xx          |     he000xx
+A|'he${XX}'                |     he${XX}
+A|"he${PWD}"               |     he/home
+A|"he'$PWD'"               |     he'/home'
+A|"$PWD"                   |     /home
+A|'$PWD'                   |     $PWD
+A|'\$PWD'                  |     \$PWD
+A|'"hello"'                |     "hello"
+A|he\$PWD                  |     he$PWD
+A|"he\$PWD"                |     he$PWD
+A|'he\$PWD'                |     he\$PWD
+A|he${PWD                  |     error
+A|he${PWD:=000}xx          |     error
+A|he${PWD:+${PWD}:}xx      |     he/home:xx
+A|he${XXX:-\$PWD:}xx       |     he$PWD:xx
+A|he${XXX:-\${PWD}z}xx     |     he${PWDz}xx
+A|안녕하세요                 |     안녕하세요
+A|안'녕'하세요               |     안녕하세요
+A|안'녕하세요                |     안녕하세요
+A|안녕\'하세요               |     안녕'하세요
+A|안\\'녕하세요              |     안\녕하세요
+A|안녕\t하세요               |     안녕t하세요
+A|"안녕\t하세요"             |     안녕\t하세요
+A|'안녕\t하세요              |     안녕\t하세요
+A|안녕하세요\                |     안녕하세요
+A|안녕하세요\\               |     안녕하세요\
+A|"안녕하세요                |     안녕하세요
+A|"안녕하세요\"              |     안녕하세요"
+A|"안녕'하세요"              |     안녕'하세요
+A|'안녕하세요                |     안녕하세요
+A|'안녕하세요\'              |     안녕하세요\
+A|안녕$1x                    |     안녕x
+A|안녕$.x                    |     안녕$.x
+# Next one is different on Windows as $pwd==$PWD
+U|안녕$pwd.                  |     안녕.
+W|안녕$pwd.                  |     안녕/home.
+A|안녕$PWD                   |     안녕/home
+A|안녕\$PWD                  |     안녕$PWD
+A|안녕\\$PWD                 |     안녕\/home
+A|안녕\${}                   |     안녕${}
+A|안녕\${}xx                 |     안녕${}xx
+A|안녕${}                    |     안녕
+A|안녕${}xx                  |     안녕xx
+A|안녕${hi}                  |     안녕
+A|안녕${hi}xx                |     안녕xx
+A|안녕${PWD}                 |     안녕/home
+A|안녕${.}                   |     error
+A|안녕${XXX:-000}xx          |     안녕000xx
+A|안녕${PWD:-000}xx          |     안녕/homexx
+A|안녕${XXX:-$PWD}xx         |     안녕/homexx
+A|안녕${XXX:-${PWD:-yyy}}xx  |     안녕/homexx
+A|안녕${XXX:-${YYY:-yyy}}xx  |     안녕yyyxx
+A|안녕${XXX:YYY}             |     error
+A|안녕${XXX:+${PWD}}xx       |     안녕xx
+A|안녕${PWD:+${XXX}}xx       |     안녕xx
+A|안녕${PWD:+${SHELL}}xx     |     안녕bashxx
+A|안녕${XXX:+000}xx          |     안녕xx
+A|안녕${PWD:+000}xx          |     안녕000xx
+A|'안녕${XX}'                |     안녕${XX}
+A|"안녕${PWD}"               |     안녕/home
+A|"안녕'$PWD'"               |     안녕'/home'
+A|'"안녕"'                   |     "안녕"
+A|안녕\$PWD                  |     안녕$PWD
+A|"안녕\$PWD"                |     안녕$PWD
+A|'안녕\$PWD'                |     안녕\$PWD
+A|안녕${PWD                  |     error
+A|안녕${PWD:=000}xx          |     error
+A|안녕${PWD:+${PWD}:}xx      |     안녕/home:xx
+A|안녕${XXX:-\$PWD:}xx       |     안녕$PWD:xx
+A|안녕${XXX:-\${PWD}z}xx     |     안녕${PWDz}xx
+A|$KOREAN                    |     한국어
+A|안녕$KOREAN                |     안녕한국어

+ 13 - 1
builder/dockerfile/shell_parser.go

@@ -8,6 +8,7 @@ package dockerfile
 
 
 import (
 import (
 	"fmt"
 	"fmt"
+	"runtime"
 	"strings"
 	"strings"
 	"text/scanner"
 	"text/scanner"
 	"unicode"
 	"unicode"
@@ -298,9 +299,16 @@ func (sw *shellWord) processName() string {
 }
 }
 
 
 func (sw *shellWord) getEnv(name string) string {
 func (sw *shellWord) getEnv(name string) string {
+	if runtime.GOOS == "windows" {
+		// Case-insensitive environment variables on Windows
+		name = strings.ToUpper(name)
+	}
 	for _, env := range sw.envs {
 	for _, env := range sw.envs {
 		i := strings.Index(env, "=")
 		i := strings.Index(env, "=")
 		if i < 0 {
 		if i < 0 {
+			if runtime.GOOS == "windows" {
+				env = strings.ToUpper(env)
+			}
 			if name == env {
 			if name == env {
 				// Should probably never get here, but just in case treat
 				// Should probably never get here, but just in case treat
 				// it like "var" and "var=" are the same
 				// it like "var" and "var=" are the same
@@ -308,7 +316,11 @@ func (sw *shellWord) getEnv(name string) string {
 			}
 			}
 			continue
 			continue
 		}
 		}
-		if name != env[:i] {
+		compareName := env[:i]
+		if runtime.GOOS == "windows" {
+			compareName = strings.ToUpper(compareName)
+		}
+		if name != compareName {
 			continue
 			continue
 		}
 		}
 		return env[i+1:]
 		return env[i+1:]

+ 19 - 7
builder/dockerfile/shell_parser_test.go

@@ -3,12 +3,14 @@ package dockerfile
 import (
 import (
 	"bufio"
 	"bufio"
 	"os"
 	"os"
+	"runtime"
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 )
 )
 
 
 func TestShellParser4EnvVars(t *testing.T) {
 func TestShellParser4EnvVars(t *testing.T) {
 	fn := "envVarTest"
 	fn := "envVarTest"
+	lineCount := 0
 
 
 	file, err := os.Open(fn)
 	file, err := os.Open(fn)
 	if err != nil {
 	if err != nil {
@@ -20,6 +22,7 @@ func TestShellParser4EnvVars(t *testing.T) {
 	envs := []string{"PWD=/home", "SHELL=bash", "KOREAN=한국어"}
 	envs := []string{"PWD=/home", "SHELL=bash", "KOREAN=한국어"}
 	for scanner.Scan() {
 	for scanner.Scan() {
 		line := scanner.Text()
 		line := scanner.Text()
+		lineCount++
 
 
 		// Trim comments and blank lines
 		// Trim comments and blank lines
 		i := strings.Index(line, "#")
 		i := strings.Index(line, "#")
@@ -33,21 +36,30 @@ func TestShellParser4EnvVars(t *testing.T) {
 		}
 		}
 
 
 		words := strings.Split(line, "|")
 		words := strings.Split(line, "|")
-		if len(words) != 2 {
+		if len(words) != 3 {
 			t.Fatalf("Error in '%s' - should be exactly one | in:%q", fn, line)
 			t.Fatalf("Error in '%s' - should be exactly one | in:%q", fn, line)
 		}
 		}
 
 
 		words[0] = strings.TrimSpace(words[0])
 		words[0] = strings.TrimSpace(words[0])
 		words[1] = strings.TrimSpace(words[1])
 		words[1] = strings.TrimSpace(words[1])
+		words[2] = strings.TrimSpace(words[2])
 
 
-		newWord, err := ProcessWord(words[0], envs, '\\')
-
-		if err != nil {
-			newWord = "error"
+		// Key W=Windows; A=All; U=Unix
+		if (words[0] != "W") && (words[0] != "A") && (words[0] != "U") {
+			t.Fatalf("Invalid tag %s at line %d of %s. Must be W, A or U", words[0], lineCount, fn)
 		}
 		}
 
 
-		if newWord != words[1] {
-			t.Fatalf("Error. Src: %s  Calc: %s  Expected: %s", words[0], newWord, words[1])
+		if ((words[0] == "W" || words[0] == "A") && runtime.GOOS == "windows") ||
+			((words[0] == "U" || words[0] == "A") && runtime.GOOS != "windows") {
+			newWord, err := ProcessWord(words[1], envs, '\\')
+
+			if err != nil {
+				newWord = "error"
+			}
+
+			if newWord != words[2] {
+				t.Fatalf("Error. Src: %s  Calc: %s  Expected: %s at line %d", words[1], newWord, words[2], lineCount)
+			}
 		}
 		}
 	}
 	}
 }
 }

+ 0 - 7
cli/command/node/ps.go

@@ -17,7 +17,6 @@ import (
 
 
 type psOptions struct {
 type psOptions struct {
 	nodeIDs   []string
 	nodeIDs   []string
-	all       bool
 	noResolve bool
 	noResolve bool
 	noTrunc   bool
 	noTrunc   bool
 	filter    opts.FilterOpt
 	filter    opts.FilterOpt
@@ -44,7 +43,6 @@ func newPsCommand(dockerCli *command.DockerCli) *cobra.Command {
 	flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate output")
 	flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate output")
 	flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names")
 	flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names")
 	flags.VarP(&opts.filter, "filter", "f", "Filter output based on conditions provided")
 	flags.VarP(&opts.filter, "filter", "f", "Filter output based on conditions provided")
-	flags.BoolVarP(&opts.all, "all", "a", false, "Show all tasks (default shows tasks that are or will be running)")
 
 
 	return cmd
 	return cmd
 }
 }
@@ -74,11 +72,6 @@ func runPs(dockerCli *command.DockerCli, opts psOptions) error {
 		filter := opts.filter.Value()
 		filter := opts.filter.Value()
 		filter.Add("node", node.ID)
 		filter.Add("node", node.ID)
 
 
-		if !opts.all && !filter.Include("desired-state") {
-			filter.Add("desired-state", string(swarm.TaskStateRunning))
-			filter.Add("desired-state", string(swarm.TaskStateAccepted))
-		}
-
 		nodeTasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
 		nodeTasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
 		if err != nil {
 		if err != nil {
 			errs = append(errs, err.Error())
 			errs = append(errs, err.Error())

+ 3 - 18
cli/command/plugin/inspect.go

@@ -1,12 +1,9 @@
 package plugin
 package plugin
 
 
 import (
 import (
-	"fmt"
-
 	"github.com/docker/docker/cli"
 	"github.com/docker/docker/cli"
 	"github.com/docker/docker/cli/command"
 	"github.com/docker/docker/cli/command"
 	"github.com/docker/docker/cli/command/inspect"
 	"github.com/docker/docker/cli/command/inspect"
-	"github.com/docker/docker/reference"
 	"github.com/spf13/cobra"
 	"github.com/spf13/cobra"
 	"golang.org/x/net/context"
 	"golang.org/x/net/context"
 )
 )
@@ -20,7 +17,7 @@ func newInspectCommand(dockerCli *command.DockerCli) *cobra.Command {
 	var opts inspectOptions
 	var opts inspectOptions
 
 
 	cmd := &cobra.Command{
 	cmd := &cobra.Command{
-		Use:   "inspect [OPTIONS] PLUGIN [PLUGIN...]",
+		Use:   "inspect [OPTIONS] PLUGIN|ID [PLUGIN|ID...]",
 		Short: "Display detailed information on one or more plugins",
 		Short: "Display detailed information on one or more plugins",
 		Args:  cli.RequiresMinArgs(1),
 		Args:  cli.RequiresMinArgs(1),
 		RunE: func(cmd *cobra.Command, args []string) error {
 		RunE: func(cmd *cobra.Command, args []string) error {
@@ -37,20 +34,8 @@ func newInspectCommand(dockerCli *command.DockerCli) *cobra.Command {
 func runInspect(dockerCli *command.DockerCli, opts inspectOptions) error {
 func runInspect(dockerCli *command.DockerCli, opts inspectOptions) error {
 	client := dockerCli.Client()
 	client := dockerCli.Client()
 	ctx := context.Background()
 	ctx := context.Background()
-	getRef := func(name string) (interface{}, []byte, error) {
-		named, err := reference.ParseNamed(name) // FIXME: validate
-		if err != nil {
-			return nil, nil, err
-		}
-		if reference.IsNameOnly(named) {
-			named = reference.WithDefaultTag(named)
-		}
-		ref, ok := named.(reference.NamedTagged)
-		if !ok {
-			return nil, nil, fmt.Errorf("invalid name: %s", named.String())
-		}
-
-		return client.PluginInspectWithRaw(ctx, ref.String())
+	getRef := func(ref string) (interface{}, []byte, error) {
+		return client.PluginInspectWithRaw(ctx, ref)
 	}
 	}
 
 
 	return inspect.Inspect(dockerCli.Out(), opts.pluginNames, opts.format, getRef)
 	return inspect.Inspect(dockerCli.Out(), opts.pluginNames, opts.format, getRef)

+ 2 - 2
cli/command/secret/create.go

@@ -25,9 +25,9 @@ func newSecretCreateCommand(dockerCli *command.DockerCli) *cobra.Command {
 	}
 	}
 
 
 	cmd := &cobra.Command{
 	cmd := &cobra.Command{
-		Use:   "create [OPTIONS] SECRET [SECRET...]",
+		Use:   "create [OPTIONS] SECRET",
 		Short: "Create a secret using stdin as content",
 		Short: "Create a secret using stdin as content",
-		Args:  cli.RequiresMinArgs(1),
+		Args:  cli.ExactArgs(1),
 		RunE: func(cmd *cobra.Command, args []string) error {
 		RunE: func(cmd *cobra.Command, args []string) error {
 			createOpts.name = args[0]
 			createOpts.name = args[0]
 			return runSecretCreate(dockerCli, createOpts)
 			return runSecretCreate(dockerCli, createOpts)

+ 1 - 1
cli/command/secret/inspect.go

@@ -25,7 +25,7 @@ func newSecretInspectCommand(dockerCli *command.DockerCli) *cobra.Command {
 		},
 		},
 	}
 	}
 
 
-	cmd.Flags().StringVarP(&opts.format, "format", "f", "", "Format the output using the given go template")
+	cmd.Flags().StringVarP(&opts.format, "format", "f", "", "Format the output using the given Go template")
 	return cmd
 	return cmd
 }
 }
 
 

+ 4 - 3
cli/command/secret/ls.go

@@ -21,9 +21,10 @@ func newSecretListCommand(dockerCli *command.DockerCli) *cobra.Command {
 	opts := listOptions{}
 	opts := listOptions{}
 
 
 	cmd := &cobra.Command{
 	cmd := &cobra.Command{
-		Use:   "ls [OPTIONS]",
-		Short: "List secrets",
-		Args:  cli.NoArgs,
+		Use:     "ls [OPTIONS]",
+		Aliases: []string{"list"},
+		Short:   "List secrets",
+		Args:    cli.NoArgs,
 		RunE: func(cmd *cobra.Command, args []string) error {
 		RunE: func(cmd *cobra.Command, args []string) error {
 			return runSecretList(dockerCli, opts)
 			return runSecretList(dockerCli, opts)
 		},
 		},

+ 4 - 3
cli/command/secret/remove.go

@@ -16,9 +16,10 @@ type removeOptions struct {
 
 
 func newSecretRemoveCommand(dockerCli *command.DockerCli) *cobra.Command {
 func newSecretRemoveCommand(dockerCli *command.DockerCli) *cobra.Command {
 	return &cobra.Command{
 	return &cobra.Command{
-		Use:   "rm SECRET [SECRET...]",
-		Short: "Remove one or more secrets",
-		Args:  cli.RequiresMinArgs(1),
+		Use:     "rm SECRET [SECRET...]",
+		Aliases: []string{"remove"},
+		Short:   "Remove one or more secrets",
+		Args:    cli.RequiresMinArgs(1),
 		RunE: func(cmd *cobra.Command, args []string) error {
 		RunE: func(cmd *cobra.Command, args []string) error {
 			opts := removeOptions{
 			opts := removeOptions{
 				names: args,
 				names: args,

+ 0 - 8
cli/command/service/ps.go

@@ -2,7 +2,6 @@ package service
 
 
 import (
 import (
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
-	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/cli"
 	"github.com/docker/docker/cli"
 	"github.com/docker/docker/cli/command"
 	"github.com/docker/docker/cli/command"
 	"github.com/docker/docker/cli/command/idresolver"
 	"github.com/docker/docker/cli/command/idresolver"
@@ -15,7 +14,6 @@ import (
 
 
 type psOptions struct {
 type psOptions struct {
 	serviceID string
 	serviceID string
-	all       bool
 	quiet     bool
 	quiet     bool
 	noResolve bool
 	noResolve bool
 	noTrunc   bool
 	noTrunc   bool
@@ -39,7 +37,6 @@ func newPsCommand(dockerCli *command.DockerCli) *cobra.Command {
 	flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate output")
 	flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate output")
 	flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names")
 	flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names")
 	flags.VarP(&opts.filter, "filter", "f", "Filter output based on conditions provided")
 	flags.VarP(&opts.filter, "filter", "f", "Filter output based on conditions provided")
-	flags.BoolVarP(&opts.all, "all", "a", false, "Show all tasks (default shows tasks that are or will be running)")
 
 
 	return cmd
 	return cmd
 }
 }
@@ -67,11 +64,6 @@ func runPS(dockerCli *command.DockerCli, opts psOptions) error {
 		}
 		}
 	}
 	}
 
 
-	if !opts.all && !filter.Include("desired-state") {
-		filter.Add("desired-state", string(swarm.TaskStateRunning))
-		filter.Add("desired-state", string(swarm.TaskStateAccepted))
-	}
-
 	tasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
 	tasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
 	if err != nil {
 	if err != nil {
 		return err
 		return err

+ 1 - 1
cli/command/stack/common.go

@@ -37,7 +37,7 @@ func getServices(
 		types.ServiceListOptions{Filters: getStackFilter(namespace)})
 		types.ServiceListOptions{Filters: getStackFilter(namespace)})
 }
 }
 
 
-func getNetworks(
+func getStackNetworks(
 	ctx context.Context,
 	ctx context.Context,
 	apiclient client.APIClient,
 	apiclient client.APIClient,
 	namespace string,
 	namespace string,

+ 55 - 11
cli/command/stack/deploy.go

@@ -22,6 +22,7 @@ import (
 	"github.com/docker/docker/cli"
 	"github.com/docker/docker/cli"
 	"github.com/docker/docker/cli/command"
 	"github.com/docker/docker/cli/command"
 	servicecmd "github.com/docker/docker/cli/command/service"
 	servicecmd "github.com/docker/docker/cli/command/service"
+	dockerclient "github.com/docker/docker/client"
 	"github.com/docker/docker/opts"
 	"github.com/docker/docker/opts"
 	runconfigopts "github.com/docker/docker/runconfig/opts"
 	runconfigopts "github.com/docker/docker/runconfig/opts"
 	"github.com/docker/go-connections/nat"
 	"github.com/docker/go-connections/nat"
@@ -123,7 +124,10 @@ func deployCompose(ctx context.Context, dockerCli *command.DockerCli, opts deplo
 
 
 	namespace := namespace{name: opts.namespace}
 	namespace := namespace{name: opts.namespace}
 
 
-	networks := convertNetworks(namespace, config.Networks)
+	networks, externalNetworks := convertNetworks(namespace, config.Networks)
+	if err := validateExternalNetworks(ctx, dockerCli, externalNetworks); err != nil {
+		return err
+	}
 	if err := createNetworks(ctx, dockerCli, namespace, networks); err != nil {
 	if err := createNetworks(ctx, dockerCli, namespace, networks); err != nil {
 		return err
 		return err
 	}
 	}
@@ -179,7 +183,7 @@ func getConfigFile(filename string) (*composetypes.ConfigFile, error) {
 func convertNetworks(
 func convertNetworks(
 	namespace namespace,
 	namespace namespace,
 	networks map[string]composetypes.NetworkConfig,
 	networks map[string]composetypes.NetworkConfig,
-) map[string]types.NetworkCreate {
+) (map[string]types.NetworkCreate, []string) {
 	if networks == nil {
 	if networks == nil {
 		networks = make(map[string]composetypes.NetworkConfig)
 		networks = make(map[string]composetypes.NetworkConfig)
 	}
 	}
@@ -187,10 +191,12 @@ func convertNetworks(
 	// TODO: only add default network if it's used
 	// TODO: only add default network if it's used
 	networks["default"] = composetypes.NetworkConfig{}
 	networks["default"] = composetypes.NetworkConfig{}
 
 
+	externalNetworks := []string{}
 	result := make(map[string]types.NetworkCreate)
 	result := make(map[string]types.NetworkCreate)
 
 
 	for internalName, network := range networks {
 	for internalName, network := range networks {
-		if network.External.Name != "" {
+		if network.External.External {
+			externalNetworks = append(externalNetworks, network.External.Name)
 			continue
 			continue
 		}
 		}
 
 
@@ -216,7 +222,29 @@ func convertNetworks(
 		result[internalName] = createOpts
 		result[internalName] = createOpts
 	}
 	}
 
 
-	return result
+	return result, externalNetworks
+}
+
+func validateExternalNetworks(
+	ctx context.Context,
+	dockerCli *command.DockerCli,
+	externalNetworks []string) error {
+	client := dockerCli.Client()
+
+	for _, networkName := range externalNetworks {
+		network, err := client.NetworkInspect(ctx, networkName)
+		if err != nil {
+			if dockerclient.IsErrNetworkNotFound(err) {
+				return fmt.Errorf("network %q is declared as external, but could not be found. You need to create the network before the stack is deployed (with overlay driver)", networkName)
+			}
+			return err
+		}
+		if network.Scope != "swarm" {
+			return fmt.Errorf("network %q is declared as external, but it is not in the right scope: %q instead of %q", networkName, network.Scope, "swarm")
+		}
+	}
+
+	return nil
 }
 }
 
 
 func createNetworks(
 func createNetworks(
@@ -227,7 +255,7 @@ func createNetworks(
 ) error {
 ) error {
 	client := dockerCli.Client()
 	client := dockerCli.Client()
 
 
-	existingNetworks, err := getNetworks(ctx, client, namespace.name)
+	existingNetworks, err := getStackNetworks(ctx, client, namespace.name)
 	if err != nil {
 	if err != nil {
 		return err
 		return err
 	}
 	}
@@ -258,30 +286,39 @@ func createNetworks(
 
 
 func convertServiceNetworks(
 func convertServiceNetworks(
 	networks map[string]*composetypes.ServiceNetworkConfig,
 	networks map[string]*composetypes.ServiceNetworkConfig,
+	networkConfigs map[string]composetypes.NetworkConfig,
 	namespace namespace,
 	namespace namespace,
 	name string,
 	name string,
-) []swarm.NetworkAttachmentConfig {
+) ([]swarm.NetworkAttachmentConfig, error) {
 	if len(networks) == 0 {
 	if len(networks) == 0 {
 		return []swarm.NetworkAttachmentConfig{
 		return []swarm.NetworkAttachmentConfig{
 			{
 			{
 				Target:  namespace.scope("default"),
 				Target:  namespace.scope("default"),
 				Aliases: []string{name},
 				Aliases: []string{name},
 			},
 			},
-		}
+		}, nil
 	}
 	}
 
 
 	nets := []swarm.NetworkAttachmentConfig{}
 	nets := []swarm.NetworkAttachmentConfig{}
 	for networkName, network := range networks {
 	for networkName, network := range networks {
+		networkConfig, ok := networkConfigs[networkName]
+		if !ok {
+			return []swarm.NetworkAttachmentConfig{}, fmt.Errorf("invalid network: %s", networkName)
+		}
 		var aliases []string
 		var aliases []string
 		if network != nil {
 		if network != nil {
 			aliases = network.Aliases
 			aliases = network.Aliases
 		}
 		}
+		target := namespace.scope(networkName)
+		if networkConfig.External.External {
+			target = networkName
+		}
 		nets = append(nets, swarm.NetworkAttachmentConfig{
 		nets = append(nets, swarm.NetworkAttachmentConfig{
-			Target:  namespace.scope(networkName),
+			Target:  target,
 			Aliases: append(aliases, name),
 			Aliases: append(aliases, name),
 		})
 		})
 	}
 	}
-	return nets
+	return nets, nil
 }
 }
 
 
 func convertVolumes(
 func convertVolumes(
@@ -472,9 +509,10 @@ func convertServices(
 
 
 	services := config.Services
 	services := config.Services
 	volumes := config.Volumes
 	volumes := config.Volumes
+	networks := config.Networks
 
 
 	for _, service := range services {
 	for _, service := range services {
-		serviceSpec, err := convertService(namespace, service, volumes)
+		serviceSpec, err := convertService(namespace, service, networks, volumes)
 		if err != nil {
 		if err != nil {
 			return nil, err
 			return nil, err
 		}
 		}
@@ -487,6 +525,7 @@ func convertServices(
 func convertService(
 func convertService(
 	namespace namespace,
 	namespace namespace,
 	service composetypes.ServiceConfig,
 	service composetypes.ServiceConfig,
+	networkConfigs map[string]composetypes.NetworkConfig,
 	volumes map[string]composetypes.VolumeConfig,
 	volumes map[string]composetypes.VolumeConfig,
 ) (swarm.ServiceSpec, error) {
 ) (swarm.ServiceSpec, error) {
 	name := namespace.scope(service.Name)
 	name := namespace.scope(service.Name)
@@ -523,6 +562,11 @@ func convertService(
 		return swarm.ServiceSpec{}, err
 		return swarm.ServiceSpec{}, err
 	}
 	}
 
 
+	networks, err := convertServiceNetworks(service.Networks, networkConfigs, namespace, service.Name)
+	if err != nil {
+		return swarm.ServiceSpec{}, err
+	}
+
 	serviceSpec := swarm.ServiceSpec{
 	serviceSpec := swarm.ServiceSpec{
 		Annotations: swarm.Annotations{
 		Annotations: swarm.Annotations{
 			Name:   name,
 			Name:   name,
@@ -553,7 +597,7 @@ func convertService(
 		},
 		},
 		EndpointSpec: endpoint,
 		EndpointSpec: endpoint,
 		Mode:         mode,
 		Mode:         mode,
-		Networks:     convertServiceNetworks(service.Networks, namespace, service.Name),
+		Networks:     networks,
 		UpdateConfig: convertUpdateConfig(service.Deploy.UpdateConfig),
 		UpdateConfig: convertUpdateConfig(service.Deploy.UpdateConfig),
 	}
 	}
 
 

+ 1 - 1
cli/command/stack/remove.go

@@ -49,7 +49,7 @@ func runRemove(dockerCli *command.DockerCli, opts removeOptions) error {
 		}
 		}
 	}
 	}
 
 
-	networks, err := getNetworks(ctx, client, namespace)
+	networks, err := getStackNetworks(ctx, client, namespace)
 	if err != nil {
 	if err != nil {
 		return err
 		return err
 	}
 	}

+ 1 - 1
container/stream/streams.go

@@ -135,7 +135,7 @@ func (c *Config) CopyToPipe(iop libcontainerd.IOPipe) {
 			go func() {
 			go func() {
 				pools.Copy(iop.Stdin, stdin)
 				pools.Copy(iop.Stdin, stdin)
 				if err := iop.Stdin.Close(); err != nil {
 				if err := iop.Stdin.Close(); err != nil {
-					logrus.Errorf("failed to close stdin: %+v", err)
+					logrus.Warnf("failed to close stdin: %+v", err)
 				}
 				}
 			}()
 			}()
 		}
 		}

+ 221 - 14
contrib/completion/bash/docker

@@ -123,7 +123,7 @@ __docker_complete_container_ids() {
 	COMPREPLY=( $(compgen -W "${containers[*]}" -- "$cur") )
 	COMPREPLY=( $(compgen -W "${containers[*]}" -- "$cur") )
 }
 }
 
 
-__docker_complete_images() {
+__docker_images() {
 	local images_args=""
 	local images_args=""
 
 
 	case "$DOCKER_COMPLETION_SHOW_IMAGE_IDS" in
 	case "$DOCKER_COMPLETION_SHOW_IMAGE_IDS" in
@@ -152,8 +152,11 @@ __docker_complete_images() {
 			;;
 			;;
 	esac
 	esac
 
 
-	local images=$(__docker_q images $images_args | awk "$awk_script")
-	COMPREPLY=( $(compgen -W "$images" -- "$cur") )
+	__docker_q images $images_args | awk "$awk_script" | grep -v '<none>$'
+}
+
+__docker_complete_images() {
+	COMPREPLY=( $(compgen -W "$(__docker_images)" -- "$cur") )
 	__ltrim_colon_completions "$cur"
 	__ltrim_colon_completions "$cur"
 }
 }
 
 
@@ -168,13 +171,6 @@ __docker_complete_image_repos_and_tags() {
 	__ltrim_colon_completions "$cur"
 	__ltrim_colon_completions "$cur"
 }
 }
 
 
-__docker_complete_containers_and_images() {
-	__docker_complete_containers_all
-	local containers=( "${COMPREPLY[@]}" )
-	__docker_complete_images
-	COMPREPLY+=( "${containers[@]}" )
-}
-
 # __docker_networks returns a list of all networks. Additional options to
 # __docker_networks returns a list of all networks. Additional options to
 # `docker network ls` may be specified in order to filter the list, e.g.
 # `docker network ls` may be specified in order to filter the list, e.g.
 # `__docker_networks --filter type=custom`
 # `__docker_networks --filter type=custom`
@@ -315,6 +311,22 @@ __docker_complete_runtimes() {
 	COMPREPLY=( $(compgen -W "$(__docker_runtimes)" -- "$cur") )
 	COMPREPLY=( $(compgen -W "$(__docker_runtimes)" -- "$cur") )
 }
 }
 
 
+# __docker_stacks returns a list of all stacks.
+__docker_stacks() {
+	__docker_q stack ls | awk 'NR>1 {print $1}'
+}
+
+# __docker_complete_stacks applies completion of stacks based on the current value
+# of `$cur` or the value of the optional first option `--cur`, if given.
+__docker_complete_stacks() {
+	local current="$cur"
+	if [ "$1" = "--cur" ] ; then
+		current="$2"
+		shift 2
+	fi
+	COMPREPLY=( $(compgen -W "$(__docker_stacks "$@")" -- "$current") )
+}
+
 # __docker_nodes returns a list of all nodes. Additional options to
 # __docker_nodes returns a list of all nodes. Additional options to
 # `docker node ls` may be specified in order to filter the list, e.g.
 # `docker node ls` may be specified in order to filter the list, e.g.
 # `__docker_nodes --filter role=manager`
 # `__docker_nodes --filter role=manager`
@@ -397,6 +409,13 @@ __docker_append_to_completions() {
 	COMPREPLY=( ${COMPREPLY[@]/%/"$1"} )
 	COMPREPLY=( ${COMPREPLY[@]/%/"$1"} )
 }
 }
 
 
+# __docker_is_experimental tests whether the currently configured Docker daemon
+# runs in experimental mode. If so, the function exits with 0 (true).
+# Otherwise, or if the result cannot be determined, the exit value is 1 (false).
+__docker_is_experimental() {
+	[ "$(__docker_q version -f '{{.Server.Experimental}}')" = "true" ]
+}
+
 # __docker_pos_first_nonflag finds the position of the first word that is neither
 # __docker_pos_first_nonflag finds the position of the first word that is neither
 # option nor an option's argument. If there are options that require arguments,
 # option nor an option's argument. If there are options that require arguments,
 # you should pass a glob describing those options, e.g. "--option1|-o|--option2"
 # you should pass a glob describing those options, e.g. "--option1|-o|--option2"
@@ -839,6 +858,7 @@ _docker_docker() {
 		*)
 		*)
 			local counter=$( __docker_pos_first_nonflag "$(__docker_to_extglob "$global_options_with_args")" )
 			local counter=$( __docker_pos_first_nonflag "$(__docker_to_extglob "$global_options_with_args")" )
 			if [ $cword -eq $counter ]; then
 			if [ $cword -eq $counter ]; then
+				__docker_is_experimental && commands+=(${experimental_commands[*]})
 				COMPREPLY=( $( compgen -W "${commands[*]} help" -- "$cur" ) )
 				COMPREPLY=( $( compgen -W "${commands[*]} help" -- "$cur" ) )
 			fi
 			fi
 			;;
 			;;
@@ -1297,7 +1317,6 @@ _docker_container_run() {
 		--memory-swap
 		--memory-swap
 		--memory-swappiness
 		--memory-swappiness
 		--memory-reservation
 		--memory-reservation
-		--mount
 		--name
 		--name
 		--network
 		--network
 		--network-alias
 		--network-alias
@@ -1863,6 +1882,10 @@ _docker_daemon() {
 	esac
 	esac
 }
 }
 
 
+_docker_deploy() {
+	__docker_is_experimental && _docker_stack_deploy
+}
+
 _docker_diff() {
 _docker_diff() {
 	_docker_container_diff
 	_docker_container_diff
 }
 }
@@ -2253,7 +2276,7 @@ _docker_inspect() {
 			;;
 			;;
 		--type)
 		--type)
 			if [ -z "$preselected_type" ] ; then
 			if [ -z "$preselected_type" ] ; then
-				COMPREPLY=( $( compgen -W "image container" -- "$cur" ) )
+				COMPREPLY=( $( compgen -W "container image network node service volume" -- "$cur" ) )
 				return
 				return
 			fi
 			fi
 			;;
 			;;
@@ -2270,7 +2293,14 @@ _docker_inspect() {
 		*)
 		*)
 			case "$type" in
 			case "$type" in
 				'')
 				'')
-					__docker_complete_containers_and_images
+					COMPREPLY=( $( compgen -W "
+						$(__docker_containers --all)
+						$(__docker_images)
+						$(__docker_networks)
+						$(__docker_nodes)
+						$(__docker_services)
+						$(__docker_volumes)
+					" -- "$cur" ) )
 					;;
 					;;
 				container)
 				container)
 					__docker_complete_containers_all
 					__docker_complete_containers_all
@@ -2278,6 +2308,18 @@ _docker_inspect() {
 				image)
 				image)
 					__docker_complete_images
 					__docker_complete_images
 					;;
 					;;
+				network)
+					__docker_complete_networks
+					;;
+				node)
+					__docker_complete_nodes
+					;;
+				service)
+					__docker_complete_services
+					;;
+				volume)
+					__docker_complete_volumes
+					;;
 			esac
 			esac
 	esac
 	esac
 }
 }
@@ -2623,7 +2665,7 @@ _docker_service_ps() {
 
 
 	case "$cur" in
 	case "$cur" in
 		-*)
 		-*)
-			COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve --no-trunc --quiet -q" -- "$cur" ) )
+			COMPREPLY=( $( compgen -W "--filter -f --help --no-resolve --no-trunc --quiet -q" -- "$cur" ) )
 			;;
 			;;
 		*)
 		*)
 			local counter=$(__docker_pos_first_nonflag '--filter|-f')
 			local counter=$(__docker_pos_first_nonflag '--filter|-f')
@@ -3318,6 +3360,166 @@ _docker_search() {
 	esac
 	esac
 }
 }
 
 
+
+_docker_stack() {
+	local subcommands="
+		deploy
+		ls
+		ps
+		rm
+		services
+	"
+	local aliases="
+		down
+		list
+		remove
+		up
+	"
+	__docker_subcommands "$subcommands $aliases" && return
+
+	case "$cur" in
+		-*)
+			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
+			;;
+		*)
+			COMPREPLY=( $( compgen -W "$subcommands" -- "$cur" ) )
+			;;
+	esac
+}
+
+_docker_stack_deploy() {
+	case "$prev" in
+		--bundle-file)
+			_filedir dab
+			return
+			;;
+		--compose-file|-c)
+			_filedir yml
+			return
+			;;
+	esac
+
+	case "$cur" in
+		-*)
+			COMPREPLY=( $( compgen -W "--bundle-file --compose-file -c --help --with-registry-auth" -- "$cur" ) )
+			;;
+	esac
+}
+
+_docker_stack_down() {
+	_docker_stack_rm
+}
+
+_docker_stack_list() {
+	_docker_stack_ls
+}
+
+_docker_stack_ls() {
+	case "$cur" in
+		-*)
+			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
+			;;
+	esac
+}
+
+_docker_stack_ps() {
+	local key=$(__docker_map_key_of_current_option '--filter|-f')
+	case "$key" in
+		desired-state)
+			COMPREPLY=( $( compgen -W "accepted running" -- "${cur##*=}" ) )
+			return
+			;;
+		id)
+			__docker_complete_stacks --cur "${cur##*=}" --id
+			return
+			;;
+		name)
+			__docker_complete_stacks --cur "${cur##*=}" --name
+			return
+			;;
+	esac
+
+	case "$prev" in
+		--filter|-f)
+			COMPREPLY=( $( compgen -S = -W "id name desired-state" -- "$cur" ) )
+			__docker_nospace
+			return
+			;;
+	esac
+
+	case "$cur" in
+		-*)
+			COMPREPLY=( $( compgen -W "--all -a --filter -f --help --no-resolve --no-trunc" -- "$cur" ) )
+			;;
+		*)
+			local counter=$(__docker_pos_first_nonflag '--filter|-f')
+			if [ $cword -eq $counter ]; then
+				__docker_complete_stacks
+			fi
+			;;
+	esac
+}
+
+_docker_stack_remove() {
+	_docker_stack_rm
+}
+
+_docker_stack_rm() {
+	case "$cur" in
+		-*)
+			COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
+			;;
+		*)
+			local counter=$(__docker_pos_first_nonflag)
+			if [ $cword -eq $counter ]; then
+				__docker_complete_stacks
+			fi
+			;;
+	esac
+}
+
+_docker_stack_services() {
+	local key=$(__docker_map_key_of_current_option '--filter|-f')
+	case "$key" in
+		id)
+			__docker_complete_services --cur "${cur##*=}" --id
+			return
+			;;
+		label)
+			return
+			;;
+		name)
+			__docker_complete_services --cur "${cur##*=}" --name
+			return
+			;;
+	esac
+
+	case "$prev" in
+		--filter|-f)
+			COMPREPLY=( $( compgen -S = -W "id label name" -- "$cur" ) )
+			__docker_nospace
+			return
+			;;
+	esac
+
+	case "$cur" in
+		-*)
+			COMPREPLY=( $( compgen -W "--filter -f --help --quiet -q" -- "$cur" ) )
+			;;
+		*)
+			local counter=$(__docker_pos_first_nonflag '--filter|-f')
+			if [ $cword -eq $counter ]; then
+				__docker_complete_stacks
+			fi
+			;;
+	esac
+}
+
+_docker_stack_up() {
+	_docker_stack_deploy
+}
+
+
 _docker_start() {
 _docker_start() {
 	_docker_container_start
 	_docker_container_start
 }
 }
@@ -3651,6 +3853,7 @@ _docker() {
 		save
 		save
 		search
 		search
 		service
 		service
+		stack
 		start
 		start
 		stats
 		stats
 		stop
 		stop
@@ -3665,6 +3868,10 @@ _docker() {
 		wait
 		wait
 	)
 	)
 
 
+	local experimental_commands=(
+		deploy
+	)
+
 	# 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="

+ 0 - 2
contrib/completion/fish/docker.fish

@@ -137,7 +137,6 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l link -d 'Add
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -s m -l memory -d 'Memory limit (format: <number>[<unit>], where unit = b, k, m or g)'
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -s m -l memory -d 'Memory limit (format: <number>[<unit>], where unit = b, k, m or g)'
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l mac-address -d 'Container MAC address (e.g. 92:d0:c6:0a:29:33)'
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l mac-address -d 'Container MAC address (e.g. 92:d0:c6:0a:29:33)'
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l memory-swap -d "Total memory usage (memory + swap), set '-1' to disable swap (format: <number>[<unit>], where unit = b, k, m or g)"
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l memory-swap -d "Total memory usage (memory + swap), set '-1' to disable swap (format: <number>[<unit>], where unit = b, k, m or g)"
-complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l mount -d 'Attach a filesystem mount to the container'
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l name -d 'Assign a name to the container'
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l name -d 'Assign a name to the container'
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l net -d 'Set the Network mode for the container'
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -l net -d 'Set the Network mode for the container'
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -s P -l publish-all -d 'Publish all exposed ports to random ports on the host interfaces'
 complete -c docker -A -f -n '__fish_seen_subcommand_from create' -s P -l publish-all -d 'Publish all exposed ports to random ports on the host interfaces'
@@ -329,7 +328,6 @@ complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l link -d 'Add li
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s m -l memory -d 'Memory limit (format: <number>[<unit>], where unit = b, k, m or g)'
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s m -l memory -d 'Memory limit (format: <number>[<unit>], where unit = b, k, m or g)'
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l mac-address -d 'Container MAC address (e.g. 92:d0:c6:0a:29:33)'
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l mac-address -d 'Container MAC address (e.g. 92:d0:c6:0a:29:33)'
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l memory-swap -d "Total memory usage (memory + swap), set '-1' to disable swap (format: <number>[<unit>], where unit = b, k, m or g)"
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l memory-swap -d "Total memory usage (memory + swap), set '-1' to disable swap (format: <number>[<unit>], where unit = b, k, m or g)"
-complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l mount -d 'Attach a filesystem mount to the container'
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l name -d 'Assign a name to the container'
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l name -d 'Assign a name to the container'
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l net -d 'Set the Network mode for the container'
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -l net -d 'Set the Network mode for the container'
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s P -l publish-all -d 'Publish all exposed ports to random ports on the host interfaces'
 complete -c docker -A -f -n '__fish_seen_subcommand_from run' -s P -l publish-all -d 'Publish all exposed ports to random ports on the host interfaces'

+ 158 - 1
contrib/completion/zsh/_docker

@@ -551,7 +551,6 @@ __docker_container_subcommand() {
         "($help)--log-driver=[Default driver for container logs]:logging driver:__docker_complete_log_drivers"
         "($help)--log-driver=[Default driver for container logs]:logging driver:__docker_complete_log_drivers"
         "($help)*--log-opt=[Log driver specific options]:log driver options:__docker_complete_log_options"
         "($help)*--log-opt=[Log driver specific options]:log driver options:__docker_complete_log_options"
         "($help)--mac-address=[Container MAC address]:MAC address: "
         "($help)--mac-address=[Container MAC address]:MAC address: "
-        "($help)*--mount=[Attach a filesystem mount to the container]:mount: "
         "($help)--name=[Container name]:name: "
         "($help)--name=[Container name]:name: "
         "($help)--network=[Connect a container to a network]:network mode:(bridge none container host)"
         "($help)--network=[Connect a container to a network]:network mode:(bridge none container host)"
         "($help)*--network-alias=[Add network-scoped alias for the container]:alias: "
         "($help)*--network-alias=[Add network-scoped alias for the container]:alias: "
@@ -1883,6 +1882,147 @@ __docker_service_subcommand() {
 
 
 # EO service
 # EO service
 
 
+# BO stack
+
+__docker_stack_complete_ps_filters() {
+    [[ $PREFIX = -* ]] && return 1
+    integer ret=1
+
+    if compset -P '*='; then
+        case "${${words[-1]%=*}#*=}" in
+            (desired-state)
+                state_opts=('accepted' 'running')
+                _describe -t state-opts "desired state options" state_opts && ret=0
+                ;;
+            *)
+                _message 'value' && ret=0
+                ;;
+        esac
+    else
+        opts=('desired-state' 'id' 'name')
+        _describe -t filter-opts "filter options" opts -qS "=" && ret=0
+    fi
+
+    return ret
+}
+
+__docker_stack_complete_services_filters() {
+    [[ $PREFIX = -* ]] && return 1
+    integer ret=1
+
+    if compset -P '*='; then
+        case "${${words[-1]%=*}#*=}" in
+            *)
+                _message 'value' && ret=0
+                ;;
+        esac
+    else
+        opts=('id' 'label' 'name')
+        _describe -t filter-opts "filter options" opts -qS "=" && ret=0
+    fi
+
+    return ret
+}
+
+__docker_stacks() {
+    [[ $PREFIX = -* ]] && return 1
+    integer ret=1
+    local line s
+    declare -a lines stacks
+
+    lines=(${(f)${:-"$(_call_program commands docker $docker_options stack ls)"$'\n'}})
+
+    # Parse header line to find columns
+    local i=1 j=1 k header=${lines[1]}
+    declare -A begin end
+    while (( j < ${#header} - 1 )); do
+        i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 ))
+        j=$(( i + ${${header[$i,-1]}[(i)  ]} - 1 ))
+        k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 ))
+        begin[${header[$i,$((j-1))]}]=$i
+        end[${header[$i,$((j-1))]}]=$k
+    done
+    end[${header[$i,$((j-1))]}]=-1
+    lines=(${lines[2,-1]})
+
+    # Service ID
+    for line in $lines; do
+        s="${line[${begin[ID]},${end[ID]}]%% ##}"
+        stacks=($stacks $s)
+    done
+
+    _describe -t stacks-list "stacks" stacks "$@" && ret=0
+    return ret
+}
+
+__docker_complete_stacks() {
+    [[ $PREFIX = -* ]] && return 1
+    __docker_stacks "$@"
+}
+
+__docker_stack_commands() {
+    local -a _docker_stack_subcommands
+    _docker_stack_subcommands=(
+        "deploy:Deploy a new stack or update an existing stack"
+        "ls:List stacks"
+        "ps:List the tasks in the stack"
+        "rm:Remove the stack"
+        "services:List the services in the stack"
+    )
+    _describe -t docker-stack-commands "docker stack command" _docker_stack_subcommands
+}
+
+__docker_stack_subcommand() {
+    local -a _command_args opts_help
+    local expl help="--help"
+    integer ret=1
+
+    opts_help=("(: -)--help[Print usage]")
+
+    case "$words[1]" in
+        (deploy|up)
+            _arguments $(__docker_arguments) \
+                $opts_help \
+                "($help)--bundle-file=[Path to a Distributed Application Bundle file]:dab:_files -g \"*.dab\"" \
+                "($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file]:compose file:_files -g \"*.(yml|yaml)\"" \
+                "($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \
+                "($help -):stack:__docker_complete_stacks" && ret=0
+            ;;
+        (ls|list)
+            _arguments $(__docker_arguments) \
+                $opts_help && ret=0
+            ;;
+        (ps)
+            _arguments $(__docker_arguments) \
+                $opts_help \
+                "($help -a --all)"{-a,--all}"[Display all tasks]" \
+                "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_stack_complete_ps_filters" \
+                "($help)--no-resolve[Do not map IDs to Names]" \
+                "($help)--no-trunc[Do not truncate output]" \
+                "($help -):stack:__docker_complete_stacks" && ret=0
+            ;;
+        (rm|remove|down)
+            _arguments $(__docker_arguments) \
+                $opts_help \
+                "($help -):stack:__docker_complete_stacks" && ret=0
+            ;;
+        (services)
+            _arguments $(__docker_arguments) \
+                $opts_help \
+                "($help)*"{-f=,--filter=}"[Filter output based on conditions provided]:filter:__docker_stack_complete_services_filters" \
+                "($help -q --quiet)"{-q,--quiet}"[Only display IDs]" \
+                "($help -):stack:__docker_complete_stacks" && ret=0
+            ;;
+        (help)
+            _arguments $(__docker_arguments) ":subcommand:__docker_stack_commands" && ret=0
+            ;;
+    esac
+
+    return ret
+}
+
+# EO stack
+
 # BO swarm
 # BO swarm
 
 
 __docker_swarm_commands() {
 __docker_swarm_commands() {
@@ -2451,6 +2591,23 @@ __docker_subcommand() {
                     ;;
                     ;;
             esac
             esac
             ;;
             ;;
+        (stack)
+            local curcontext="$curcontext" state
+            _arguments $(__docker_arguments) \
+                $opts_help \
+                "($help -): :->command" \
+                "($help -)*:: :->option-or-argument" && ret=0
+
+            case $state in
+                (command)
+                    __docker_stack_commands && ret=0
+                    ;;
+                (option-or-argument)
+                    curcontext=${curcontext%:*:*}:docker-${words[-1]}:
+                    __docker_stack_subcommand && ret=0
+                    ;;
+            esac
+            ;;
         (swarm)
         (swarm)
             local curcontext="$curcontext" state
             local curcontext="$curcontext" state
             _arguments $(__docker_arguments) \
             _arguments $(__docker_arguments) \

+ 4 - 0
daemon/cluster/cluster.go

@@ -16,6 +16,7 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/Sirupsen/logrus"
 	"github.com/Sirupsen/logrus"
+	"github.com/docker/distribution/digest"
 	distreference "github.com/docker/distribution/reference"
 	distreference "github.com/docker/distribution/reference"
 	apierrors "github.com/docker/docker/api/errors"
 	apierrors "github.com/docker/docker/api/errors"
 	apitypes "github.com/docker/docker/api/types"
 	apitypes "github.com/docker/docker/api/types"
@@ -1024,6 +1025,9 @@ func (c *Cluster) GetServices(options apitypes.ServiceListOptions) ([]types.Serv
 // TODO(nishanttotla): After the packages converge, the function must
 // TODO(nishanttotla): After the packages converge, the function must
 // convert distreference.Named -> distreference.Canonical, and the logic simplified.
 // convert distreference.Named -> distreference.Canonical, and the logic simplified.
 func (c *Cluster) imageWithDigestString(ctx context.Context, image string, authConfig *apitypes.AuthConfig) (string, error) {
 func (c *Cluster) imageWithDigestString(ctx context.Context, image string, authConfig *apitypes.AuthConfig) (string, error) {
+	if _, err := digest.ParseDigest(image); err == nil {
+		return "", errors.New("image reference is an image ID")
+	}
 	ref, err := distreference.ParseNamed(image)
 	ref, err := distreference.ParseNamed(image)
 	if err != nil {
 	if err != nil {
 		return "", err
 		return "", err

+ 14 - 2
daemon/cluster/convert/container.go

@@ -64,6 +64,13 @@ func containerSpecFromGRPC(c *swarmapi.ContainerSpec) types.ContainerSpec {
 				}
 				}
 			}
 			}
 		}
 		}
+
+		if m.TmpfsOptions != nil {
+			mount.TmpfsOptions = &mounttypes.TmpfsOptions{
+				SizeBytes: m.TmpfsOptions.SizeBytes,
+				Mode:      m.TmpfsOptions.Mode,
+			}
+		}
 		containerSpec.Mounts = append(containerSpec.Mounts, mount)
 		containerSpec.Mounts = append(containerSpec.Mounts, mount)
 	}
 	}
 
 
@@ -174,9 +181,7 @@ func containerToGRPC(c types.ContainerSpec) (*swarmapi.ContainerSpec, error) {
 				mount.BindOptions = &swarmapi.Mount_BindOptions{Propagation: swarmapi.Mount_BindOptions_MountPropagation(mountPropagation)}
 				mount.BindOptions = &swarmapi.Mount_BindOptions{Propagation: swarmapi.Mount_BindOptions_MountPropagation(mountPropagation)}
 			} else if string(m.BindOptions.Propagation) != "" {
 			} else if string(m.BindOptions.Propagation) != "" {
 				return nil, fmt.Errorf("invalid MountPropagation: %q", m.BindOptions.Propagation)
 				return nil, fmt.Errorf("invalid MountPropagation: %q", m.BindOptions.Propagation)
-
 			}
 			}
-
 		}
 		}
 
 
 		if m.VolumeOptions != nil {
 		if m.VolumeOptions != nil {
@@ -192,6 +197,13 @@ func containerToGRPC(c types.ContainerSpec) (*swarmapi.ContainerSpec, error) {
 			}
 			}
 		}
 		}
 
 
+		if m.TmpfsOptions != nil {
+			mount.TmpfsOptions = &swarmapi.Mount_TmpfsOptions{
+				SizeBytes: m.TmpfsOptions.SizeBytes,
+				Mode:      m.TmpfsOptions.Mode,
+			}
+		}
+
 		containerSpec.Mounts = append(containerSpec.Mounts, mount)
 		containerSpec.Mounts = append(containerSpec.Mounts, mount)
 	}
 	}
 
 

+ 6 - 0
daemon/cluster/executor/container/adapter.go

@@ -10,6 +10,7 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/Sirupsen/logrus"
 	"github.com/Sirupsen/logrus"
+	"github.com/docker/distribution/digest"
 	"github.com/docker/docker/api/server/httputils"
 	"github.com/docker/docker/api/server/httputils"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/backend"
 	"github.com/docker/docker/api/types/backend"
@@ -53,6 +54,11 @@ func newContainerAdapter(b executorpkg.Backend, task *api.Task, secrets exec.Sec
 func (c *containerAdapter) pullImage(ctx context.Context) error {
 func (c *containerAdapter) pullImage(ctx context.Context) error {
 	spec := c.container.spec()
 	spec := c.container.spec()
 
 
+	// Skip pulling if the image is referenced by image ID.
+	if _, err := digest.ParseDigest(spec.Image); err == nil {
+		return nil
+	}
+
 	// Skip pulling if the image is referenced by digest and already
 	// Skip pulling if the image is referenced by digest and already
 	// exists locally.
 	// exists locally.
 	named, err := reference.ParseNamed(spec.Image)
 	named, err := reference.ParseNamed(spec.Image)

+ 5 - 0
daemon/commit.go

@@ -46,6 +46,11 @@ func merge(userConf, imageConf *containertypes.Config) error {
 			imageEnvKey := strings.Split(imageEnv, "=")[0]
 			imageEnvKey := strings.Split(imageEnv, "=")[0]
 			for _, userEnv := range userConf.Env {
 			for _, userEnv := range userConf.Env {
 				userEnvKey := strings.Split(userEnv, "=")[0]
 				userEnvKey := strings.Split(userEnv, "=")[0]
+				if runtime.GOOS == "windows" {
+					// Case insensitive environment variables on Windows
+					imageEnvKey = strings.ToUpper(imageEnvKey)
+					userEnvKey = strings.ToUpper(userEnvKey)
+				}
 				if imageEnvKey == userEnvKey {
 				if imageEnvKey == userEnvKey {
 					found = true
 					found = true
 					break
 					break

+ 3 - 3
daemon/container.go

@@ -268,11 +268,11 @@ func (daemon *Daemon) verifyContainerSettings(hostConfig *containertypes.HostCon
 	switch p.Name {
 	switch p.Name {
 	case "always", "unless-stopped", "no":
 	case "always", "unless-stopped", "no":
 		if p.MaximumRetryCount != 0 {
 		if p.MaximumRetryCount != 0 {
-			return nil, fmt.Errorf("maximum restart count not valid with restart policy of '%s'", p.Name)
+			return nil, fmt.Errorf("maximum retry count cannot be used with restart policy '%s'", p.Name)
 		}
 		}
 	case "on-failure":
 	case "on-failure":
-		if p.MaximumRetryCount < 1 {
-			return nil, fmt.Errorf("maximum restart count must be a positive integer")
+		if p.MaximumRetryCount < 0 {
+			return nil, fmt.Errorf("maximum retry count cannot be negative")
 		}
 		}
 	case "":
 	case "":
 	// do nothing
 	// do nothing

+ 17 - 22
daemon/daemon.go

@@ -40,7 +40,6 @@ import (
 	"github.com/docker/docker/libcontainerd"
 	"github.com/docker/docker/libcontainerd"
 	"github.com/docker/docker/migrate/v1"
 	"github.com/docker/docker/migrate/v1"
 	"github.com/docker/docker/pkg/fileutils"
 	"github.com/docker/docker/pkg/fileutils"
-	"github.com/docker/docker/pkg/graphdb"
 	"github.com/docker/docker/pkg/idtools"
 	"github.com/docker/docker/pkg/idtools"
 	"github.com/docker/docker/pkg/plugingetter"
 	"github.com/docker/docker/pkg/plugingetter"
 	"github.com/docker/docker/pkg/progress"
 	"github.com/docker/docker/pkg/progress"
@@ -158,7 +157,6 @@ func (daemon *Daemon) restore() error {
 		}
 		}
 	}
 	}
 
 
-	var migrateLegacyLinks bool
 	removeContainers := make(map[string]*container.Container)
 	removeContainers := make(map[string]*container.Container)
 	restartContainers := make(map[*container.Container]chan struct{})
 	restartContainers := make(map[*container.Container]chan struct{})
 	activeSandboxes := make(map[string]interface{})
 	activeSandboxes := make(map[string]interface{})
@@ -190,6 +188,8 @@ func (daemon *Daemon) restore() error {
 			}
 			}
 		}
 		}
 	}
 	}
+
+	var migrateLegacyLinks bool // Not relevant on Windows
 	var wg sync.WaitGroup
 	var wg sync.WaitGroup
 	var mapLock sync.Mutex
 	var mapLock sync.Mutex
 	for _, c := range containers {
 	for _, c := range containers {
@@ -265,24 +265,15 @@ func (daemon *Daemon) restore() error {
 		return fmt.Errorf("Error initializing network controller: %v", err)
 		return fmt.Errorf("Error initializing network controller: %v", err)
 	}
 	}
 
 
-	// migrate any legacy links from sqlite
-	linkdbFile := filepath.Join(daemon.root, "linkgraph.db")
-	var legacyLinkDB *graphdb.Database
+	// Perform migration of legacy sqlite links (no-op on Windows)
 	if migrateLegacyLinks {
 	if migrateLegacyLinks {
-		legacyLinkDB, err = graphdb.NewSqliteConn(linkdbFile)
-		if err != nil {
-			return fmt.Errorf("error connecting to legacy link graph DB %s, container links may be lost: %v", linkdbFile, err)
+		if err := daemon.sqliteMigration(containers); err != nil {
+			return err
 		}
 		}
-		defer legacyLinkDB.Close()
 	}
 	}
 
 
 	// Now that all the containers are registered, register the links
 	// Now that all the containers are registered, register the links
 	for _, c := range containers {
 	for _, c := range containers {
-		if migrateLegacyLinks {
-			if err := daemon.migrateLegacySqliteLinks(legacyLinkDB, c); err != nil {
-				return err
-			}
-		}
 		if err := daemon.registerLinks(c, c.HostConfig); err != nil {
 		if err := daemon.registerLinks(c, c.HostConfig); err != nil {
 			logrus.Errorf("failed to register link for container %s: %v", c.ID, err)
 			logrus.Errorf("failed to register link for container %s: %v", c.ID, err)
 		}
 		}
@@ -692,7 +683,11 @@ func NewDaemon(config *Config, registryService registry.Service, containerdRemot
 
 
 	// set up SIGUSR1 handler on Unix-like systems, or a Win32 global event
 	// set up SIGUSR1 handler on Unix-like systems, or a Win32 global event
 	// on Windows to dump Go routine stacks
 	// on Windows to dump Go routine stacks
-	d.setupDumpStackTrap(config.Root)
+	stackDumpDir := config.Root
+	if execRoot := config.GetExecRoot(); execRoot != "" {
+		stackDumpDir = execRoot
+	}
+	d.setupDumpStackTrap(stackDumpDir)
 
 
 	return d, nil
 	return d, nil
 }
 }
@@ -792,7 +787,13 @@ func (daemon *Daemon) Shutdown() error {
 		})
 		})
 	}
 	}
 
 
-	// Shutdown plugins after containers. Dont change the order.
+	if daemon.layerStore != nil {
+		if err := daemon.layerStore.Cleanup(); err != nil {
+			logrus.Errorf("Error during layer Store.Cleanup(): %v", err)
+		}
+	}
+
+	// Shutdown plugins after containers and layerstore. Don't change the order.
 	daemon.pluginShutdown()
 	daemon.pluginShutdown()
 
 
 	// trigger libnetwork Stop only if it's initialized
 	// trigger libnetwork Stop only if it's initialized
@@ -800,12 +801,6 @@ func (daemon *Daemon) Shutdown() error {
 		daemon.netController.Stop()
 		daemon.netController.Stop()
 	}
 	}
 
 
-	if daemon.layerStore != nil {
-		if err := daemon.layerStore.Cleanup(); err != nil {
-			logrus.Errorf("Error during layer Store.Cleanup(): %v", err)
-		}
-	}
-
 	if err := daemon.cleanupMounts(); err != nil {
 	if err := daemon.cleanupMounts(); err != nil {
 		return err
 		return err
 	}
 	}

+ 0 - 41
daemon/links.go

@@ -1,12 +1,9 @@
 package daemon
 package daemon
 
 
 import (
 import (
-	"strings"
 	"sync"
 	"sync"
 
 
-	"github.com/Sirupsen/logrus"
 	"github.com/docker/docker/container"
 	"github.com/docker/docker/container"
-	"github.com/docker/docker/pkg/graphdb"
 )
 )
 
 
 // linkIndex stores link relationships between containers, including their specified alias
 // linkIndex stores link relationships between containers, including their specified alias
@@ -88,41 +85,3 @@ func (l *linkIndex) delete(container *container.Container) {
 	delete(l.childIdx, container)
 	delete(l.childIdx, container)
 	l.mu.Unlock()
 	l.mu.Unlock()
 }
 }
-
-// migrateLegacySqliteLinks migrates sqlite links to use links from HostConfig
-// when sqlite links were used, hostConfig.Links was set to nil
-func (daemon *Daemon) migrateLegacySqliteLinks(db *graphdb.Database, container *container.Container) error {
-	// if links is populated (or an empty slice), then this isn't using sqlite links and can be skipped
-	if container.HostConfig == nil || container.HostConfig.Links != nil {
-		return nil
-	}
-
-	logrus.Debugf("migrating legacy sqlite link info for container: %s", container.ID)
-
-	fullName := container.Name
-	if fullName[0] != '/' {
-		fullName = "/" + fullName
-	}
-
-	// don't use a nil slice, this ensures that the check above will skip once the migration has completed
-	links := []string{}
-	children, err := db.Children(fullName, 0)
-	if err != nil {
-		if !strings.Contains(err.Error(), "Cannot find child for") {
-			return err
-		}
-		// else continue... it's ok if we didn't find any children, it'll just be nil and we can continue the migration
-	}
-
-	for _, child := range children {
-		c, err := daemon.GetContainer(child.Entity.ID())
-		if err != nil {
-			return err
-		}
-
-		links = append(links, c.Name+":"+child.Edge.Name)
-	}
-
-	container.HostConfig.Links = links
-	return container.WriteHostConfig()
-}

+ 72 - 0
daemon/links_linux.go

@@ -0,0 +1,72 @@
+package daemon
+
+import (
+	"fmt"
+	"path/filepath"
+	"strings"
+
+	"github.com/Sirupsen/logrus"
+	"github.com/docker/docker/container"
+	"github.com/docker/docker/pkg/graphdb"
+)
+
+// migrateLegacySqliteLinks migrates sqlite links to use links from HostConfig
+// when sqlite links were used, hostConfig.Links was set to nil
+func (daemon *Daemon) migrateLegacySqliteLinks(db *graphdb.Database, container *container.Container) error {
+	// if links is populated (or an empty slice), then this isn't using sqlite links and can be skipped
+	if container.HostConfig == nil || container.HostConfig.Links != nil {
+		return nil
+	}
+
+	logrus.Debugf("migrating legacy sqlite link info for container: %s", container.ID)
+
+	fullName := container.Name
+	if fullName[0] != '/' {
+		fullName = "/" + fullName
+	}
+
+	// don't use a nil slice, this ensures that the check above will skip once the migration has completed
+	links := []string{}
+	children, err := db.Children(fullName, 0)
+	if err != nil {
+		if !strings.Contains(err.Error(), "Cannot find child for") {
+			return err
+		}
+		// else continue... it's ok if we didn't find any children, it'll just be nil and we can continue the migration
+	}
+
+	for _, child := range children {
+		c, err := daemon.GetContainer(child.Entity.ID())
+		if err != nil {
+			return err
+		}
+
+		links = append(links, c.Name+":"+child.Edge.Name)
+	}
+
+	container.HostConfig.Links = links
+	return container.WriteHostConfig()
+}
+
+// sqliteMigration performs the link graph DB migration.
+func (daemon *Daemon) sqliteMigration(containers map[string]*container.Container) error {
+	// migrate any legacy links from sqlite
+	linkdbFile := filepath.Join(daemon.root, "linkgraph.db")
+	var (
+		legacyLinkDB *graphdb.Database
+		err          error
+	)
+
+	legacyLinkDB, err = graphdb.NewSqliteConn(linkdbFile)
+	if err != nil {
+		return fmt.Errorf("error connecting to legacy link graph DB %s, container links may be lost: %v", linkdbFile, err)
+	}
+	defer legacyLinkDB.Close()
+
+	for _, c := range containers {
+		if err := daemon.migrateLegacySqliteLinks(legacyLinkDB, c); err != nil {
+			return err
+		}
+	}
+	return nil
+}

+ 0 - 0
daemon/links_test.go → daemon/links_linux_test.go


+ 10 - 0
daemon/links_notlinux.go

@@ -0,0 +1,10 @@
+// +build !linux
+
+package daemon
+
+import "github.com/docker/docker/container"
+
+// sqliteMigration performs the link graph DB migration. No-op on platforms other than Linux
+func (daemon *Daemon) sqliteMigration(_ map[string]*container.Container) error {
+	return nil
+}

+ 1 - 1
daemon/logger/logger.go

@@ -49,7 +49,7 @@ func CopyMessage(msg *Message) *Message {
 	m.Timestamp = msg.Timestamp
 	m.Timestamp = msg.Timestamp
 	m.Partial = msg.Partial
 	m.Partial = msg.Partial
 	m.Attrs = make(LogAttributes)
 	m.Attrs = make(LogAttributes)
-	for k, v := range m.Attrs {
+	for k, v := range msg.Attrs {
 		m.Attrs[k] = v
 		m.Attrs[k] = v
 	}
 	}
 	return m
 	return m

+ 26 - 0
daemon/logger/logger_test.go

@@ -0,0 +1,26 @@
+package logger
+
+import (
+	"reflect"
+	"testing"
+	"time"
+)
+
+func TestCopyMessage(t *testing.T) {
+	msg := &Message{
+		Line:      []byte("test line."),
+		Source:    "stdout",
+		Timestamp: time.Now(),
+		Attrs: LogAttributes{
+			"key1": "val1",
+			"key2": "val2",
+			"key3": "val3",
+		},
+		Partial: true,
+	}
+
+	m := CopyMessage(msg)
+	if !reflect.DeepEqual(m, msg) {
+		t.Fatalf("CopyMessage failed to copy message")
+	}
+}

+ 4 - 0
distribution/errors.go

@@ -6,6 +6,7 @@ import (
 	"syscall"
 	"syscall"
 
 
 	"github.com/Sirupsen/logrus"
 	"github.com/Sirupsen/logrus"
+	"github.com/docker/distribution"
 	"github.com/docker/distribution/registry/api/errcode"
 	"github.com/docker/distribution/registry/api/errcode"
 	"github.com/docker/distribution/registry/api/v2"
 	"github.com/docker/distribution/registry/api/v2"
 	"github.com/docker/distribution/registry/client"
 	"github.com/docker/distribution/registry/client"
@@ -139,6 +140,9 @@ func retryOnError(err error) error {
 	case *client.UnexpectedHTTPResponseError:
 	case *client.UnexpectedHTTPResponseError:
 		return xfer.DoNotRetry{Err: err}
 		return xfer.DoNotRetry{Err: err}
 	case error:
 	case error:
+		if err == distribution.ErrBlobUnknown {
+			return xfer.DoNotRetry{Err: err}
+		}
 		if strings.Contains(err.Error(), strings.ToLower(syscall.ENOSPC.Error())) {
 		if strings.Contains(err.Error(), strings.ToLower(syscall.ENOSPC.Error())) {
 			return xfer.DoNotRetry{Err: err}
 			return xfer.DoNotRetry{Err: err}
 		}
 		}

+ 0 - 3
distribution/pull_v2.go

@@ -189,9 +189,6 @@ func (ld *v2LayerDescriptor) Download(ctx context.Context, progressOutput progre
 	layerDownload, err := ld.open(ctx)
 	layerDownload, err := ld.open(ctx)
 	if err != nil {
 	if err != nil {
 		logrus.Errorf("Error initiating layer download: %v", err)
 		logrus.Errorf("Error initiating layer download: %v", err)
-		if err == distribution.ErrBlobUnknown {
-			return nil, 0, xfer.DoNotRetry{Err: err}
-		}
 		return nil, 0, retryOnError(err)
 		return nil, 0, retryOnError(err)
 	}
 	}
 
 

+ 3 - 3
distribution/push_v2.go

@@ -523,6 +523,7 @@ func (pd *v2PushDescriptor) layerAlreadyExists(
 		layerDigests = append(layerDigests, meta.Digest)
 		layerDigests = append(layerDigests, meta.Digest)
 	}
 	}
 
 
+attempts:
 	for _, dgst := range layerDigests {
 	for _, dgst := range layerDigests {
 		meta := digestToMetadata[dgst]
 		meta := digestToMetadata[dgst]
 		logrus.Debugf("Checking for presence of layer %s (%s) in %s", diffID, dgst, pd.repoInfo.FullName())
 		logrus.Debugf("Checking for presence of layer %s (%s) in %s", diffID, dgst, pd.repoInfo.FullName())
@@ -541,15 +542,14 @@ func (pd *v2PushDescriptor) layerAlreadyExists(
 			}
 			}
 			desc.MediaType = schema2.MediaTypeLayer
 			desc.MediaType = schema2.MediaTypeLayer
 			exists = true
 			exists = true
-			break
+			break attempts
 		case distribution.ErrBlobUnknown:
 		case distribution.ErrBlobUnknown:
 			if meta.SourceRepository == pd.repoInfo.FullName() {
 			if meta.SourceRepository == pd.repoInfo.FullName() {
 				// remove the mapping to the target repository
 				// remove the mapping to the target repository
 				pd.v2MetadataService.Remove(*meta)
 				pd.v2MetadataService.Remove(*meta)
 			}
 			}
 		default:
 		default:
-			progress.Update(progressOutput, pd.ID(), "Image push failed")
-			return desc, false, retryOnError(err)
+			logrus.WithError(err).Debugf("Failed to check for presence of layer %s (%s) in %s", diffID, dgst, pd.repoInfo.FullName())
 		}
 		}
 	}
 	}
 
 

+ 8 - 5
distribution/push_v2_test.go

@@ -180,7 +180,7 @@ func TestLayerAlreadyExists(t *testing.T) {
 			maxExistenceChecks: 1,
 			maxExistenceChecks: 1,
 			metadata:           []metadata.V2Metadata{{Digest: digest.Digest("apple"), SourceRepository: "docker.io/library/busybox"}},
 			metadata:           []metadata.V2Metadata{{Digest: digest.Digest("apple"), SourceRepository: "docker.io/library/busybox"}},
 			remoteErrors:       map[digest.Digest]error{digest.Digest("apple"): distribution.ErrAccessDenied},
 			remoteErrors:       map[digest.Digest]error{digest.Digest("apple"): distribution.ErrAccessDenied},
-			expectedError:      distribution.ErrAccessDenied,
+			expectedError:      nil,
 			expectedRequests:   []string{"apple"},
 			expectedRequests:   []string{"apple"},
 		},
 		},
 		{
 		{
@@ -310,7 +310,7 @@ func TestLayerAlreadyExists(t *testing.T) {
 			expectedRemovals:   []metadata.V2Metadata{taggedMetadata("key3", "apple", "docker.io/library/busybox")},
 			expectedRemovals:   []metadata.V2Metadata{taggedMetadata("key3", "apple", "docker.io/library/busybox")},
 		},
 		},
 		{
 		{
-			name:       "stop on first error",
+			name:       "don't stop on first error",
 			targetRepo: "user/app",
 			targetRepo: "user/app",
 			hmacKey:    "key",
 			hmacKey:    "key",
 			metadata: []metadata.V2Metadata{
 			metadata: []metadata.V2Metadata{
@@ -321,9 +321,12 @@ func TestLayerAlreadyExists(t *testing.T) {
 			maxExistenceChecks: 3,
 			maxExistenceChecks: 3,
 			remoteErrors:       map[digest.Digest]error{"orange": distribution.ErrAccessDenied},
 			remoteErrors:       map[digest.Digest]error{"orange": distribution.ErrAccessDenied},
 			remoteBlobs:        map[digest.Digest]distribution.Descriptor{digest.Digest("apple"): {}},
 			remoteBlobs:        map[digest.Digest]distribution.Descriptor{digest.Digest("apple"): {}},
-			expectedError:      distribution.ErrAccessDenied,
-			expectedRequests:   []string{"plum", "orange"},
-			expectedRemovals:   []metadata.V2Metadata{taggedMetadata("key", "plum", "docker.io/user/app")},
+			expectedError:      nil,
+			expectedRequests:   []string{"plum", "orange", "banana"},
+			expectedRemovals: []metadata.V2Metadata{
+				taggedMetadata("key", "plum", "docker.io/user/app"),
+				taggedMetadata("key", "banana", "docker.io/user/app"),
+			},
 		},
 		},
 		{
 		{
 			name:       "remove outdated metadata",
 			name:       "remove outdated metadata",

+ 53 - 55
docs/api/v1.18.md

@@ -16,9 +16,7 @@ redirect_from:
      will be rejected.
      will be rejected.
 -->
 -->
 
 
-# Docker Engine API v1.18
-
-# 1. Brief introduction
+## 1. Brief introduction
 
 
  - The daemon listens on `unix:///var/run/docker.sock` but you can
  - The daemon listens on `unix:///var/run/docker.sock` but you can
    [Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
    [Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
@@ -26,11 +24,11 @@ redirect_from:
    or `pull`, the HTTP connection is hijacked to transport `STDOUT`,
    or `pull`, the HTTP connection is hijacked to transport `STDOUT`,
    `STDIN` and `STDERR`.
    `STDIN` and `STDERR`.
 
 
-# 2. Endpoints
+## 2. Endpoints
 
 
-## 2.1 Containers
+### 2.1 Containers
 
 
-### List containers
+#### List containers
 
 
 `GET /containers/json`
 `GET /containers/json`
 
 
@@ -123,7 +121,7 @@ List containers
 -   **400** – bad parameter
 -   **400** – bad parameter
 -   **500** – server error
 -   **500** – server error
 
 
-### Create a container
+#### Create a container
 
 
 `POST /containers/create`
 `POST /containers/create`
 
 
@@ -310,7 +308,7 @@ Create a container
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect a container
+#### Inspect a container
 
 
 `GET /containers/(id or name)/json`
 `GET /containers/(id or name)/json`
 
 
@@ -443,7 +441,7 @@ Return low-level information on the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### List processes running inside a container
+#### List processes running inside a container
 
 
 `GET /containers/(id or name)/top`
 `GET /containers/(id or name)/top`
 
 
@@ -507,7 +505,7 @@ supported on Windows.
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Get container logs
+#### Get container logs
 
 
 `GET /containers/(id or name)/logs`
 `GET /containers/(id or name)/logs`
 
 
@@ -547,7 +545,7 @@ Get `stdout` and `stderr` logs from the container ``id``
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect changes on a container's filesystem
+#### Inspect changes on a container's filesystem
 
 
 `GET /containers/(id or name)/changes`
 `GET /containers/(id or name)/changes`
 
 
@@ -589,7 +587,7 @@ Values for `Kind`:
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Export a container
+#### Export a container
 
 
 `GET /containers/(id or name)/export`
 `GET /containers/(id or name)/export`
 
 
@@ -614,7 +612,7 @@ Export the contents of container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Get container stats based on resource usage
+#### Get container stats based on resource usage
 
 
 `GET /containers/(id or name)/stats`
 `GET /containers/(id or name)/stats`
 
 
@@ -702,7 +700,7 @@ This endpoint returns a live stream of a container's resource usage statistics.
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Resize a container TTY
+#### Resize a container TTY
 
 
 `POST /containers/(id or name)/resize?h=<height>&w=<width>`
 `POST /containers/(id or name)/resize?h=<height>&w=<width>`
 
 
@@ -729,7 +727,7 @@ Resize the TTY for container with  `id`. You must restart the container for the
 -   **404** – No such container
 -   **404** – No such container
 -   **500** – Cannot resize container
 -   **500** – Cannot resize container
 
 
-### Start a container
+#### Start a container
 
 
 `POST /containers/(id or name)/start`
 `POST /containers/(id or name)/start`
 
 
@@ -754,7 +752,7 @@ Start the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Stop a container
+#### Stop a container
 
 
 `POST /containers/(id or name)/stop`
 `POST /containers/(id or name)/stop`
 
 
@@ -779,7 +777,7 @@ Stop the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Restart a container
+#### Restart a container
 
 
 `POST /containers/(id or name)/restart`
 `POST /containers/(id or name)/restart`
 
 
@@ -803,7 +801,7 @@ Restart the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Kill a container
+#### Kill a container
 
 
 `POST /containers/(id or name)/kill`
 `POST /containers/(id or name)/kill`
 
 
@@ -828,7 +826,7 @@ Kill the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Rename a container
+#### Rename a container
 
 
 `POST /containers/(id or name)/rename`
 `POST /containers/(id or name)/rename`
 
 
@@ -853,7 +851,7 @@ Rename the container `id` to a `new_name`
 -   **409** - conflict name already assigned
 -   **409** - conflict name already assigned
 -   **500** – server error
 -   **500** – server error
 
 
-### Pause a container
+#### Pause a container
 
 
 `POST /containers/(id or name)/pause`
 `POST /containers/(id or name)/pause`
 
 
@@ -873,7 +871,7 @@ Pause the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Unpause a container
+#### Unpause a container
 
 
 `POST /containers/(id or name)/unpause`
 `POST /containers/(id or name)/unpause`
 
 
@@ -893,7 +891,7 @@ Unpause the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Attach to a container
+#### Attach to a container
 
 
 `POST /containers/(id or name)/attach`
 `POST /containers/(id or name)/attach`
 
 
@@ -978,7 +976,7 @@ The simplest way to implement the Attach protocol is the following:
     4.  Read the extracted size and output it on the correct output.
     4.  Read the extracted size and output it on the correct output.
     5.  Goto 1.
     5.  Goto 1.
 
 
-### Attach to a container (websocket)
+#### Attach to a container (websocket)
 
 
 `GET /containers/(id or name)/attach/ws`
 `GET /containers/(id or name)/attach/ws`
 
 
@@ -1015,7 +1013,7 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Wait a container
+#### Wait a container
 
 
 `POST /containers/(id or name)/wait`
 `POST /containers/(id or name)/wait`
 
 
@@ -1038,7 +1036,7 @@ Block until container `id` stops, then returns the exit code
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove a container
+#### Remove a container
 
 
 `DELETE /containers/(id or name)`
 `DELETE /containers/(id or name)`
 
 
@@ -1067,7 +1065,7 @@ Remove the container `id` from the filesystem
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Copy files or folders from a container
+#### Copy files or folders from a container
 
 
 `POST /containers/(id or name)/copy`
 `POST /containers/(id or name)/copy`
 
 
@@ -1097,9 +1095,9 @@ Copy files or folders of container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-## 2.2 Images
+### 2.2 Images
 
 
-### List Images
+#### List Images
 
 
 `GET /images/json`
 `GET /images/json`
 
 
@@ -1185,7 +1183,7 @@ references on the command line.
   -   `label=key` or `label="key=value"` of an image label
   -   `label=key` or `label="key=value"` of an image label
 -   **filter** - only return images with the specified name
 -   **filter** - only return images with the specified name
 
 
-### Build image from a Dockerfile
+#### Build image from a Dockerfile
 
 
 `POST /build`
 `POST /build`
 
 
@@ -1256,7 +1254,7 @@ or being killed.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Create an image
+#### Create an image
 
 
 `POST /images/create`
 `POST /images/create`
 
 
@@ -1300,7 +1298,7 @@ a base64-encoded AuthConfig object.
 
 
 
 
 
 
-### Inspect an image
+#### Inspect an image
 
 
 `GET /images/(name)/json`
 `GET /images/(name)/json`
 
 
@@ -1351,7 +1349,7 @@ Return low-level information on the image `name`
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Get the history of an image
+#### Get the history of an image
 
 
 `GET /images/(name)/history`
 `GET /images/(name)/history`
 
 
@@ -1385,7 +1383,7 @@ Return the history of the image `name`
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Push an image on the registry
+#### Push an image on the registry
 
 
 `POST /images/(name)/push`
 `POST /images/(name)/push`
 
 
@@ -1428,7 +1426,7 @@ then be used in the URL. This duplicates the command line's flow.
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Tag an image into a repository
+#### Tag an image into a repository
 
 
 `POST /images/(name)/tag`
 `POST /images/(name)/tag`
 
 
@@ -1456,7 +1454,7 @@ Tag the image `name` into a repository
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove an image
+#### Remove an image
 
 
 `DELETE /images/(name)`
 `DELETE /images/(name)`
 
 
@@ -1489,7 +1487,7 @@ Remove the image `name` from the filesystem
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Search images
+#### Search images
 
 
 `GET /images/search`
 `GET /images/search`
 
 
@@ -1542,9 +1540,9 @@ Search for an image on [Docker Hub](https://hub.docker.com).
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-## 2.3 Misc
+### 2.3 Misc
 
 
-### Check auth configuration
+#### Check auth configuration
 
 
 `POST /auth`
 `POST /auth`
 
 
@@ -1572,7 +1570,7 @@ Get the default username and email
 -   **204** – no error
 -   **204** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Display system-wide information
+#### Display system-wide information
 
 
 `GET /info`
 `GET /info`
 
 
@@ -1637,7 +1635,7 @@ Display system-wide information
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Show the docker version information
+#### Show the docker version information
 
 
 `GET /version`
 `GET /version`
 
 
@@ -1667,7 +1665,7 @@ Show the docker version information
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Ping the docker server
+#### Ping the docker server
 
 
 `GET /_ping`
 `GET /_ping`
 
 
@@ -1689,7 +1687,7 @@ Ping the docker server
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Create a new image from a container's changes
+#### Create a new image from a container's changes
 
 
 `POST /commit`
 `POST /commit`
 
 
@@ -1751,7 +1749,7 @@ Create a new image from a container's changes
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Monitor Docker's events
+#### Monitor Docker's events
 
 
 `GET /events`
 `GET /events`
 
 
@@ -1793,7 +1791,7 @@ Docker images report the following events:
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Get a tarball containing all images in a repository
+#### Get a tarball containing all images in a repository
 
 
 `GET /images/(name)/get`
 `GET /images/(name)/get`
 
 
@@ -1823,7 +1821,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Get a tarball containing all images
+#### Get a tarball containing all images
 
 
 `GET /images/get`
 `GET /images/get`
 
 
@@ -1852,7 +1850,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Load a tarball with a set of images and tags into docker
+#### Load a tarball with a set of images and tags into docker
 
 
 `POST /images/load`
 `POST /images/load`
 
 
@@ -1875,7 +1873,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Image tarball format
+#### Image tarball format
 
 
 An image tarball contains one directory per image layer (named using its long ID),
 An image tarball contains one directory per image layer (named using its long ID),
 each containing these files:
 each containing these files:
@@ -1896,7 +1894,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
 }
 }
 ```
 ```
 
 
-### Exec Create
+#### Exec Create
 
 
 `POST /containers/(id or name)/exec`
 `POST /containers/(id or name)/exec`
 
 
@@ -1939,7 +1937,7 @@ Sets up an exec instance in a running container `id`
 -   **201** – no error
 -   **201** – no error
 -   **404** – no such container
 -   **404** – no such container
 
 
-### Exec Start
+#### Exec Start
 
 
 `POST /exec/(id)/start`
 `POST /exec/(id)/start`
 
 
@@ -1980,7 +1978,7 @@ interactive session with the `exec` command.
 
 
 Similar to the stream behavior of `POST /containers/(id or name)/attach` API
 Similar to the stream behavior of `POST /containers/(id or name)/attach` API
 
 
-### Exec Resize
+#### Exec Resize
 
 
 `POST /exec/(id)/resize`
 `POST /exec/(id)/resize`
 
 
@@ -2007,7 +2005,7 @@ This API is valid only if `tty` was specified as part of creating and starting t
 -   **201** – no error
 -   **201** – no error
 -   **404** – no such exec instance
 -   **404** – no such exec instance
 
 
-### Exec Inspect
+#### Exec Inspect
 
 
 `GET /exec/(id)/json`
 `GET /exec/(id)/json`
 
 
@@ -2112,9 +2110,9 @@ Return low-level information about the `exec` command `id`.
 -   **404** – no such exec instance
 -   **404** – no such exec instance
 -   **500** - server error
 -   **500** - server error
 
 
-# 3. Going further
+## 3. Going further
 
 
-## 3.1 Inside `docker run`
+### 3.1 Inside `docker run`
 
 
 As an example, the `docker run` command line makes the following API calls:
 As an example, the `docker run` command line makes the following API calls:
 
 
@@ -2132,7 +2130,7 @@ As an example, the `docker run` command line makes the following API calls:
 
 
 - If in detached mode or only `stdin` is attached, display the container's id.
 - If in detached mode or only `stdin` is attached, display the container's id.
 
 
-## 3.2 Hijacking
+### 3.2 Hijacking
 
 
 In this version of the API, `/attach`, uses hijacking to transport `stdin`,
 In this version of the API, `/attach`, uses hijacking to transport `stdin`,
 `stdout`, and `stderr` on the same socket.
 `stdout`, and `stderr` on the same socket.
@@ -2148,7 +2146,7 @@ from **200 OK** to **101 UPGRADED** and resends the same headers.
 
 
 This might change in the future.
 This might change in the future.
 
 
-## 3.3 CORS Requests
+### 3.3 CORS Requests
 
 
 To set cross origin requests to the Engine API please give values to
 To set cross origin requests to the Engine API please give values to
 `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
 `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,

+ 52 - 54
docs/api/v1.19.md

@@ -16,8 +16,6 @@ redirect_from:
      will be rejected.
      will be rejected.
 -->
 -->
 
 
-# Docker Engine API v1.19
-
 ## 1. Brief introduction
 ## 1. Brief introduction
 
 
  - The daemon listens on `unix:///var/run/docker.sock` but you can
  - The daemon listens on `unix:///var/run/docker.sock` but you can
@@ -28,11 +26,11 @@ redirect_from:
  - When the client API version is newer than the daemon's, these calls return an HTTP
  - When the client API version is newer than the daemon's, these calls return an HTTP
    `400 Bad Request` error message.
    `400 Bad Request` error message.
 
 
-# 2. Endpoints
+## 2. Endpoints
 
 
-## 2.1 Containers
+### 2.1 Containers
 
 
-### List containers
+#### List containers
 
 
 `GET /containers/json`
 `GET /containers/json`
 
 
@@ -125,7 +123,7 @@ List containers
 -   **400** – bad parameter
 -   **400** – bad parameter
 -   **500** – server error
 -   **500** – server error
 
 
-### Create a container
+#### Create a container
 
 
 `POST /containers/create`
 `POST /containers/create`
 
 
@@ -322,7 +320,7 @@ Create a container
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect a container
+#### Inspect a container
 
 
 `GET /containers/(id or name)/json`
 `GET /containers/(id or name)/json`
 
 
@@ -459,7 +457,7 @@ Return low-level information on the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### List processes running inside a container
+#### List processes running inside a container
 
 
 `GET /containers/(id or name)/top`
 `GET /containers/(id or name)/top`
 
 
@@ -523,7 +521,7 @@ supported on Windows.
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Get container logs
+#### Get container logs
 
 
 `GET /containers/(id or name)/logs`
 `GET /containers/(id or name)/logs`
 
 
@@ -565,7 +563,7 @@ Get `stdout` and `stderr` logs from the container ``id``
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect changes on a container's filesystem
+#### Inspect changes on a container's filesystem
 
 
 `GET /containers/(id or name)/changes`
 `GET /containers/(id or name)/changes`
 
 
@@ -607,7 +605,7 @@ Values for `Kind`:
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Export a container
+#### Export a container
 
 
 `GET /containers/(id or name)/export`
 `GET /containers/(id or name)/export`
 
 
@@ -632,7 +630,7 @@ Export the contents of container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Get container stats based on resource usage
+#### Get container stats based on resource usage
 
 
 `GET /containers/(id or name)/stats`
 `GET /containers/(id or name)/stats`
 
 
@@ -741,7 +739,7 @@ The precpu_stats is the cpu statistic of last read, which is used for calculatin
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Resize a container TTY
+#### Resize a container TTY
 
 
 `POST /containers/(id or name)/resize?h=<height>&w=<width>`
 `POST /containers/(id or name)/resize?h=<height>&w=<width>`
 
 
@@ -768,7 +766,7 @@ Resize the TTY for container with  `id`. You must restart the container for the
 -   **404** – No such container
 -   **404** – No such container
 -   **500** – Cannot resize container
 -   **500** – Cannot resize container
 
 
-### Start a container
+#### Start a container
 
 
 `POST /containers/(id or name)/start`
 `POST /containers/(id or name)/start`
 
 
@@ -793,7 +791,7 @@ Start the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Stop a container
+#### Stop a container
 
 
 `POST /containers/(id or name)/stop`
 `POST /containers/(id or name)/stop`
 
 
@@ -818,7 +816,7 @@ Stop the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Restart a container
+#### Restart a container
 
 
 `POST /containers/(id or name)/restart`
 `POST /containers/(id or name)/restart`
 
 
@@ -842,7 +840,7 @@ Restart the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Kill a container
+#### Kill a container
 
 
 `POST /containers/(id or name)/kill`
 `POST /containers/(id or name)/kill`
 
 
@@ -867,7 +865,7 @@ Kill the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Rename a container
+#### Rename a container
 
 
 `POST /containers/(id or name)/rename`
 `POST /containers/(id or name)/rename`
 
 
@@ -892,7 +890,7 @@ Rename the container `id` to a `new_name`
 -   **409** - conflict name already assigned
 -   **409** - conflict name already assigned
 -   **500** – server error
 -   **500** – server error
 
 
-### Pause a container
+#### Pause a container
 
 
 `POST /containers/(id or name)/pause`
 `POST /containers/(id or name)/pause`
 
 
@@ -912,7 +910,7 @@ Pause the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Unpause a container
+#### Unpause a container
 
 
 `POST /containers/(id or name)/unpause`
 `POST /containers/(id or name)/unpause`
 
 
@@ -932,7 +930,7 @@ Unpause the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Attach to a container
+#### Attach to a container
 
 
 `POST /containers/(id or name)/attach`
 `POST /containers/(id or name)/attach`
 
 
@@ -1017,7 +1015,7 @@ The simplest way to implement the Attach protocol is the following:
     4.  Read the extracted size and output it on the correct output.
     4.  Read the extracted size and output it on the correct output.
     5.  Goto 1.
     5.  Goto 1.
 
 
-### Attach to a container (websocket)
+#### Attach to a container (websocket)
 
 
 `GET /containers/(id or name)/attach/ws`
 `GET /containers/(id or name)/attach/ws`
 
 
@@ -1054,7 +1052,7 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Wait a container
+#### Wait a container
 
 
 `POST /containers/(id or name)/wait`
 `POST /containers/(id or name)/wait`
 
 
@@ -1077,7 +1075,7 @@ Block until container `id` stops, then returns the exit code
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove a container
+#### Remove a container
 
 
 `DELETE /containers/(id or name)`
 `DELETE /containers/(id or name)`
 
 
@@ -1106,7 +1104,7 @@ Remove the container `id` from the filesystem
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Copy files or folders from a container
+#### Copy files or folders from a container
 
 
 `POST /containers/(id or name)/copy`
 `POST /containers/(id or name)/copy`
 
 
@@ -1136,9 +1134,9 @@ Copy files or folders of container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-## 2.2 Images
+### 2.2 Images
 
 
-### List Images
+#### List Images
 
 
 `GET /images/json`
 `GET /images/json`
 
 
@@ -1229,7 +1227,7 @@ references on the command line.
   -   `label=key` or `label="key=value"` of an image label
   -   `label=key` or `label="key=value"` of an image label
 -   **filter** - only return images with the specified name
 -   **filter** - only return images with the specified name
 
 
-### Build image from a Dockerfile
+#### Build image from a Dockerfile
 
 
 `POST /build`
 `POST /build`
 
 
@@ -1302,7 +1300,7 @@ or being killed.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Create an image
+#### Create an image
 
 
 `POST /images/create`
 `POST /images/create`
 
 
@@ -1346,7 +1344,7 @@ a base64-encoded AuthConfig object.
 
 
 
 
 
 
-### Inspect an image
+#### Inspect an image
 
 
 `GET /images/(name)/json`
 `GET /images/(name)/json`
 
 
@@ -1397,7 +1395,7 @@ Return low-level information on the image `name`
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Get the history of an image
+#### Get the history of an image
 
 
 `GET /images/(name)/history`
 `GET /images/(name)/history`
 
 
@@ -1451,7 +1449,7 @@ Return the history of the image `name`
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Push an image on the registry
+#### Push an image on the registry
 
 
 `POST /images/(name)/push`
 `POST /images/(name)/push`
 
 
@@ -1494,7 +1492,7 @@ then be used in the URL. This duplicates the command line's flow.
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Tag an image into a repository
+#### Tag an image into a repository
 
 
 `POST /images/(name)/tag`
 `POST /images/(name)/tag`
 
 
@@ -1522,7 +1520,7 @@ Tag the image `name` into a repository
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove an image
+#### Remove an image
 
 
 `DELETE /images/(name)`
 `DELETE /images/(name)`
 
 
@@ -1555,7 +1553,7 @@ Remove the image `name` from the filesystem
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Search images
+#### Search images
 
 
 `GET /images/search`
 `GET /images/search`
 
 
@@ -1614,9 +1612,9 @@ be deprecated and replaced by the `is_automated` property.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-## 2.3 Misc
+### 2.3 Misc
 
 
-### Check auth configuration
+#### Check auth configuration
 
 
 `POST /auth`
 `POST /auth`
 
 
@@ -1644,7 +1642,7 @@ Get the default username and email
 -   **204** – no error
 -   **204** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Display system-wide information
+#### Display system-wide information
 
 
 `GET /info`
 `GET /info`
 
 
@@ -1713,7 +1711,7 @@ Display system-wide information
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Show the docker version information
+#### Show the docker version information
 
 
 `GET /version`
 `GET /version`
 
 
@@ -1743,7 +1741,7 @@ Show the docker version information
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Ping the docker server
+#### Ping the docker server
 
 
 `GET /_ping`
 `GET /_ping`
 
 
@@ -1765,7 +1763,7 @@ Ping the docker server
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Create a new image from a container's changes
+#### Create a new image from a container's changes
 
 
 `POST /commit`
 `POST /commit`
 
 
@@ -1831,7 +1829,7 @@ Create a new image from a container's changes
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Monitor Docker's events
+#### Monitor Docker's events
 
 
 `GET /events`
 `GET /events`
 
 
@@ -1873,7 +1871,7 @@ Docker images report the following events:
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Get a tarball containing all images in a repository
+#### Get a tarball containing all images in a repository
 
 
 `GET /images/(name)/get`
 `GET /images/(name)/get`
 
 
@@ -1903,7 +1901,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Get a tarball containing all images
+#### Get a tarball containing all images
 
 
 `GET /images/get`
 `GET /images/get`
 
 
@@ -1932,7 +1930,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Load a tarball with a set of images and tags into docker
+#### Load a tarball with a set of images and tags into docker
 
 
 `POST /images/load`
 `POST /images/load`
 
 
@@ -1955,7 +1953,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Image tarball format
+#### Image tarball format
 
 
 An image tarball contains one directory per image layer (named using its long ID),
 An image tarball contains one directory per image layer (named using its long ID),
 each containing these files:
 each containing these files:
@@ -1976,7 +1974,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
 }
 }
 ```
 ```
 
 
-### Exec Create
+#### Exec Create
 
 
 `POST /containers/(id or name)/exec`
 `POST /containers/(id or name)/exec`
 
 
@@ -2022,7 +2020,7 @@ Sets up an exec instance in a running container `id`
 -   **201** – no error
 -   **201** – no error
 -   **404** – no such container
 -   **404** – no such container
 
 
-### Exec Start
+#### Exec Start
 
 
 `POST /exec/(id)/start`
 `POST /exec/(id)/start`
 
 
@@ -2063,7 +2061,7 @@ interactive session with the `exec` command.
 
 
 Similar to the stream behavior of `POST /containers/(id or name)/attach` API
 Similar to the stream behavior of `POST /containers/(id or name)/attach` API
 
 
-### Exec Resize
+#### Exec Resize
 
 
 `POST /exec/(id)/resize`
 `POST /exec/(id)/resize`
 
 
@@ -2090,7 +2088,7 @@ This API is valid only if `tty` was specified as part of creating and starting t
 -   **201** – no error
 -   **201** – no error
 -   **404** – no such exec instance
 -   **404** – no such exec instance
 
 
-### Exec Inspect
+#### Exec Inspect
 
 
 `GET /exec/(id)/json`
 `GET /exec/(id)/json`
 
 
@@ -2195,9 +2193,9 @@ Return low-level information about the `exec` command `id`.
 -   **404** – no such exec instance
 -   **404** – no such exec instance
 -   **500** - server error
 -   **500** - server error
 
 
-# 3. Going further
+## 3. Going further
 
 
-## 3.1 Inside `docker run`
+### 3.1 Inside `docker run`
 
 
 As an example, the `docker run` command line makes the following API calls:
 As an example, the `docker run` command line makes the following API calls:
 
 
@@ -2215,7 +2213,7 @@ As an example, the `docker run` command line makes the following API calls:
 
 
 - If in detached mode or only `stdin` is attached, display the container's id.
 - If in detached mode or only `stdin` is attached, display the container's id.
 
 
-## 3.2 Hijacking
+### 3.2 Hijacking
 
 
 In this version of the API, `/attach`, uses hijacking to transport `stdin`,
 In this version of the API, `/attach`, uses hijacking to transport `stdin`,
 `stdout`, and `stderr` on the same socket.
 `stdout`, and `stderr` on the same socket.
@@ -2230,7 +2228,7 @@ When Docker daemon detects the `Upgrade` header, it switches its status code
 from **200 OK** to **101 UPGRADED** and resends the same headers.
 from **200 OK** to **101 UPGRADED** and resends the same headers.
 
 
 
 
-## 3.3 CORS Requests
+### 3.3 CORS Requests
 
 
 To set cross origin requests to the Engine API please give values to
 To set cross origin requests to the Engine API please give values to
 `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
 `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,

+ 56 - 58
docs/api/v1.20.md

@@ -16,9 +16,7 @@ redirect_from:
      will be rejected.
      will be rejected.
 -->
 -->
 
 
-# Docker Engine API v1.20
-
-# 1. Brief introduction
+## 1. Brief introduction
 
 
  - The daemon listens on `unix:///var/run/docker.sock` but you can
  - The daemon listens on `unix:///var/run/docker.sock` but you can
    [Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
    [Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
@@ -26,11 +24,11 @@ redirect_from:
    or `pull`, the HTTP connection is hijacked to transport `stdout`,
    or `pull`, the HTTP connection is hijacked to transport `stdout`,
    `stdin` and `stderr`.
    `stdin` and `stderr`.
 
 
-# 2. Endpoints
+## 2. Endpoints
 
 
-## 2.1 Containers
+### 2.1 Containers
 
 
-### List containers
+#### List containers
 
 
 `GET /containers/json`
 `GET /containers/json`
 
 
@@ -123,7 +121,7 @@ List containers
 -   **400** – bad parameter
 -   **400** – bad parameter
 -   **500** – server error
 -   **500** – server error
 
 
-### Create a container
+#### Create a container
 
 
 `POST /containers/create`
 `POST /containers/create`
 
 
@@ -324,7 +322,7 @@ Create a container
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect a container
+#### Inspect a container
 
 
 `GET /containers/(id or name)/json`
 `GET /containers/(id or name)/json`
 
 
@@ -466,7 +464,7 @@ Return low-level information on the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### List processes running inside a container
+#### List processes running inside a container
 
 
 `GET /containers/(id or name)/top`
 `GET /containers/(id or name)/top`
 
 
@@ -530,7 +528,7 @@ supported on Windows.
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Get container logs
+#### Get container logs
 
 
 `GET /containers/(id or name)/logs`
 `GET /containers/(id or name)/logs`
 
 
@@ -572,7 +570,7 @@ Get `stdout` and `stderr` logs from the container ``id``
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect changes on a container's filesystem
+#### Inspect changes on a container's filesystem
 
 
 `GET /containers/(id or name)/changes`
 `GET /containers/(id or name)/changes`
 
 
@@ -614,7 +612,7 @@ Values for `Kind`:
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Export a container
+#### Export a container
 
 
 `GET /containers/(id or name)/export`
 `GET /containers/(id or name)/export`
 
 
@@ -639,7 +637,7 @@ Export the contents of container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Get container stats based on resource usage
+#### Get container stats based on resource usage
 
 
 `GET /containers/(id or name)/stats`
 `GET /containers/(id or name)/stats`
 
 
@@ -748,7 +746,7 @@ The precpu_stats is the cpu statistic of last read, which is used for calculatin
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Resize a container TTY
+#### Resize a container TTY
 
 
 `POST /containers/(id or name)/resize?h=<height>&w=<width>`
 `POST /containers/(id or name)/resize?h=<height>&w=<width>`
 
 
@@ -775,7 +773,7 @@ Resize the TTY for container with  `id`. You must restart the container for the
 -   **404** – No such container
 -   **404** – No such container
 -   **500** – Cannot resize container
 -   **500** – Cannot resize container
 
 
-### Start a container
+#### Start a container
 
 
 `POST /containers/(id or name)/start`
 `POST /containers/(id or name)/start`
 
 
@@ -800,7 +798,7 @@ Start the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Stop a container
+#### Stop a container
 
 
 `POST /containers/(id or name)/stop`
 `POST /containers/(id or name)/stop`
 
 
@@ -825,7 +823,7 @@ Stop the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Restart a container
+#### Restart a container
 
 
 `POST /containers/(id or name)/restart`
 `POST /containers/(id or name)/restart`
 
 
@@ -849,7 +847,7 @@ Restart the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Kill a container
+#### Kill a container
 
 
 `POST /containers/(id or name)/kill`
 `POST /containers/(id or name)/kill`
 
 
@@ -874,7 +872,7 @@ Kill the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Rename a container
+#### Rename a container
 
 
 `POST /containers/(id or name)/rename`
 `POST /containers/(id or name)/rename`
 
 
@@ -899,7 +897,7 @@ Rename the container `id` to a `new_name`
 -   **409** - conflict name already assigned
 -   **409** - conflict name already assigned
 -   **500** – server error
 -   **500** – server error
 
 
-### Pause a container
+#### Pause a container
 
 
 `POST /containers/(id or name)/pause`
 `POST /containers/(id or name)/pause`
 
 
@@ -919,7 +917,7 @@ Pause the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Unpause a container
+#### Unpause a container
 
 
 `POST /containers/(id or name)/unpause`
 `POST /containers/(id or name)/unpause`
 
 
@@ -939,7 +937,7 @@ Unpause the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Attach to a container
+#### Attach to a container
 
 
 `POST /containers/(id or name)/attach`
 `POST /containers/(id or name)/attach`
 
 
@@ -1024,7 +1022,7 @@ The simplest way to implement the Attach protocol is the following:
     4.  Read the extracted size and output it on the correct output.
     4.  Read the extracted size and output it on the correct output.
     5.  Goto 1.
     5.  Goto 1.
 
 
-### Attach to a container (websocket)
+#### Attach to a container (websocket)
 
 
 `GET /containers/(id or name)/attach/ws`
 `GET /containers/(id or name)/attach/ws`
 
 
@@ -1061,7 +1059,7 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Wait a container
+#### Wait a container
 
 
 `POST /containers/(id or name)/wait`
 `POST /containers/(id or name)/wait`
 
 
@@ -1084,7 +1082,7 @@ Block until container `id` stops, then returns the exit code
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove a container
+#### Remove a container
 
 
 `DELETE /containers/(id or name)`
 `DELETE /containers/(id or name)`
 
 
@@ -1113,7 +1111,7 @@ Remove the container `id` from the filesystem
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Copy files or folders from a container
+#### Copy files or folders from a container
 
 
 `POST /containers/(id or name)/copy`
 `POST /containers/(id or name)/copy`
 
 
@@ -1145,14 +1143,14 @@ Copy files or folders of container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Retrieving information about files and folders in a container
+#### Retrieving information about files and folders in a container
 
 
 `HEAD /containers/(id or name)/archive`
 `HEAD /containers/(id or name)/archive`
 
 
 See the description of the `X-Docker-Container-Path-Stat` header in the
 See the description of the `X-Docker-Container-Path-Stat` header in the
 following section.
 following section.
 
 
-### Get an archive of a filesystem resource in a container
+#### Get an archive of a filesystem resource in a container
 
 
 `GET /containers/(id or name)/archive`
 `GET /containers/(id or name)/archive`
 
 
@@ -1217,7 +1215,7 @@ desired.
     - no such file or directory (**path** does not exist)
     - no such file or directory (**path** does not exist)
 - **500** - server error
 - **500** - server error
 
 
-### Extract an archive of files or folders to a directory in a container
+#### Extract an archive of files or folders to a directory in a container
 
 
 `PUT /containers/(id or name)/archive`
 `PUT /containers/(id or name)/archive`
 
 
@@ -1265,9 +1263,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
     - no such file or directory (**path** resource does not exist)
     - no such file or directory (**path** resource does not exist)
 - **500** – server error
 - **500** – server error
 
 
-## 2.2 Images
+### 2.2 Images
 
 
-### List Images
+#### List Images
 
 
 `GET /images/json`
 `GET /images/json`
 
 
@@ -1358,7 +1356,7 @@ references on the command line.
   -   `label=key` or `label="key=value"` of an image label
   -   `label=key` or `label="key=value"` of an image label
 -   **filter** - only return images with the specified name
 -   **filter** - only return images with the specified name
 
 
-### Build image from a Dockerfile
+#### Build image from a Dockerfile
 
 
 `POST /build`
 `POST /build`
 
 
@@ -1456,7 +1454,7 @@ or being killed.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Create an image
+#### Create an image
 
 
 `POST /images/create`
 `POST /images/create`
 
 
@@ -1500,7 +1498,7 @@ a base64-encoded AuthConfig object.
 
 
 
 
 
 
-### Inspect an image
+#### Inspect an image
 
 
 `GET /images/(name)/json`
 `GET /images/(name)/json`
 
 
@@ -1551,7 +1549,7 @@ Return low-level information on the image `name`
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Get the history of an image
+#### Get the history of an image
 
 
 `GET /images/(name)/history`
 `GET /images/(name)/history`
 
 
@@ -1605,7 +1603,7 @@ Return the history of the image `name`
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Push an image on the registry
+#### Push an image on the registry
 
 
 `POST /images/(name)/push`
 `POST /images/(name)/push`
 
 
@@ -1648,7 +1646,7 @@ then be used in the URL. This duplicates the command line's flow.
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Tag an image into a repository
+#### Tag an image into a repository
 
 
 `POST /images/(name)/tag`
 `POST /images/(name)/tag`
 
 
@@ -1676,7 +1674,7 @@ Tag the image `name` into a repository
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove an image
+#### Remove an image
 
 
 `DELETE /images/(name)`
 `DELETE /images/(name)`
 
 
@@ -1709,7 +1707,7 @@ Remove the image `name` from the filesystem
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Search images
+#### Search images
 
 
 `GET /images/search`
 `GET /images/search`
 
 
@@ -1762,9 +1760,9 @@ Search for an image on [Docker Hub](https://hub.docker.com).
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-## 2.3 Misc
+### 2.3 Misc
 
 
-### Check auth configuration
+#### Check auth configuration
 
 
 `POST /auth`
 `POST /auth`
 
 
@@ -1792,7 +1790,7 @@ Get the default username and email
 -   **204** – no error
 -   **204** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Display system-wide information
+#### Display system-wide information
 
 
 `GET /info`
 `GET /info`
 
 
@@ -1861,7 +1859,7 @@ Display system-wide information
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Show the docker version information
+#### Show the docker version information
 
 
 `GET /version`
 `GET /version`
 
 
@@ -1892,7 +1890,7 @@ Show the docker version information
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Ping the docker server
+#### Ping the docker server
 
 
 `GET /_ping`
 `GET /_ping`
 
 
@@ -1914,7 +1912,7 @@ Ping the docker server
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Create a new image from a container's changes
+#### Create a new image from a container's changes
 
 
 `POST /commit`
 `POST /commit`
 
 
@@ -1986,7 +1984,7 @@ Create a new image from a container's changes
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Monitor Docker's events
+#### Monitor Docker's events
 
 
 `GET /events`
 `GET /events`
 
 
@@ -2028,7 +2026,7 @@ Docker images report the following events:
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Get a tarball containing all images in a repository
+#### Get a tarball containing all images in a repository
 
 
 `GET /images/(name)/get`
 `GET /images/(name)/get`
 
 
@@ -2058,7 +2056,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Get a tarball containing all images
+#### Get a tarball containing all images
 
 
 `GET /images/get`
 `GET /images/get`
 
 
@@ -2087,7 +2085,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Load a tarball with a set of images and tags into docker
+#### Load a tarball with a set of images and tags into docker
 
 
 `POST /images/load`
 `POST /images/load`
 
 
@@ -2110,7 +2108,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Image tarball format
+#### Image tarball format
 
 
 An image tarball contains one directory per image layer (named using its long ID),
 An image tarball contains one directory per image layer (named using its long ID),
 each containing these files:
 each containing these files:
@@ -2131,7 +2129,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
 }
 }
 ```
 ```
 
 
-### Exec Create
+#### Exec Create
 
 
 `POST /containers/(id or name)/exec`
 `POST /containers/(id or name)/exec`
 
 
@@ -2177,7 +2175,7 @@ Sets up an exec instance in a running container `id`
 -   **201** – no error
 -   **201** – no error
 -   **404** – no such container
 -   **404** – no such container
 
 
-### Exec Start
+#### Exec Start
 
 
 `POST /exec/(id)/start`
 `POST /exec/(id)/start`
 
 
@@ -2218,7 +2216,7 @@ interactive session with the `exec` command.
 
 
 Similar to the stream behavior of `POST /containers/(id or name)/attach` API
 Similar to the stream behavior of `POST /containers/(id or name)/attach` API
 
 
-### Exec Resize
+#### Exec Resize
 
 
 `POST /exec/(id)/resize`
 `POST /exec/(id)/resize`
 
 
@@ -2245,7 +2243,7 @@ This API is valid only if `tty` was specified as part of creating and starting t
 -   **201** – no error
 -   **201** – no error
 -   **404** – no such exec instance
 -   **404** – no such exec instance
 
 
-### Exec Inspect
+#### Exec Inspect
 
 
 `GET /exec/(id)/json`
 `GET /exec/(id)/json`
 
 
@@ -2348,9 +2346,9 @@ Return low-level information about the `exec` command `id`.
 -   **404** – no such exec instance
 -   **404** – no such exec instance
 -   **500** - server error
 -   **500** - server error
 
 
-# 3. Going further
+## 3. Going further
 
 
-## 3.1 Inside `docker run`
+### 3.1 Inside `docker run`
 
 
 As an example, the `docker run` command line makes the following API calls:
 As an example, the `docker run` command line makes the following API calls:
 
 
@@ -2368,7 +2366,7 @@ As an example, the `docker run` command line makes the following API calls:
 
 
 - If in detached mode or only `stdin` is attached, display the container's id.
 - If in detached mode or only `stdin` is attached, display the container's id.
 
 
-## 3.2 Hijacking
+### 3.2 Hijacking
 
 
 In this version of the API, `/attach`, uses hijacking to transport `stdin`,
 In this version of the API, `/attach`, uses hijacking to transport `stdin`,
 `stdout`, and `stderr` on the same socket.
 `stdout`, and `stderr` on the same socket.
@@ -2383,7 +2381,7 @@ When Docker daemon detects the `Upgrade` header, it switches its status code
 from **200 OK** to **101 UPGRADED** and resends the same headers.
 from **200 OK** to **101 UPGRADED** and resends the same headers.
 
 
 
 
-## 3.3 CORS Requests
+### 3.3 CORS Requests
 
 
 To set cross origin requests to the Engine API please give values to
 To set cross origin requests to the Engine API please give values to
 `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
 `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,

+ 67 - 69
docs/api/v1.21.md

@@ -16,8 +16,6 @@ redirect_from:
      will be rejected.
      will be rejected.
 -->
 -->
 
 
-# Docker Engine API v1.21
-
 ## 1. Brief introduction
 ## 1. Brief introduction
 
 
  - The daemon listens on `unix:///var/run/docker.sock` but you can
  - The daemon listens on `unix:///var/run/docker.sock` but you can
@@ -28,11 +26,11 @@ redirect_from:
  - When the client API version is newer than the daemon's, these calls return an HTTP
  - When the client API version is newer than the daemon's, these calls return an HTTP
    `400 Bad Request` error message.
    `400 Bad Request` error message.
 
 
-# 2. Endpoints
+## 2. Endpoints
 
 
-## 2.1 Containers
+### 2.1 Containers
 
 
-### List containers
+#### List containers
 
 
 `GET /containers/json`
 `GET /containers/json`
 
 
@@ -129,7 +127,7 @@ List containers
 -   **400** – bad parameter
 -   **400** – bad parameter
 -   **500** – server error
 -   **500** – server error
 
 
-### Create a container
+#### Create a container
 
 
 `POST /containers/create`
 `POST /containers/create`
 
 
@@ -347,7 +345,7 @@ Create a container
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect a container
+#### Inspect a container
 
 
 `GET /containers/(id or name)/json`
 `GET /containers/(id or name)/json`
 
 
@@ -537,7 +535,7 @@ Return low-level information on the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### List processes running inside a container
+#### List processes running inside a container
 
 
 `GET /containers/(id or name)/top`
 `GET /containers/(id or name)/top`
 
 
@@ -601,7 +599,7 @@ supported on Windows.
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Get container logs
+#### Get container logs
 
 
 `GET /containers/(id or name)/logs`
 `GET /containers/(id or name)/logs`
 
 
@@ -643,7 +641,7 @@ Get `stdout` and `stderr` logs from the container ``id``
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect changes on a container's filesystem
+#### Inspect changes on a container's filesystem
 
 
 `GET /containers/(id or name)/changes`
 `GET /containers/(id or name)/changes`
 
 
@@ -685,7 +683,7 @@ Values for `Kind`:
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Export a container
+#### Export a container
 
 
 `GET /containers/(id or name)/export`
 `GET /containers/(id or name)/export`
 
 
@@ -710,7 +708,7 @@ Export the contents of container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Get container stats based on resource usage
+#### Get container stats based on resource usage
 
 
 `GET /containers/(id or name)/stats`
 `GET /containers/(id or name)/stats`
 
 
@@ -831,7 +829,7 @@ The precpu_stats is the cpu statistic of last read, which is used for calculatin
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Resize a container TTY
+#### Resize a container TTY
 
 
 `POST /containers/(id or name)/resize`
 `POST /containers/(id or name)/resize`
 
 
@@ -858,7 +856,7 @@ Resize the TTY for container with  `id`. The unit is number of characters. You m
 -   **404** – No such container
 -   **404** – No such container
 -   **500** – Cannot resize container
 -   **500** – Cannot resize container
 
 
-### Start a container
+#### Start a container
 
 
 `POST /containers/(id or name)/start`
 `POST /containers/(id or name)/start`
 
 
@@ -883,7 +881,7 @@ Start the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Stop a container
+#### Stop a container
 
 
 `POST /containers/(id or name)/stop`
 `POST /containers/(id or name)/stop`
 
 
@@ -908,7 +906,7 @@ Stop the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Restart a container
+#### Restart a container
 
 
 `POST /containers/(id or name)/restart`
 `POST /containers/(id or name)/restart`
 
 
@@ -932,7 +930,7 @@ Restart the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Kill a container
+#### Kill a container
 
 
 `POST /containers/(id or name)/kill`
 `POST /containers/(id or name)/kill`
 
 
@@ -957,7 +955,7 @@ Kill the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Rename a container
+#### Rename a container
 
 
 `POST /containers/(id or name)/rename`
 `POST /containers/(id or name)/rename`
 
 
@@ -982,7 +980,7 @@ Rename the container `id` to a `new_name`
 -   **409** - conflict name already assigned
 -   **409** - conflict name already assigned
 -   **500** – server error
 -   **500** – server error
 
 
-### Pause a container
+#### Pause a container
 
 
 `POST /containers/(id or name)/pause`
 `POST /containers/(id or name)/pause`
 
 
@@ -1002,7 +1000,7 @@ Pause the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Unpause a container
+#### Unpause a container
 
 
 `POST /containers/(id or name)/unpause`
 `POST /containers/(id or name)/unpause`
 
 
@@ -1022,7 +1020,7 @@ Unpause the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Attach to a container
+#### Attach to a container
 
 
 `POST /containers/(id or name)/attach`
 `POST /containers/(id or name)/attach`
 
 
@@ -1107,7 +1105,7 @@ The simplest way to implement the Attach protocol is the following:
     4.  Read the extracted size and output it on the correct output.
     4.  Read the extracted size and output it on the correct output.
     5.  Goto 1.
     5.  Goto 1.
 
 
-### Attach to a container (websocket)
+#### Attach to a container (websocket)
 
 
 `GET /containers/(id or name)/attach/ws`
 `GET /containers/(id or name)/attach/ws`
 
 
@@ -1144,7 +1142,7 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Wait a container
+#### Wait a container
 
 
 `POST /containers/(id or name)/wait`
 `POST /containers/(id or name)/wait`
 
 
@@ -1167,7 +1165,7 @@ Block until container `id` stops, then returns the exit code
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove a container
+#### Remove a container
 
 
 `DELETE /containers/(id or name)`
 `DELETE /containers/(id or name)`
 
 
@@ -1196,7 +1194,7 @@ Remove the container `id` from the filesystem
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Copy files or folders from a container
+#### Copy files or folders from a container
 
 
 `POST /containers/(id or name)/copy`
 `POST /containers/(id or name)/copy`
 
 
@@ -1228,14 +1226,14 @@ Copy files or folders of container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Retrieving information about files and folders in a container
+#### Retrieving information about files and folders in a container
 
 
 `HEAD /containers/(id or name)/archive`
 `HEAD /containers/(id or name)/archive`
 
 
 See the description of the `X-Docker-Container-Path-Stat` header in the
 See the description of the `X-Docker-Container-Path-Stat` header in the
 following section.
 following section.
 
 
-### Get an archive of a filesystem resource in a container
+#### Get an archive of a filesystem resource in a container
 
 
 `GET /containers/(id or name)/archive`
 `GET /containers/(id or name)/archive`
 
 
@@ -1300,7 +1298,7 @@ desired.
     - no such file or directory (**path** does not exist)
     - no such file or directory (**path** does not exist)
 - **500** - server error
 - **500** - server error
 
 
-### Extract an archive of files or folders to a directory in a container
+#### Extract an archive of files or folders to a directory in a container
 
 
 `PUT /containers/(id or name)/archive`
 `PUT /containers/(id or name)/archive`
 
 
@@ -1348,9 +1346,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
     - no such file or directory (**path** resource does not exist)
     - no such file or directory (**path** resource does not exist)
 - **500** – server error
 - **500** – server error
 
 
-## 2.2 Images
+### 2.2 Images
 
 
-### List Images
+#### List Images
 
 
 `GET /images/json`
 `GET /images/json`
 
 
@@ -1441,7 +1439,7 @@ references on the command line.
   -   `label=key` or `label="key=value"` of an image label
   -   `label=key` or `label="key=value"` of an image label
 -   **filter** - only return images with the specified name
 -   **filter** - only return images with the specified name
 
 
-### Build image from a Dockerfile
+#### Build image from a Dockerfile
 
 
 `POST /build`
 `POST /build`
 
 
@@ -1545,7 +1543,7 @@ or being killed.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Create an image
+#### Create an image
 
 
 `POST /images/create`
 `POST /images/create`
 
 
@@ -1593,7 +1591,7 @@ a base64-encoded AuthConfig object.
 
 
 
 
 
 
-### Inspect an image
+#### Inspect an image
 
 
 `GET /images/(name)/json`
 `GET /images/(name)/json`
 
 
@@ -1704,7 +1702,7 @@ Return low-level information on the image `name`
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Get the history of an image
+#### Get the history of an image
 
 
 `GET /images/(name)/history`
 `GET /images/(name)/history`
 
 
@@ -1758,7 +1756,7 @@ Return the history of the image `name`
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Push an image on the registry
+#### Push an image on the registry
 
 
 `POST /images/(name)/push`
 `POST /images/(name)/push`
 
 
@@ -1801,7 +1799,7 @@ then be used in the URL. This duplicates the command line's flow.
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Tag an image into a repository
+#### Tag an image into a repository
 
 
 `POST /images/(name)/tag`
 `POST /images/(name)/tag`
 
 
@@ -1829,7 +1827,7 @@ Tag the image `name` into a repository
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove an image
+#### Remove an image
 
 
 `DELETE /images/(name)`
 `DELETE /images/(name)`
 
 
@@ -1862,7 +1860,7 @@ Remove the image `name` from the filesystem
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Search images
+#### Search images
 
 
 `GET /images/search`
 `GET /images/search`
 
 
@@ -1915,9 +1913,9 @@ Search for an image on [Docker Hub](https://hub.docker.com).
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-## 2.3 Misc
+### 2.3 Misc
 
 
-### Check auth configuration
+#### Check auth configuration
 
 
 `POST /auth`
 `POST /auth`
 
 
@@ -1945,7 +1943,7 @@ Get the default username and email
 -   **204** – no error
 -   **204** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Display system-wide information
+#### Display system-wide information
 
 
 `GET /info`
 `GET /info`
 
 
@@ -2016,7 +2014,7 @@ Display system-wide information
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Show the docker version information
+#### Show the docker version information
 
 
 `GET /version`
 `GET /version`
 
 
@@ -2047,7 +2045,7 @@ Show the docker version information
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Ping the docker server
+#### Ping the docker server
 
 
 `GET /_ping`
 `GET /_ping`
 
 
@@ -2069,7 +2067,7 @@ Ping the docker server
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Create a new image from a container's changes
+#### Create a new image from a container's changes
 
 
 `POST /commit`
 `POST /commit`
 
 
@@ -2141,7 +2139,7 @@ Create a new image from a container's changes
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Monitor Docker's events
+#### Monitor Docker's events
 
 
 `GET /events`
 `GET /events`
 
 
@@ -2184,7 +2182,7 @@ Docker images report the following events:
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Get a tarball containing all images in a repository
+#### Get a tarball containing all images in a repository
 
 
 `GET /images/(name)/get`
 `GET /images/(name)/get`
 
 
@@ -2214,7 +2212,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Get a tarball containing all images
+#### Get a tarball containing all images
 
 
 `GET /images/get`
 `GET /images/get`
 
 
@@ -2243,7 +2241,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Load a tarball with a set of images and tags into docker
+#### Load a tarball with a set of images and tags into docker
 
 
 `POST /images/load`
 `POST /images/load`
 
 
@@ -2266,7 +2264,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Image tarball format
+#### Image tarball format
 
 
 An image tarball contains one directory per image layer (named using its long ID),
 An image tarball contains one directory per image layer (named using its long ID),
 each containing these files:
 each containing these files:
@@ -2287,7 +2285,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
 }
 }
 ```
 ```
 
 
-### Exec Create
+#### Exec Create
 
 
 `POST /containers/(id or name)/exec`
 `POST /containers/(id or name)/exec`
 
 
@@ -2337,7 +2335,7 @@ Sets up an exec instance in a running container `id`
 -   **409** - container is paused
 -   **409** - container is paused
 -   **500** - server error
 -   **500** - server error
 
 
-### Exec Start
+#### Exec Start
 
 
 `POST /exec/(id)/start`
 `POST /exec/(id)/start`
 
 
@@ -2379,7 +2377,7 @@ interactive session with the `exec` command.
 
 
 Similar to the stream behavior of `POST /containers/(id or name)/attach` API
 Similar to the stream behavior of `POST /containers/(id or name)/attach` API
 
 
-### Exec Resize
+#### Exec Resize
 
 
 `POST /exec/(id)/resize`
 `POST /exec/(id)/resize`
 
 
@@ -2406,7 +2404,7 @@ This API is valid only if `tty` was specified as part of creating and starting t
 -   **201** – no error
 -   **201** – no error
 -   **404** – no such exec instance
 -   **404** – no such exec instance
 
 
-### Exec Inspect
+#### Exec Inspect
 
 
 `GET /exec/(id)/json`
 `GET /exec/(id)/json`
 
 
@@ -2532,9 +2530,9 @@ Return low-level information about the `exec` command `id`.
 -   **404** – no such exec instance
 -   **404** – no such exec instance
 -   **500** - server error
 -   **500** - server error
 
 
-## 2.4 Volumes
+### 2.4 Volumes
 
 
-### List volumes
+#### List volumes
 
 
 `GET /volumes`
 `GET /volumes`
 
 
@@ -2566,7 +2564,7 @@ Return low-level information about the `exec` command `id`.
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Create a volume
+#### Create a volume
 
 
 `POST /volumes/create`
 `POST /volumes/create`
 
 
@@ -2604,7 +2602,7 @@ Create a volume
 - **DriverOpts** - A mapping of driver options and values. These options are
 - **DriverOpts** - A mapping of driver options and values. These options are
     passed directly to the driver and are driver specific.
     passed directly to the driver and are driver specific.
 
 
-### Inspect a volume
+#### Inspect a volume
 
 
 `GET /volumes/(name)`
 `GET /volumes/(name)`
 
 
@@ -2631,7 +2629,7 @@ Return low-level information on the volume `name`
 -   **404** - no such volume
 -   **404** - no such volume
 -   **500** - server error
 -   **500** - server error
 
 
-### Remove a volume
+#### Remove a volume
 
 
 `DELETE /volumes/(name)`
 `DELETE /volumes/(name)`
 
 
@@ -2652,9 +2650,9 @@ Instruct the driver to remove the volume (`name`).
 -   **409** - volume is in use and cannot be removed
 -   **409** - volume is in use and cannot be removed
 -   **500** - server error
 -   **500** - server error
 
 
-## 2.5 Networks
+### 2.5 Networks
 
 
-### List networks
+#### List networks
 
 
 `GET /networks`
 `GET /networks`
 
 
@@ -2735,7 +2733,7 @@ Content-Type: application/json
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Inspect network
+#### Inspect network
 
 
 `GET /networks/<network-id>`
 `GET /networks/<network-id>`
 
 
@@ -2786,7 +2784,7 @@ Content-Type: application/json
 -   **200** - no error
 -   **200** - no error
 -   **404** - network not found
 -   **404** - network not found
 
 
-### Create a network
+#### Create a network
 
 
 `POST /networks/create`
 `POST /networks/create`
 
 
@@ -2844,7 +2842,7 @@ Content-Type: application/json
       `{"Subnet": <CIDR>, "IPRange": <CIDR>, "Gateway": <IP address>, "AuxAddress": <device_name:IP address>}`
       `{"Subnet": <CIDR>, "IPRange": <CIDR>, "Gateway": <IP address>, "AuxAddress": <device_name:IP address>}`
 - **Options** - Network specific options to be used by the drivers
 - **Options** - Network specific options to be used by the drivers
 
 
-### Connect a container to a network
+#### Connect a container to a network
 
 
 `POST /networks/(id)/connect`
 `POST /networks/(id)/connect`
 
 
@@ -2875,7 +2873,7 @@ Content-Type: application/json
 
 
 - **container** - container-id/name to be connected to the network
 - **container** - container-id/name to be connected to the network
 
 
-### Disconnect a container from a network
+#### Disconnect a container from a network
 
 
 `POST /networks/(id)/disconnect`
 `POST /networks/(id)/disconnect`
 
 
@@ -2906,7 +2904,7 @@ Content-Type: application/json
 
 
 - **Container** - container-id/name to be disconnected from a network
 - **Container** - container-id/name to be disconnected from a network
 
 
-### Remove a network
+#### Remove a network
 
 
 `DELETE /networks/(id)`
 `DELETE /networks/(id)`
 
 
@@ -2926,9 +2924,9 @@ Instruct the driver to remove the network (`id`).
 -   **404** - no such network
 -   **404** - no such network
 -   **500** - server error
 -   **500** - server error
 
 
-# 3. Going further
+## 3. Going further
 
 
-## 3.1 Inside `docker run`
+### 3.1 Inside `docker run`
 
 
 As an example, the `docker run` command line makes the following API calls:
 As an example, the `docker run` command line makes the following API calls:
 
 
@@ -2946,7 +2944,7 @@ As an example, the `docker run` command line makes the following API calls:
 
 
 - If in detached mode or only `stdin` is attached, display the container's id.
 - If in detached mode or only `stdin` is attached, display the container's id.
 
 
-## 3.2 Hijacking
+### 3.2 Hijacking
 
 
 In this version of the API, `/attach`, uses hijacking to transport `stdin`,
 In this version of the API, `/attach`, uses hijacking to transport `stdin`,
 `stdout`, and `stderr` on the same socket.
 `stdout`, and `stderr` on the same socket.
@@ -2961,7 +2959,7 @@ When Docker daemon detects the `Upgrade` header, it switches its status code
 from **200 OK** to **101 UPGRADED** and resends the same headers.
 from **200 OK** to **101 UPGRADED** and resends the same headers.
 
 
 
 
-## 3.3 CORS Requests
+### 3.3 CORS Requests
 
 
 To set cross origin requests to the Engine API please give values to
 To set cross origin requests to the Engine API please give values to
 `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
 `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,

+ 69 - 71
docs/api/v1.22.md

@@ -16,9 +16,7 @@ redirect_from:
      will be rejected.
      will be rejected.
 -->
 -->
 
 
-# Docker Engine API v1.22
-
-# 1. Brief introduction
+## 1. Brief introduction
 
 
  - The daemon listens on `unix:///var/run/docker.sock` but you can
  - The daemon listens on `unix:///var/run/docker.sock` but you can
    [Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
    [Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
@@ -26,11 +24,11 @@ redirect_from:
    or `pull`, the HTTP connection is hijacked to transport `stdout`,
    or `pull`, the HTTP connection is hijacked to transport `stdout`,
    `stdin` and `stderr`.
    `stdin` and `stderr`.
 
 
-# 2. Endpoints
+## 2. Endpoints
 
 
-## 2.1 Containers
+### 2.1 Containers
 
 
-### List containers
+#### List containers
 
 
 `GET /containers/json`
 `GET /containers/json`
 
 
@@ -212,7 +210,7 @@ List containers
 -   **400** – bad parameter
 -   **400** – bad parameter
 -   **500** – server error
 -   **500** – server error
 
 
-### Create a container
+#### Create a container
 
 
 `POST /containers/create`
 `POST /containers/create`
 
 
@@ -460,7 +458,7 @@ Create a container
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect a container
+#### Inspect a container
 
 
 `GET /containers/(id or name)/json`
 `GET /containers/(id or name)/json`
 
 
@@ -663,7 +661,7 @@ Return low-level information on the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### List processes running inside a container
+#### List processes running inside a container
 
 
 `GET /containers/(id or name)/top`
 `GET /containers/(id or name)/top`
 
 
@@ -727,7 +725,7 @@ supported on Windows.
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Get container logs
+#### Get container logs
 
 
 `GET /containers/(id or name)/logs`
 `GET /containers/(id or name)/logs`
 
 
@@ -769,7 +767,7 @@ Get `stdout` and `stderr` logs from the container ``id``
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect changes on a container's filesystem
+#### Inspect changes on a container's filesystem
 
 
 `GET /containers/(id or name)/changes`
 `GET /containers/(id or name)/changes`
 
 
@@ -811,7 +809,7 @@ Values for `Kind`:
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Export a container
+#### Export a container
 
 
 `GET /containers/(id or name)/export`
 `GET /containers/(id or name)/export`
 
 
@@ -836,7 +834,7 @@ Export the contents of container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Get container stats based on resource usage
+#### Get container stats based on resource usage
 
 
 `GET /containers/(id or name)/stats`
 `GET /containers/(id or name)/stats`
 
 
@@ -957,7 +955,7 @@ The precpu_stats is the cpu statistic of last read, which is used for calculatin
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Resize a container TTY
+#### Resize a container TTY
 
 
 `POST /containers/(id or name)/resize`
 `POST /containers/(id or name)/resize`
 
 
@@ -984,7 +982,7 @@ Resize the TTY for container with  `id`. The unit is number of characters. You m
 -   **404** – No such container
 -   **404** – No such container
 -   **500** – Cannot resize container
 -   **500** – Cannot resize container
 
 
-### Start a container
+#### Start a container
 
 
 `POST /containers/(id or name)/start`
 `POST /containers/(id or name)/start`
 
 
@@ -1015,7 +1013,7 @@ Start the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Stop a container
+#### Stop a container
 
 
 `POST /containers/(id or name)/stop`
 `POST /containers/(id or name)/stop`
 
 
@@ -1040,7 +1038,7 @@ Stop the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Restart a container
+#### Restart a container
 
 
 `POST /containers/(id or name)/restart`
 `POST /containers/(id or name)/restart`
 
 
@@ -1064,7 +1062,7 @@ Restart the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Kill a container
+#### Kill a container
 
 
 `POST /containers/(id or name)/kill`
 `POST /containers/(id or name)/kill`
 
 
@@ -1089,7 +1087,7 @@ Kill the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Update a container
+#### Update a container
 
 
 `POST /containers/(id or name)/update`
 `POST /containers/(id or name)/update`
 
 
@@ -1129,7 +1127,7 @@ Update resource configs of one or more containers.
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Rename a container
+#### Rename a container
 
 
 `POST /containers/(id or name)/rename`
 `POST /containers/(id or name)/rename`
 
 
@@ -1154,7 +1152,7 @@ Rename the container `id` to a `new_name`
 -   **409** - conflict name already assigned
 -   **409** - conflict name already assigned
 -   **500** – server error
 -   **500** – server error
 
 
-### Pause a container
+#### Pause a container
 
 
 `POST /containers/(id or name)/pause`
 `POST /containers/(id or name)/pause`
 
 
@@ -1174,7 +1172,7 @@ Pause the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Unpause a container
+#### Unpause a container
 
 
 `POST /containers/(id or name)/unpause`
 `POST /containers/(id or name)/unpause`
 
 
@@ -1194,7 +1192,7 @@ Unpause the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Attach to a container
+#### Attach to a container
 
 
 `POST /containers/(id or name)/attach`
 `POST /containers/(id or name)/attach`
 
 
@@ -1283,7 +1281,7 @@ The simplest way to implement the Attach protocol is the following:
     4.  Read the extracted size and output it on the correct output.
     4.  Read the extracted size and output it on the correct output.
     5.  Goto 1.
     5.  Goto 1.
 
 
-### Attach to a container (websocket)
+#### Attach to a container (websocket)
 
 
 `GET /containers/(id or name)/attach/ws`
 `GET /containers/(id or name)/attach/ws`
 
 
@@ -1323,7 +1321,7 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Wait a container
+#### Wait a container
 
 
 `POST /containers/(id or name)/wait`
 `POST /containers/(id or name)/wait`
 
 
@@ -1346,7 +1344,7 @@ Block until container `id` stops, then returns the exit code
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove a container
+#### Remove a container
 
 
 `DELETE /containers/(id or name)`
 `DELETE /containers/(id or name)`
 
 
@@ -1375,7 +1373,7 @@ Remove the container `id` from the filesystem
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Copy files or folders from a container
+#### Copy files or folders from a container
 
 
 `POST /containers/(id or name)/copy`
 `POST /containers/(id or name)/copy`
 
 
@@ -1407,14 +1405,14 @@ Copy files or folders of container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Retrieving information about files and folders in a container
+#### Retrieving information about files and folders in a container
 
 
 `HEAD /containers/(id or name)/archive`
 `HEAD /containers/(id or name)/archive`
 
 
 See the description of the `X-Docker-Container-Path-Stat` header in the
 See the description of the `X-Docker-Container-Path-Stat` header in the
 following section.
 following section.
 
 
-### Get an archive of a filesystem resource in a container
+#### Get an archive of a filesystem resource in a container
 
 
 `GET /containers/(id or name)/archive`
 `GET /containers/(id or name)/archive`
 
 
@@ -1479,7 +1477,7 @@ desired.
     - no such file or directory (**path** does not exist)
     - no such file or directory (**path** does not exist)
 - **500** - server error
 - **500** - server error
 
 
-### Extract an archive of files or folders to a directory in a container
+#### Extract an archive of files or folders to a directory in a container
 
 
 `PUT /containers/(id or name)/archive`
 `PUT /containers/(id or name)/archive`
 
 
@@ -1527,9 +1525,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
     - no such file or directory (**path** resource does not exist)
     - no such file or directory (**path** resource does not exist)
 - **500** – server error
 - **500** – server error
 
 
-## 2.2 Images
+### 2.2 Images
 
 
-### List Images
+#### List Images
 
 
 `GET /images/json`
 `GET /images/json`
 
 
@@ -1620,7 +1618,7 @@ references on the command line.
   -   `label=key` or `label="key=value"` of an image label
   -   `label=key` or `label="key=value"` of an image label
 -   **filter** - only return images with the specified name
 -   **filter** - only return images with the specified name
 
 
-### Build image from a Dockerfile
+#### Build image from a Dockerfile
 
 
 `POST /build`
 `POST /build`
 
 
@@ -1725,7 +1723,7 @@ or being killed.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Create an image
+#### Create an image
 
 
 `POST /images/create`
 `POST /images/create`
 
 
@@ -1791,7 +1789,7 @@ a base64-encoded AuthConfig object.
 
 
 
 
 
 
-### Inspect an image
+#### Inspect an image
 
 
 `GET /images/(name)/json`
 `GET /images/(name)/json`
 
 
@@ -1902,7 +1900,7 @@ Return low-level information on the image `name`
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Get the history of an image
+#### Get the history of an image
 
 
 `GET /images/(name)/history`
 `GET /images/(name)/history`
 
 
@@ -1956,7 +1954,7 @@ Return the history of the image `name`
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Push an image on the registry
+#### Push an image on the registry
 
 
 `POST /images/(name)/push`
 `POST /images/(name)/push`
 
 
@@ -2018,7 +2016,7 @@ The push is cancelled if the HTTP connection is closed.
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Tag an image into a repository
+#### Tag an image into a repository
 
 
 `POST /images/(name)/tag`
 `POST /images/(name)/tag`
 
 
@@ -2046,7 +2044,7 @@ Tag the image `name` into a repository
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove an image
+#### Remove an image
 
 
 `DELETE /images/(name)`
 `DELETE /images/(name)`
 
 
@@ -2079,7 +2077,7 @@ Remove the image `name` from the filesystem
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Search images
+#### Search images
 
 
 `GET /images/search`
 `GET /images/search`
 
 
@@ -2132,9 +2130,9 @@ Search for an image on [Docker Hub](https://hub.docker.com).
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-## 2.3 Misc
+### 2.3 Misc
 
 
-### Check auth configuration
+#### Check auth configuration
 
 
 `POST /auth`
 `POST /auth`
 
 
@@ -2162,7 +2160,7 @@ Get the default username and email
 -   **204** – no error
 -   **204** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Display system-wide information
+#### Display system-wide information
 
 
 `GET /info`
 `GET /info`
 
 
@@ -2249,7 +2247,7 @@ Display system-wide information
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Show the docker version information
+#### Show the docker version information
 
 
 `GET /version`
 `GET /version`
 
 
@@ -2281,7 +2279,7 @@ Show the docker version information
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Ping the docker server
+#### Ping the docker server
 
 
 `GET /_ping`
 `GET /_ping`
 
 
@@ -2303,7 +2301,7 @@ Ping the docker server
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Create a new image from a container's changes
+#### Create a new image from a container's changes
 
 
 `POST /commit`
 `POST /commit`
 
 
@@ -2375,7 +2373,7 @@ Create a new image from a container's changes
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Monitor Docker's events
+#### Monitor Docker's events
 
 
 `GET /events`
 `GET /events`
 
 
@@ -2575,7 +2573,7 @@ Docker networks report the following events:
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Get a tarball containing all images in a repository
+#### Get a tarball containing all images in a repository
 
 
 `GET /images/(name)/get`
 `GET /images/(name)/get`
 
 
@@ -2605,7 +2603,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Get a tarball containing all images
+#### Get a tarball containing all images
 
 
 `GET /images/get`
 `GET /images/get`
 
 
@@ -2634,7 +2632,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Load a tarball with a set of images and tags into docker
+#### Load a tarball with a set of images and tags into docker
 
 
 `POST /images/load`
 `POST /images/load`
 
 
@@ -2657,7 +2655,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Image tarball format
+#### Image tarball format
 
 
 An image tarball contains one directory per image layer (named using its long ID),
 An image tarball contains one directory per image layer (named using its long ID),
 each containing these files:
 each containing these files:
@@ -2678,7 +2676,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
 }
 }
 ```
 ```
 
 
-### Exec Create
+#### Exec Create
 
 
 `POST /containers/(id or name)/exec`
 `POST /containers/(id or name)/exec`
 
 
@@ -2732,7 +2730,7 @@ Sets up an exec instance in a running container `id`
 -   **409** - container is paused
 -   **409** - container is paused
 -   **500** - server error
 -   **500** - server error
 
 
-### Exec Start
+#### Exec Start
 
 
 `POST /exec/(id)/start`
 `POST /exec/(id)/start`
 
 
@@ -2774,7 +2772,7 @@ interactive session with the `exec` command.
 
 
 Similar to the stream behavior of `POST /containers/(id or name)/attach` API
 Similar to the stream behavior of `POST /containers/(id or name)/attach` API
 
 
-### Exec Resize
+#### Exec Resize
 
 
 `POST /exec/(id)/resize`
 `POST /exec/(id)/resize`
 
 
@@ -2801,7 +2799,7 @@ This API is valid only if `tty` was specified as part of creating and starting t
 -   **201** – no error
 -   **201** – no error
 -   **404** – no such exec instance
 -   **404** – no such exec instance
 
 
-### Exec Inspect
+#### Exec Inspect
 
 
 `GET /exec/(id)/json`
 `GET /exec/(id)/json`
 
 
@@ -2844,9 +2842,9 @@ Return low-level information about the `exec` command `id`.
 -   **404** – no such exec instance
 -   **404** – no such exec instance
 -   **500** - server error
 -   **500** - server error
 
 
-## 2.4 Volumes
+### 2.4 Volumes
 
 
-### List volumes
+#### List volumes
 
 
 `GET /volumes`
 `GET /volumes`
 
 
@@ -2879,7 +2877,7 @@ Return low-level information about the `exec` command `id`.
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Create a volume
+#### Create a volume
 
 
 `POST /volumes/create`
 `POST /volumes/create`
 
 
@@ -2917,7 +2915,7 @@ Create a volume
 - **DriverOpts** - A mapping of driver options and values. These options are
 - **DriverOpts** - A mapping of driver options and values. These options are
     passed directly to the driver and are driver specific.
     passed directly to the driver and are driver specific.
 
 
-### Inspect a volume
+#### Inspect a volume
 
 
 `GET /volumes/(name)`
 `GET /volumes/(name)`
 
 
@@ -2944,7 +2942,7 @@ Return low-level information on the volume `name`
 -   **404** - no such volume
 -   **404** - no such volume
 -   **500** - server error
 -   **500** - server error
 
 
-### Remove a volume
+#### Remove a volume
 
 
 `DELETE /volumes/(name)`
 `DELETE /volumes/(name)`
 
 
@@ -2965,9 +2963,9 @@ Instruct the driver to remove the volume (`name`).
 -   **409** - volume is in use and cannot be removed
 -   **409** - volume is in use and cannot be removed
 -   **500** - server error
 -   **500** - server error
 
 
-## 2.5 Networks
+### 2.5 Networks
 
 
-### List networks
+#### List networks
 
 
 `GET /networks`
 `GET /networks`
 
 
@@ -3051,7 +3049,7 @@ Content-Type: application/json
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Inspect network
+#### Inspect network
 
 
 `GET /networks/<network-id>`
 `GET /networks/<network-id>`
 
 
@@ -3107,7 +3105,7 @@ Content-Type: application/json
 -   **200** - no error
 -   **200** - no error
 -   **404** - network not found
 -   **404** - network not found
 
 
-### Create a network
+#### Create a network
 
 
 `POST /networks/create`
 `POST /networks/create`
 
 
@@ -3174,7 +3172,7 @@ Content-Type: application/json
   - **Options** - Driver-specific options, specified as a map: `{"option":"value" [,"option2":"value2"]}`
   - **Options** - Driver-specific options, specified as a map: `{"option":"value" [,"option2":"value2"]}`
 - **Options** - Network specific options to be used by the drivers
 - **Options** - Network specific options to be used by the drivers
 
 
-### Connect a container to a network
+#### Connect a container to a network
 
 
 `POST /networks/(id)/connect`
 `POST /networks/(id)/connect`
 
 
@@ -3211,7 +3209,7 @@ Content-Type: application/json
 
 
 - **container** - container-id/name to be connected to the network
 - **container** - container-id/name to be connected to the network
 
 
-### Disconnect a container from a network
+#### Disconnect a container from a network
 
 
 `POST /networks/(id)/disconnect`
 `POST /networks/(id)/disconnect`
 
 
@@ -3244,7 +3242,7 @@ Content-Type: application/json
 - **Container** - container-id/name to be disconnected from a network
 - **Container** - container-id/name to be disconnected from a network
 - **Force** - Force the container to disconnect from a network
 - **Force** - Force the container to disconnect from a network
 
 
-### Remove a network
+#### Remove a network
 
 
 `DELETE /networks/(id)`
 `DELETE /networks/(id)`
 
 
@@ -3264,9 +3262,9 @@ Instruct the driver to remove the network (`id`).
 -   **404** - no such network
 -   **404** - no such network
 -   **500** - server error
 -   **500** - server error
 
 
-# 3. Going further
+## 3. Going further
 
 
-## 3.1 Inside `docker run`
+### 3.1 Inside `docker run`
 
 
 As an example, the `docker run` command line makes the following API calls:
 As an example, the `docker run` command line makes the following API calls:
 
 
@@ -3284,7 +3282,7 @@ As an example, the `docker run` command line makes the following API calls:
 
 
 - If in detached mode or only `stdin` is attached, display the container's id.
 - If in detached mode or only `stdin` is attached, display the container's id.
 
 
-## 3.2 Hijacking
+### 3.2 Hijacking
 
 
 In this version of the API, `/attach`, uses hijacking to transport `stdin`,
 In this version of the API, `/attach`, uses hijacking to transport `stdin`,
 `stdout`, and `stderr` on the same socket.
 `stdout`, and `stderr` on the same socket.
@@ -3299,7 +3297,7 @@ When Docker daemon detects the `Upgrade` header, it switches its status code
 from **200 OK** to **101 UPGRADED** and resends the same headers.
 from **200 OK** to **101 UPGRADED** and resends the same headers.
 
 
 
 
-## 3.3 CORS Requests
+### 3.3 CORS Requests
 
 
 To set cross origin requests to the Engine API please give values to
 To set cross origin requests to the Engine API please give values to
 `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
 `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,

+ 68 - 70
docs/api/v1.23.md

@@ -16,8 +16,6 @@ redirect_from:
      will be rejected.
      will be rejected.
 -->
 -->
 
 
-# Docker Engine API v1.23
-
 ## 1. Brief introduction
 ## 1. Brief introduction
 
 
  - The daemon listens on `unix:///var/run/docker.sock` but you can
  - The daemon listens on `unix:///var/run/docker.sock` but you can
@@ -28,11 +26,11 @@ redirect_from:
  - When the client API version is newer than the daemon's, these calls return an HTTP
  - When the client API version is newer than the daemon's, these calls return an HTTP
    `400 Bad Request` error message.
    `400 Bad Request` error message.
 
 
-# 2. Endpoints
+## 2. Endpoints
 
 
-## 2.1 Containers
+### 2.1 Containers
 
 
-### List containers
+#### List containers
 
 
 `GET /containers/json`
 `GET /containers/json`
 
 
@@ -236,7 +234,7 @@ List containers
 -   **400** – bad parameter
 -   **400** – bad parameter
 -   **500** – server error
 -   **500** – server error
 
 
-### Create a container
+#### Create a container
 
 
 `POST /containers/create`
 `POST /containers/create`
 
 
@@ -488,7 +486,7 @@ Create a container
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect a container
+#### Inspect a container
 
 
 `GET /containers/(id or name)/json`
 `GET /containers/(id or name)/json`
 
 
@@ -691,7 +689,7 @@ Return low-level information on the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### List processes running inside a container
+#### List processes running inside a container
 
 
 `GET /containers/(id or name)/top`
 `GET /containers/(id or name)/top`
 
 
@@ -755,7 +753,7 @@ supported on Windows.
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Get container logs
+#### Get container logs
 
 
 `GET /containers/(id or name)/logs`
 `GET /containers/(id or name)/logs`
 
 
@@ -797,7 +795,7 @@ Get `stdout` and `stderr` logs from the container ``id``
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect changes on a container's filesystem
+#### Inspect changes on a container's filesystem
 
 
 `GET /containers/(id or name)/changes`
 `GET /containers/(id or name)/changes`
 
 
@@ -839,7 +837,7 @@ Values for `Kind`:
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Export a container
+#### Export a container
 
 
 `GET /containers/(id or name)/export`
 `GET /containers/(id or name)/export`
 
 
@@ -864,7 +862,7 @@ Export the contents of container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Get container stats based on resource usage
+#### Get container stats based on resource usage
 
 
 `GET /containers/(id or name)/stats`
 `GET /containers/(id or name)/stats`
 
 
@@ -988,7 +986,7 @@ The precpu_stats is the cpu statistic of last read, which is used for calculatin
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Resize a container TTY
+#### Resize a container TTY
 
 
 `POST /containers/(id or name)/resize`
 `POST /containers/(id or name)/resize`
 
 
@@ -1015,7 +1013,7 @@ Resize the TTY for container with  `id`. The unit is number of characters. You m
 -   **404** – No such container
 -   **404** – No such container
 -   **500** – Cannot resize container
 -   **500** – Cannot resize container
 
 
-### Start a container
+#### Start a container
 
 
 `POST /containers/(id or name)/start`
 `POST /containers/(id or name)/start`
 
 
@@ -1046,7 +1044,7 @@ Start the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Stop a container
+#### Stop a container
 
 
 `POST /containers/(id or name)/stop`
 `POST /containers/(id or name)/stop`
 
 
@@ -1071,7 +1069,7 @@ Stop the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Restart a container
+#### Restart a container
 
 
 `POST /containers/(id or name)/restart`
 `POST /containers/(id or name)/restart`
 
 
@@ -1095,7 +1093,7 @@ Restart the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Kill a container
+#### Kill a container
 
 
 `POST /containers/(id or name)/kill`
 `POST /containers/(id or name)/kill`
 
 
@@ -1120,7 +1118,7 @@ Kill the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Update a container
+#### Update a container
 
 
 `POST /containers/(id or name)/update`
 `POST /containers/(id or name)/update`
 
 
@@ -1164,7 +1162,7 @@ Update configuration of one or more containers.
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Rename a container
+#### Rename a container
 
 
 `POST /containers/(id or name)/rename`
 `POST /containers/(id or name)/rename`
 
 
@@ -1189,7 +1187,7 @@ Rename the container `id` to a `new_name`
 -   **409** - conflict name already assigned
 -   **409** - conflict name already assigned
 -   **500** – server error
 -   **500** – server error
 
 
-### Pause a container
+#### Pause a container
 
 
 `POST /containers/(id or name)/pause`
 `POST /containers/(id or name)/pause`
 
 
@@ -1209,7 +1207,7 @@ Pause the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Unpause a container
+#### Unpause a container
 
 
 `POST /containers/(id or name)/unpause`
 `POST /containers/(id or name)/unpause`
 
 
@@ -1229,7 +1227,7 @@ Unpause the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Attach to a container
+#### Attach to a container
 
 
 `POST /containers/(id or name)/attach`
 `POST /containers/(id or name)/attach`
 
 
@@ -1318,7 +1316,7 @@ The simplest way to implement the Attach protocol is the following:
     4.  Read the extracted size and output it on the correct output.
     4.  Read the extracted size and output it on the correct output.
     5.  Goto 1.
     5.  Goto 1.
 
 
-### Attach to a container (websocket)
+#### Attach to a container (websocket)
 
 
 `GET /containers/(id or name)/attach/ws`
 `GET /containers/(id or name)/attach/ws`
 
 
@@ -1358,7 +1356,7 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Wait a container
+#### Wait a container
 
 
 `POST /containers/(id or name)/wait`
 `POST /containers/(id or name)/wait`
 
 
@@ -1381,7 +1379,7 @@ Block until container `id` stops, then returns the exit code
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove a container
+#### Remove a container
 
 
 `DELETE /containers/(id or name)`
 `DELETE /containers/(id or name)`
 
 
@@ -1410,7 +1408,7 @@ Remove the container `id` from the filesystem
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Copy files or folders from a container
+#### Copy files or folders from a container
 
 
 `POST /containers/(id or name)/copy`
 `POST /containers/(id or name)/copy`
 
 
@@ -1442,14 +1440,14 @@ Copy files or folders of container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Retrieving information about files and folders in a container
+#### Retrieving information about files and folders in a container
 
 
 `HEAD /containers/(id or name)/archive`
 `HEAD /containers/(id or name)/archive`
 
 
 See the description of the `X-Docker-Container-Path-Stat` header in the
 See the description of the `X-Docker-Container-Path-Stat` header in the
 following section.
 following section.
 
 
-### Get an archive of a filesystem resource in a container
+#### Get an archive of a filesystem resource in a container
 
 
 `GET /containers/(id or name)/archive`
 `GET /containers/(id or name)/archive`
 
 
@@ -1514,7 +1512,7 @@ desired.
     - no such file or directory (**path** does not exist)
     - no such file or directory (**path** does not exist)
 - **500** - server error
 - **500** - server error
 
 
-### Extract an archive of files or folders to a directory in a container
+#### Extract an archive of files or folders to a directory in a container
 
 
 `PUT /containers/(id or name)/archive`
 `PUT /containers/(id or name)/archive`
 
 
@@ -1562,9 +1560,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
     - no such file or directory (**path** resource does not exist)
     - no such file or directory (**path** resource does not exist)
 - **500** – server error
 - **500** – server error
 
 
-## 2.2 Images
+### 2.2 Images
 
 
-### List Images
+#### List Images
 
 
 `GET /images/json`
 `GET /images/json`
 
 
@@ -1655,7 +1653,7 @@ references on the command line.
   -   `label=key` or `label="key=value"` of an image label
   -   `label=key` or `label="key=value"` of an image label
 -   **filter** - only return images with the specified name
 -   **filter** - only return images with the specified name
 
 
-### Build image from a Dockerfile
+#### Build image from a Dockerfile
 
 
 `POST /build`
 `POST /build`
 
 
@@ -1761,7 +1759,7 @@ or being killed.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Create an image
+#### Create an image
 
 
 `POST /images/create`
 `POST /images/create`
 
 
@@ -1827,7 +1825,7 @@ a base64-encoded AuthConfig object.
 
 
 
 
 
 
-### Inspect an image
+#### Inspect an image
 
 
 `GET /images/(name)/json`
 `GET /images/(name)/json`
 
 
@@ -1945,7 +1943,7 @@ Return low-level information on the image `name`
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Get the history of an image
+#### Get the history of an image
 
 
 `GET /images/(name)/history`
 `GET /images/(name)/history`
 
 
@@ -1999,7 +1997,7 @@ Return the history of the image `name`
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Push an image on the registry
+#### Push an image on the registry
 
 
 `POST /images/(name)/push`
 `POST /images/(name)/push`
 
 
@@ -2061,7 +2059,7 @@ The push is cancelled if the HTTP connection is closed.
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Tag an image into a repository
+#### Tag an image into a repository
 
 
 `POST /images/(name)/tag`
 `POST /images/(name)/tag`
 
 
@@ -2089,7 +2087,7 @@ Tag the image `name` into a repository
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove an image
+#### Remove an image
 
 
 `DELETE /images/(name)`
 `DELETE /images/(name)`
 
 
@@ -2122,7 +2120,7 @@ Remove the image `name` from the filesystem
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Search images
+#### Search images
 
 
 `GET /images/search`
 `GET /images/search`
 
 
@@ -2175,9 +2173,9 @@ Search for an image on [Docker Hub](https://hub.docker.com).
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-## 2.3 Misc
+### 2.3 Misc
 
 
-### Check auth configuration
+#### Check auth configuration
 
 
 `POST /auth`
 `POST /auth`
 
 
@@ -2210,7 +2208,7 @@ if available, for accessing the registry without password.
 -   **204** – no error
 -   **204** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Display system-wide information
+#### Display system-wide information
 
 
 `GET /info`
 `GET /info`
 
 
@@ -2299,7 +2297,7 @@ Display system-wide information
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Show the docker version information
+#### Show the docker version information
 
 
 `GET /version`
 `GET /version`
 
 
@@ -2331,7 +2329,7 @@ Show the docker version information
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Ping the docker server
+#### Ping the docker server
 
 
 `GET /_ping`
 `GET /_ping`
 
 
@@ -2353,7 +2351,7 @@ Ping the docker server
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Create a new image from a container's changes
+#### Create a new image from a container's changes
 
 
 `POST /commit`
 `POST /commit`
 
 
@@ -2425,7 +2423,7 @@ Create a new image from a container's changes
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Monitor Docker's events
+#### Monitor Docker's events
 
 
 `GET /events`
 `GET /events`
 
 
@@ -2625,7 +2623,7 @@ Docker networks report the following events:
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Get a tarball containing all images in a repository
+#### Get a tarball containing all images in a repository
 
 
 `GET /images/(name)/get`
 `GET /images/(name)/get`
 
 
@@ -2655,7 +2653,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Get a tarball containing all images
+#### Get a tarball containing all images
 
 
 `GET /images/get`
 `GET /images/get`
 
 
@@ -2684,7 +2682,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Load a tarball with a set of images and tags into docker
+#### Load a tarball with a set of images and tags into docker
 
 
 `POST /images/load`
 `POST /images/load`
 
 
@@ -2733,7 +2731,7 @@ action completes.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Image tarball format
+#### Image tarball format
 
 
 An image tarball contains one directory per image layer (named using its long ID),
 An image tarball contains one directory per image layer (named using its long ID),
 each containing these files:
 each containing these files:
@@ -2754,7 +2752,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
 }
 }
 ```
 ```
 
 
-### Exec Create
+#### Exec Create
 
 
 `POST /containers/(id or name)/exec`
 `POST /containers/(id or name)/exec`
 
 
@@ -2808,7 +2806,7 @@ Sets up an exec instance in a running container `id`
 -   **409** - container is paused
 -   **409** - container is paused
 -   **500** - server error
 -   **500** - server error
 
 
-### Exec Start
+#### Exec Start
 
 
 `POST /exec/(id)/start`
 `POST /exec/(id)/start`
 
 
@@ -2850,7 +2848,7 @@ interactive session with the `exec` command.
 
 
 Similar to the stream behavior of `POST /containers/(id or name)/attach` API
 Similar to the stream behavior of `POST /containers/(id or name)/attach` API
 
 
-### Exec Resize
+#### Exec Resize
 
 
 `POST /exec/(id)/resize`
 `POST /exec/(id)/resize`
 
 
@@ -2877,7 +2875,7 @@ This API is valid only if `tty` was specified as part of creating and starting t
 -   **201** – no error
 -   **201** – no error
 -   **404** – no such exec instance
 -   **404** – no such exec instance
 
 
-### Exec Inspect
+#### Exec Inspect
 
 
 `GET /exec/(id)/json`
 `GET /exec/(id)/json`
 
 
@@ -2920,9 +2918,9 @@ Return low-level information about the `exec` command `id`.
 -   **404** – no such exec instance
 -   **404** – no such exec instance
 -   **500** - server error
 -   **500** - server error
 
 
-## 2.4 Volumes
+### 2.4 Volumes
 
 
-### List volumes
+#### List volumes
 
 
 `GET /volumes`
 `GET /volumes`
 
 
@@ -2955,7 +2953,7 @@ Return low-level information about the `exec` command `id`.
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Create a volume
+#### Create a volume
 
 
 `POST /volumes/create`
 `POST /volumes/create`
 
 
@@ -3002,7 +3000,7 @@ Create a volume
     passed directly to the driver and are driver specific.
     passed directly to the driver and are driver specific.
 - **Labels** - Labels to set on the volume, specified as a map: `{"key":"value","key2":"value2"}`
 - **Labels** - Labels to set on the volume, specified as a map: `{"key":"value","key2":"value2"}`
 
 
-### Inspect a volume
+#### Inspect a volume
 
 
 `GET /volumes/(name)`
 `GET /volumes/(name)`
 
 
@@ -3033,7 +3031,7 @@ Return low-level information on the volume `name`
 -   **404** - no such volume
 -   **404** - no such volume
 -   **500** - server error
 -   **500** - server error
 
 
-### Remove a volume
+#### Remove a volume
 
 
 `DELETE /volumes/(name)`
 `DELETE /volumes/(name)`
 
 
@@ -3054,9 +3052,9 @@ Instruct the driver to remove the volume (`name`).
 -   **409** - volume is in use and cannot be removed
 -   **409** - volume is in use and cannot be removed
 -   **500** - server error
 -   **500** - server error
 
 
-## 3.5 Networks
+### 3.5 Networks
 
 
-### List networks
+#### List networks
 
 
 `GET /networks`
 `GET /networks`
 
 
@@ -3146,7 +3144,7 @@ Content-Type: application/json
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Inspect network
+#### Inspect network
 
 
 `GET /networks/<network-id>`
 `GET /networks/<network-id>`
 
 
@@ -3208,7 +3206,7 @@ Content-Type: application/json
 -   **200** - no error
 -   **200** - no error
 -   **404** - network not found
 -   **404** - network not found
 
 
-### Create a network
+#### Create a network
 
 
 `POST /networks/create`
 `POST /networks/create`
 
 
@@ -3291,7 +3289,7 @@ Content-Type: application/json
 - **Options** - Network specific options to be used by the drivers
 - **Options** - Network specific options to be used by the drivers
 - **Labels** - Labels to set on the network, specified as a map: `{"key":"value" [,"key2":"value2"]}`
 - **Labels** - Labels to set on the network, specified as a map: `{"key":"value" [,"key2":"value2"]}`
 
 
-### Connect a container to a network
+#### Connect a container to a network
 
 
 `POST /networks/(id)/connect`
 `POST /networks/(id)/connect`
 
 
@@ -3328,7 +3326,7 @@ Content-Type: application/json
 
 
 - **container** - container-id/name to be connected to the network
 - **container** - container-id/name to be connected to the network
 
 
-### Disconnect a container from a network
+#### Disconnect a container from a network
 
 
 `POST /networks/(id)/disconnect`
 `POST /networks/(id)/disconnect`
 
 
@@ -3361,7 +3359,7 @@ Content-Type: application/json
 - **Container** - container-id/name to be disconnected from a network
 - **Container** - container-id/name to be disconnected from a network
 - **Force** - Force the container to disconnect from a network
 - **Force** - Force the container to disconnect from a network
 
 
-### Remove a network
+#### Remove a network
 
 
 `DELETE /networks/(id)`
 `DELETE /networks/(id)`
 
 
@@ -3381,9 +3379,9 @@ Instruct the driver to remove the network (`id`).
 -   **404** - no such network
 -   **404** - no such network
 -   **500** - server error
 -   **500** - server error
 
 
-# 3. Going further
+## 3. Going further
 
 
-## 3.1 Inside `docker run`
+### 3.1 Inside `docker run`
 
 
 As an example, the `docker run` command line makes the following API calls:
 As an example, the `docker run` command line makes the following API calls:
 
 
@@ -3401,7 +3399,7 @@ As an example, the `docker run` command line makes the following API calls:
 
 
 - If in detached mode or only `stdin` is attached, display the container's id.
 - If in detached mode or only `stdin` is attached, display the container's id.
 
 
-## 3.2 Hijacking
+### 3.2 Hijacking
 
 
 In this version of the API, `/attach`, uses hijacking to transport `stdin`,
 In this version of the API, `/attach`, uses hijacking to transport `stdin`,
 `stdout`, and `stderr` on the same socket.
 `stdout`, and `stderr` on the same socket.
@@ -3416,7 +3414,7 @@ When Docker daemon detects the `Upgrade` header, it switches its status code
 from **200 OK** to **101 UPGRADED** and resends the same headers.
 from **200 OK** to **101 UPGRADED** and resends the same headers.
 
 
 
 
-## 3.3 CORS Requests
+### 3.3 CORS Requests
 
 
 To set cross origin requests to the Engine API please give values to
 To set cross origin requests to the Engine API please give values to
 `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
 `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,

+ 97 - 99
docs/api/v1.24.md

@@ -16,9 +16,7 @@ redirect_from:
      will be rejected.
      will be rejected.
 -->
 -->
 
 
-# Docker Engine API v1.24
-
-# 1. Brief introduction
+## 1. Brief introduction
 
 
  - The daemon listens on `unix:///var/run/docker.sock` but you can
  - The daemon listens on `unix:///var/run/docker.sock` but you can
    [Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
    [Bind Docker to another host/port or a Unix socket](../commandline/dockerd.md#bind-docker-to-another-host-port-or-a-unix-socket).
@@ -26,7 +24,7 @@ redirect_from:
    or `pull`, the HTTP connection is hijacked to transport `stdout`,
    or `pull`, the HTTP connection is hijacked to transport `stdout`,
    `stdin` and `stderr`.
    `stdin` and `stderr`.
 
 
-# 2. Errors
+## 2. Errors
 
 
 The Engine API uses standard HTTP status codes to indicate the success or failure of the API call. The body of the response will be JSON in the following format:
 The Engine API uses standard HTTP status codes to indicate the success or failure of the API call. The body of the response will be JSON in the following format:
 
 
@@ -36,11 +34,11 @@ The Engine API uses standard HTTP status codes to indicate the success or failur
 
 
 The status codes that are returned for each endpoint are specified in the endpoint documentation below.
 The status codes that are returned for each endpoint are specified in the endpoint documentation below.
 
 
-# 3. Endpoints
+## 3. Endpoints
 
 
-## 3.1 Containers
+### 3.1 Containers
 
 
-### List containers
+#### List containers
 
 
 `GET /containers/json`
 `GET /containers/json`
 
 
@@ -245,7 +243,7 @@ List containers
 -   **400** – bad parameter
 -   **400** – bad parameter
 -   **500** – server error
 -   **500** – server error
 
 
-### Create a container
+#### Create a container
 
 
 `POST /containers/create`
 `POST /containers/create`
 
 
@@ -511,7 +509,7 @@ Create a container
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect a container
+#### Inspect a container
 
 
 `GET /containers/(id or name)/json`
 `GET /containers/(id or name)/json`
 
 
@@ -721,7 +719,7 @@ Return low-level information on the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### List processes running inside a container
+#### List processes running inside a container
 
 
 `GET /containers/(id or name)/top`
 `GET /containers/(id or name)/top`
 
 
@@ -785,7 +783,7 @@ supported on Windows.
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Get container logs
+#### Get container logs
 
 
 `GET /containers/(id or name)/logs`
 `GET /containers/(id or name)/logs`
 
 
@@ -828,7 +826,7 @@ Get `stdout` and `stderr` logs from the container ``id``
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect changes on a container's filesystem
+#### Inspect changes on a container's filesystem
 
 
 `GET /containers/(id or name)/changes`
 `GET /containers/(id or name)/changes`
 
 
@@ -870,7 +868,7 @@ Values for `Kind`:
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Export a container
+#### Export a container
 
 
 `GET /containers/(id or name)/export`
 `GET /containers/(id or name)/export`
 
 
@@ -895,7 +893,7 @@ Export the contents of container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Get container stats based on resource usage
+#### Get container stats based on resource usage
 
 
 `GET /containers/(id or name)/stats`
 `GET /containers/(id or name)/stats`
 
 
@@ -1019,7 +1017,7 @@ The precpu_stats is the cpu statistic of last read, which is used for calculatin
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Resize a container TTY
+#### Resize a container TTY
 
 
 `POST /containers/(id or name)/resize`
 `POST /containers/(id or name)/resize`
 
 
@@ -1046,7 +1044,7 @@ Resize the TTY for container with  `id`. The unit is number of characters. You m
 -   **404** – No such container
 -   **404** – No such container
 -   **500** – Cannot resize container
 -   **500** – Cannot resize container
 
 
-### Start a container
+#### Start a container
 
 
 `POST /containers/(id or name)/start`
 `POST /containers/(id or name)/start`
 
 
@@ -1073,7 +1071,7 @@ Start the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Stop a container
+#### Stop a container
 
 
 `POST /containers/(id or name)/stop`
 `POST /containers/(id or name)/stop`
 
 
@@ -1098,7 +1096,7 @@ Stop the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Restart a container
+#### Restart a container
 
 
 `POST /containers/(id or name)/restart`
 `POST /containers/(id or name)/restart`
 
 
@@ -1122,7 +1120,7 @@ Restart the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Kill a container
+#### Kill a container
 
 
 `POST /containers/(id or name)/kill`
 `POST /containers/(id or name)/kill`
 
 
@@ -1147,7 +1145,7 @@ Kill the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Update a container
+#### Update a container
 
 
 `POST /containers/(id or name)/update`
 `POST /containers/(id or name)/update`
 
 
@@ -1191,7 +1189,7 @@ Update configuration of one or more containers.
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Rename a container
+#### Rename a container
 
 
 `POST /containers/(id or name)/rename`
 `POST /containers/(id or name)/rename`
 
 
@@ -1216,7 +1214,7 @@ Rename the container `id` to a `new_name`
 -   **409** - conflict name already assigned
 -   **409** - conflict name already assigned
 -   **500** – server error
 -   **500** – server error
 
 
-### Pause a container
+#### Pause a container
 
 
 `POST /containers/(id or name)/pause`
 `POST /containers/(id or name)/pause`
 
 
@@ -1236,7 +1234,7 @@ Pause the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Unpause a container
+#### Unpause a container
 
 
 `POST /containers/(id or name)/unpause`
 `POST /containers/(id or name)/unpause`
 
 
@@ -1256,7 +1254,7 @@ Unpause the container `id`
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Attach to a container
+#### Attach to a container
 
 
 `POST /containers/(id or name)/attach`
 `POST /containers/(id or name)/attach`
 
 
@@ -1345,7 +1343,7 @@ The simplest way to implement the Attach protocol is the following:
     4.  Read the extracted size and output it on the correct output.
     4.  Read the extracted size and output it on the correct output.
     5.  Goto 1.
     5.  Goto 1.
 
 
-### Attach to a container (websocket)
+#### Attach to a container (websocket)
 
 
 `GET /containers/(id or name)/attach/ws`
 `GET /containers/(id or name)/attach/ws`
 
 
@@ -1385,7 +1383,7 @@ Implements websocket protocol handshake according to [RFC 6455](http://tools.iet
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Wait a container
+#### Wait a container
 
 
 `POST /containers/(id or name)/wait`
 `POST /containers/(id or name)/wait`
 
 
@@ -1408,7 +1406,7 @@ Block until container `id` stops, then returns the exit code
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove a container
+#### Remove a container
 
 
 `DELETE /containers/(id or name)`
 `DELETE /containers/(id or name)`
 
 
@@ -1437,14 +1435,14 @@ Remove the container `id` from the filesystem
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Retrieving information about files and folders in a container
+#### Retrieving information about files and folders in a container
 
 
 `HEAD /containers/(id or name)/archive`
 `HEAD /containers/(id or name)/archive`
 
 
 See the description of the `X-Docker-Container-Path-Stat` header in the
 See the description of the `X-Docker-Container-Path-Stat` header in the
 following section.
 following section.
 
 
-### Get an archive of a filesystem resource in a container
+#### Get an archive of a filesystem resource in a container
 
 
 `GET /containers/(id or name)/archive`
 `GET /containers/(id or name)/archive`
 
 
@@ -1509,7 +1507,7 @@ desired.
     - no such file or directory (**path** does not exist)
     - no such file or directory (**path** does not exist)
 - **500** - server error
 - **500** - server error
 
 
-### Extract an archive of files or folders to a directory in a container
+#### Extract an archive of files or folders to a directory in a container
 
 
 `PUT /containers/(id or name)/archive`
 `PUT /containers/(id or name)/archive`
 
 
@@ -1557,9 +1555,9 @@ Upload a tar archive to be extracted to a path in the filesystem of container
     - no such file or directory (**path** resource does not exist)
     - no such file or directory (**path** resource does not exist)
 - **500** – server error
 - **500** – server error
 
 
-## 3.2 Images
+### 3.2 Images
 
 
-### List Images
+#### List Images
 
 
 `GET /images/json`
 `GET /images/json`
 
 
@@ -1652,7 +1650,7 @@ references on the command line.
   -   `since`=(`<image-name>[:<tag>]`,  `<image id>` or `<image@digest>`)
   -   `since`=(`<image-name>[:<tag>]`,  `<image id>` or `<image@digest>`)
 -   **filter** - only return images with the specified name
 -   **filter** - only return images with the specified name
 
 
-### Build image from a Dockerfile
+#### Build image from a Dockerfile
 
 
 `POST /build`
 `POST /build`
 
 
@@ -1758,7 +1756,7 @@ or being killed.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Create an image
+#### Create an image
 
 
 `POST /images/create`
 `POST /images/create`
 
 
@@ -1824,7 +1822,7 @@ a base64-encoded AuthConfig object.
 
 
 
 
 
 
-### Inspect an image
+#### Inspect an image
 
 
 `GET /images/(name)/json`
 `GET /images/(name)/json`
 
 
@@ -1942,7 +1940,7 @@ Return low-level information on the image `name`
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Get the history of an image
+#### Get the history of an image
 
 
 `GET /images/(name)/history`
 `GET /images/(name)/history`
 
 
@@ -1996,7 +1994,7 @@ Return the history of the image `name`
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Push an image on the registry
+#### Push an image on the registry
 
 
 `POST /images/(name)/push`
 `POST /images/(name)/push`
 
 
@@ -2058,7 +2056,7 @@ The push is cancelled if the HTTP connection is closed.
 -   **404** – no such image
 -   **404** – no such image
 -   **500** – server error
 -   **500** – server error
 
 
-### Tag an image into a repository
+#### Tag an image into a repository
 
 
 `POST /images/(name)/tag`
 `POST /images/(name)/tag`
 
 
@@ -2085,7 +2083,7 @@ Tag the image `name` into a repository
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove an image
+#### Remove an image
 
 
 `DELETE /images/(name)`
 `DELETE /images/(name)`
 
 
@@ -2118,7 +2116,7 @@ Remove the image `name` from the filesystem
 -   **409** – conflict
 -   **409** – conflict
 -   **500** – server error
 -   **500** – server error
 
 
-### Search images
+#### Search images
 
 
 `GET /images/search`
 `GET /images/search`
 
 
@@ -2176,9 +2174,9 @@ Search for an image on [Docker Hub](https://hub.docker.com).
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-## 3.3 Misc
+### 3.3 Misc
 
 
-### Check auth configuration
+#### Check auth configuration
 
 
 `POST /auth`
 `POST /auth`
 
 
@@ -2211,7 +2209,7 @@ if available, for accessing the registry without password.
 -   **204** – no error
 -   **204** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Display system-wide information
+#### Display system-wide information
 
 
 `GET /info`
 `GET /info`
 
 
@@ -2304,7 +2302,7 @@ Display system-wide information
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Show the docker version information
+#### Show the docker version information
 
 
 `GET /version`
 `GET /version`
 
 
@@ -2336,7 +2334,7 @@ Show the docker version information
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Ping the docker server
+#### Ping the docker server
 
 
 `GET /_ping`
 `GET /_ping`
 
 
@@ -2358,7 +2356,7 @@ Ping the docker server
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Create a new image from a container's changes
+#### Create a new image from a container's changes
 
 
 `POST /commit`
 `POST /commit`
 
 
@@ -2430,7 +2428,7 @@ Create a new image from a container's changes
 -   **404** – no such container
 -   **404** – no such container
 -   **500** – server error
 -   **500** – server error
 
 
-### Monitor Docker's events
+#### Monitor Docker's events
 
 
 `GET /events`
 `GET /events`
 
 
@@ -2635,7 +2633,7 @@ Docker daemon report the following event:
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Get a tarball containing all images in a repository
+#### Get a tarball containing all images in a repository
 
 
 `GET /images/(name)/get`
 `GET /images/(name)/get`
 
 
@@ -2665,7 +2663,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Get a tarball containing all images
+#### Get a tarball containing all images
 
 
 `GET /images/get`
 `GET /images/get`
 
 
@@ -2694,7 +2692,7 @@ See the [image tarball format](#image-tarball-format) for more details.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Load a tarball with a set of images and tags into docker
+#### Load a tarball with a set of images and tags into docker
 
 
 `POST /images/load`
 `POST /images/load`
 
 
@@ -2743,7 +2741,7 @@ action completes.
 -   **200** – no error
 -   **200** – no error
 -   **500** – server error
 -   **500** – server error
 
 
-### Image tarball format
+#### Image tarball format
 
 
 An image tarball contains one directory per image layer (named using its long ID),
 An image tarball contains one directory per image layer (named using its long ID),
 each containing these files:
 each containing these files:
@@ -2764,7 +2762,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
 }
 }
 ```
 ```
 
 
-### Exec Create
+#### Exec Create
 
 
 `POST /containers/(id or name)/exec`
 `POST /containers/(id or name)/exec`
 
 
@@ -2818,7 +2816,7 @@ Sets up an exec instance in a running container `id`
 -   **409** - container is paused
 -   **409** - container is paused
 -   **500** - server error
 -   **500** - server error
 
 
-### Exec Start
+#### Exec Start
 
 
 `POST /exec/(id)/start`
 `POST /exec/(id)/start`
 
 
@@ -2860,7 +2858,7 @@ interactive session with the `exec` command.
 
 
 Similar to the stream behavior of `POST /containers/(id or name)/attach` API
 Similar to the stream behavior of `POST /containers/(id or name)/attach` API
 
 
-### Exec Resize
+#### Exec Resize
 
 
 `POST /exec/(id)/resize`
 `POST /exec/(id)/resize`
 
 
@@ -2887,7 +2885,7 @@ This API is valid only if `tty` was specified as part of creating and starting t
 -   **201** – no error
 -   **201** – no error
 -   **404** – no such exec instance
 -   **404** – no such exec instance
 
 
-### Exec Inspect
+#### Exec Inspect
 
 
 `GET /exec/(id)/json`
 `GET /exec/(id)/json`
 
 
@@ -2930,9 +2928,9 @@ Return low-level information about the `exec` command `id`.
 -   **404** – no such exec instance
 -   **404** – no such exec instance
 -   **500** - server error
 -   **500** - server error
 
 
-## 3.4 Volumes
+### 3.4 Volumes
 
 
-### List volumes
+#### List volumes
 
 
 `GET /volumes`
 `GET /volumes`
 
 
@@ -2970,7 +2968,7 @@ Return low-level information about the `exec` command `id`.
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Create a volume
+#### Create a volume
 
 
 `POST /volumes/create`
 `POST /volumes/create`
 
 
@@ -3027,7 +3025,7 @@ Create a volume
 Refer to the [inspect a volume](#inspect-a-volume) section or details about the
 Refer to the [inspect a volume](#inspect-a-volume) section or details about the
 JSON fields returned in the response.
 JSON fields returned in the response.
 
 
-### Inspect a volume
+#### Inspect a volume
 
 
 `GET /volumes/(name)`
 `GET /volumes/(name)`
 
 
@@ -3079,7 +3077,7 @@ response.
 - **Scope** - Scope describes the level at which the volume exists, can be one of
 - **Scope** - Scope describes the level at which the volume exists, can be one of
     `global` for cluster-wide or `local` for machine level. The default is `local`.
     `global` for cluster-wide or `local` for machine level. The default is `local`.
 
 
-### Remove a volume
+#### Remove a volume
 
 
 `DELETE /volumes/(name)`
 `DELETE /volumes/(name)`
 
 
@@ -3100,9 +3098,9 @@ Instruct the driver to remove the volume (`name`).
 -   **409** - volume is in use and cannot be removed
 -   **409** - volume is in use and cannot be removed
 -   **500** - server error
 -   **500** - server error
 
 
-## 3.5 Networks
+### 3.5 Networks
 
 
-### List networks
+#### List networks
 
 
 `GET /networks`
 `GET /networks`
 
 
@@ -3194,7 +3192,7 @@ Content-Type: application/json
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Inspect network
+#### Inspect network
 
 
 `GET /networks/<network-id>`
 `GET /networks/<network-id>`
 
 
@@ -3256,7 +3254,7 @@ Content-Type: application/json
 -   **200** - no error
 -   **200** - no error
 -   **404** - network not found
 -   **404** - network not found
 
 
-### Create a network
+#### Create a network
 
 
 `POST /networks/create`
 `POST /networks/create`
 
 
@@ -3339,7 +3337,7 @@ Content-Type: application/json
 - **Options** - Network specific options to be used by the drivers
 - **Options** - Network specific options to be used by the drivers
 - **Labels** - Labels to set on the network, specified as a map: `{"key":"value" [,"key2":"value2"]}`
 - **Labels** - Labels to set on the network, specified as a map: `{"key":"value" [,"key2":"value2"]}`
 
 
-### Connect a container to a network
+#### Connect a container to a network
 
 
 `POST /networks/(id)/connect`
 `POST /networks/(id)/connect`
 
 
@@ -3377,7 +3375,7 @@ Content-Type: application/json
 
 
 - **container** - container-id/name to be connected to the network
 - **container** - container-id/name to be connected to the network
 
 
-### Disconnect a container from a network
+#### Disconnect a container from a network
 
 
 `POST /networks/(id)/disconnect`
 `POST /networks/(id)/disconnect`
 
 
@@ -3411,7 +3409,7 @@ Content-Type: application/json
 - **Container** - container-id/name to be disconnected from a network
 - **Container** - container-id/name to be disconnected from a network
 - **Force** - Force the container to disconnect from a network
 - **Force** - Force the container to disconnect from a network
 
 
-### Remove a network
+#### Remove a network
 
 
 `DELETE /networks/(id)`
 `DELETE /networks/(id)`
 
 
@@ -3431,9 +3429,9 @@ Instruct the driver to remove the network (`id`).
 -   **404** - no such network
 -   **404** - no such network
 -   **500** - server error
 -   **500** - server error
 
 
-## 3.6 Plugins (experimental)
+### 3.6 Plugins (experimental)
 
 
-### List plugins
+#### List plugins
 
 
 `GET /plugins`
 `GET /plugins`
 
 
@@ -3563,7 +3561,7 @@ Content-Type: application/json
 -   **200** - no error
 -   **200** - no error
 -   **500** - server error
 -   **500** - server error
 
 
-### Install a plugin
+#### Install a plugin
 
 
 `POST /plugins/pull?name=<plugin name>`
 `POST /plugins/pull?name=<plugin name>`
 
 
@@ -3625,7 +3623,7 @@ Content-Length: 175
       name must have at least one component
       name must have at least one component
 -   **500** - plugin already exists
 -   **500** - plugin already exists
 
 
-### Inspect a plugin
+#### Inspect a plugin
 
 
 `GET /plugins/(plugin name)`
 `GET /plugins/(plugin name)`
 
 
@@ -3758,7 +3756,7 @@ Content-Type: application/json
 -   **200** - no error
 -   **200** - no error
 -   **404** - plugin not installed
 -   **404** - plugin not installed
 
 
-### Enable a plugin
+#### Enable a plugin
 
 
 `POST /plugins/(plugin name)/enable`
 `POST /plugins/(plugin name)/enable`
 
 
@@ -3786,7 +3784,7 @@ Content-Type: text/plain; charset=utf-8
 -   **200** - no error
 -   **200** - no error
 -   **500** - plugin is already enabled
 -   **500** - plugin is already enabled
 
 
-### Disable a plugin
+#### Disable a plugin
 
 
 `POST /plugins/(plugin name)/disable`
 `POST /plugins/(plugin name)/disable`
 
 
@@ -3814,7 +3812,7 @@ Content-Type: text/plain; charset=utf-8
 -   **200** - no error
 -   **200** - no error
 -   **500** - plugin is already disabled
 -   **500** - plugin is already disabled
 
 
-### Remove a plugin
+#### Remove a plugin
 
 
 `DELETE /plugins/(plugin name)`
 `DELETE /plugins/(plugin name)`
 
 
@@ -3844,7 +3842,7 @@ Content-Type: text/plain; charset=utf-8
 
 
 <!-- TODO Document "docker plugin push" endpoint once we have "plugin build"
 <!-- TODO Document "docker plugin push" endpoint once we have "plugin build"
 
 
-### Push a plugin
+#### Push a plugin
 
 
 `POST /v1.24/plugins/tiborvass/(plugin name)/push HTTP/1.1`
 `POST /v1.24/plugins/tiborvass/(plugin name)/push HTTP/1.1`
 
 
@@ -3870,11 +3868,11 @@ an image](#create-an-image) section for more details.
 
 
 -->
 -->
 
 
-## 3.7 Nodes
+### 3.7 Nodes
 
 
 **Note**: Node operations require the engine to be part of a swarm.
 **Note**: Node operations require the engine to be part of a swarm.
 
 
-### List nodes
+#### List nodes
 
 
 
 
 `GET /nodes`
 `GET /nodes`
@@ -3967,7 +3965,7 @@ List nodes
 - **200** – no error
 - **200** – no error
 - **500** – server error
 - **500** – server error
 
 
-### Inspect a node
+#### Inspect a node
 
 
 
 
 `GET /nodes/(id or name)`
 `GET /nodes/(id or name)`
@@ -4049,7 +4047,7 @@ Return low-level information on the node `id`
 -   **404** – no such node
 -   **404** – no such node
 -   **500** – server error
 -   **500** – server error
 
 
-### Remove a node
+#### Remove a node
 
 
 
 
 `DELETE /nodes/(id or name)`
 `DELETE /nodes/(id or name)`
@@ -4077,7 +4075,7 @@ Remove a node from the swarm.
 -   **404** – no such node
 -   **404** – no such node
 -   **500** – server error
 -   **500** – server error
 
 
-### Update a node
+#### Update a node
 
 
 
 
 `POST /nodes/(id)/update`
 `POST /nodes/(id)/update`
@@ -4132,9 +4130,9 @@ JSON Parameters:
 -   **404** – no such node
 -   **404** – no such node
 -   **500** – server error
 -   **500** – server error
 
 
-## 3.8 Swarm
+### 3.8 Swarm
 
 
-### Inspect swarm
+#### Inspect swarm
 
 
 
 
 `GET /swarm`
 `GET /swarm`
@@ -4182,7 +4180,7 @@ Inspect swarm
 
 
 - **200** - no error
 - **200** - no error
 
 
-### Initialize a new swarm
+#### Initialize a new swarm
 
 
 
 
 `POST /swarm/init`
 `POST /swarm/init`
@@ -4258,7 +4256,7 @@ JSON Parameters:
             - **Options** - An object with key/value pairs that are interpreted
             - **Options** - An object with key/value pairs that are interpreted
               as protocol-specific options for the external CA driver.
               as protocol-specific options for the external CA driver.
 
 
-### Join an existing swarm
+#### Join an existing swarm
 
 
 `POST /swarm/join`
 `POST /swarm/join`
 
 
@@ -4300,7 +4298,7 @@ JSON Parameters:
 - **RemoteAddr** – Address of any manager node already participating in the swarm.
 - **RemoteAddr** – Address of any manager node already participating in the swarm.
 - **JoinToken** – Secret token for joining this swarm.
 - **JoinToken** – Secret token for joining this swarm.
 
 
-### Leave a swarm
+#### Leave a swarm
 
 
 
 
 `POST /swarm/leave`
 `POST /swarm/leave`
@@ -4326,7 +4324,7 @@ Leave a swarm
 - **200** – no error
 - **200** – no error
 - **406** – node is not part of a swarm
 - **406** – node is not part of a swarm
 
 
-### Update a swarm
+#### Update a swarm
 
 
 
 
 `POST /swarm/update`
 `POST /swarm/update`
@@ -4407,11 +4405,11 @@ JSON Parameters:
     - **Worker** - Token to use for joining as a worker.
     - **Worker** - Token to use for joining as a worker.
     - **Manager** - Token to use for joining as a manager.
     - **Manager** - Token to use for joining as a manager.
 
 
-## 3.9 Services
+### 3.9 Services
 
 
 **Note**: Service operations require to first be part of a swarm.
 **Note**: Service operations require to first be part of a swarm.
 
 
-### List services
+#### List services
 
 
 
 
 `GET /services`
 `GET /services`
@@ -4516,7 +4514,7 @@ List services
 - **200** – no error
 - **200** – no error
 - **500** – server error
 - **500** – server error
 
 
-### Create a service
+#### Create a service
 
 
 `POST /services/create`
 `POST /services/create`
 
 
@@ -4689,7 +4687,7 @@ image](#create-an-image) section for more details.
   section for more details.
   section for more details.
 
 
 
 
-### Remove a service
+#### Remove a service
 
 
 
 
 `DELETE /services/(id or name)`
 `DELETE /services/(id or name)`
@@ -4712,7 +4710,7 @@ Stop and remove the service `id`
 -   **404** – no such service
 -   **404** – no such service
 -   **500** – server error
 -   **500** – server error
 
 
-### Inspect one or more services
+#### Inspect one or more services
 
 
 
 
 `GET /services/(id or name)`
 `GET /services/(id or name)`
@@ -4801,7 +4799,7 @@ Return information on the service `id`.
 -   **404** – no such service
 -   **404** – no such service
 -   **500** – server error
 -   **500** – server error
 
 
-### Update a service
+#### Update a service
 
 
 `POST /services/(id or name)/update`
 `POST /services/(id or name)/update`
 
 
@@ -4934,11 +4932,11 @@ image](#create-an-image) section for more details.
 -   **404** – no such service
 -   **404** – no such service
 -   **500** – server error
 -   **500** – server error
 
 
-## 3.10 Tasks
+### 3.10 Tasks
 
 
 **Note**: Task operations require the engine to be part of a swarm.
 **Note**: Task operations require the engine to be part of a swarm.
 
 
-### List tasks
+#### List tasks
 
 
 
 
 `GET /tasks`
 `GET /tasks`
@@ -5136,7 +5134,7 @@ List tasks
 - **200** – no error
 - **200** – no error
 - **500** – server error
 - **500** – server error
 
 
-### Inspect a task
+#### Inspect a task
 
 
 
 
 `GET /tasks/(task id)`
 `GET /tasks/(task id)`
@@ -5239,9 +5237,9 @@ Get details on a task
 - **404** – unknown task
 - **404** – unknown task
 - **500** – server error
 - **500** – server error
 
 
-# 4. Going further
+## 4. Going further
 
 
-## 4.1 Inside `docker run`
+### 4.1 Inside `docker run`
 
 
 As an example, the `docker run` command line makes the following API calls:
 As an example, the `docker run` command line makes the following API calls:
 
 
@@ -5259,7 +5257,7 @@ As an example, the `docker run` command line makes the following API calls:
 
 
 - If in detached mode or only `stdin` is attached, display the container's id.
 - If in detached mode or only `stdin` is attached, display the container's id.
 
 
-## 4.2 Hijacking
+### 4.2 Hijacking
 
 
 In this version of the API, `/attach`, uses hijacking to transport `stdin`,
 In this version of the API, `/attach`, uses hijacking to transport `stdin`,
 `stdout`, and `stderr` on the same socket.
 `stdout`, and `stderr` on the same socket.
@@ -5274,7 +5272,7 @@ When Docker daemon detects the `Upgrade` header, it switches its status code
 from **200 OK** to **101 UPGRADED** and resends the same headers.
 from **200 OK** to **101 UPGRADED** and resends the same headers.
 
 
 
 
-## 4.3 CORS Requests
+### 4.3 CORS Requests
 
 
 To set cross origin requests to the Engine API please give values to
 To set cross origin requests to the Engine API please give values to
 `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
 `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,

+ 5 - 1
docs/api/version-history.md

@@ -72,7 +72,11 @@ keywords: "API, Docker, rcli, REST, documentation"
 * `DELETE /plugins/(plugin name)` delete a plugin.
 * `DELETE /plugins/(plugin name)` delete a plugin.
 * `POST /node/(id or name)/update` now accepts both `id` or `name` to identify the node to update.
 * `POST /node/(id or name)/update` now accepts both `id` or `name` to identify the node to update.
 * `GET /images/json` now support a `reference` filter.
 * `GET /images/json` now support a `reference` filter.
-
+* `GET /secrets` returns information on the secrets.
+* `POST /secrets/create` creates a secret.
+* `DELETE /secrets/{id}` removes the secret `id`.
+* `GET /secrets/{id}` returns information on the secret `id`.
+* `POST /secrets/{id}/update` updates the secret `id`.
 
 
 ## v1.24 API changes
 ## v1.24 API changes
 
 

+ 1 - 1
docs/deprecated.md

@@ -32,7 +32,7 @@ The `filter` param to filter the list of image by reference (name or name:tag) i
 
 
 **Target For Removal In Release: v1.16**
 **Target For Removal In Release: v1.16**
 
 
-`repository:shortid` syntax for referencing images is very little used, collides with with tag references can be confused with digest references.
+`repository:shortid` syntax for referencing images is very little used, collides with tag references can be confused with digest references.
 
 
 ### `docker daemon` subcommand
 ### `docker daemon` subcommand
 **Deprecated In Release: [v1.13](https://github.com/docker/docker/releases/tag/v1.13.0)**
 **Deprecated In Release: [v1.13](https://github.com/docker/docker/releases/tag/v1.13.0)**

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

@@ -82,7 +82,6 @@ Options:
       --memory-reservation string   Memory soft limit
       --memory-reservation string   Memory soft limit
       --memory-swap string          Swap limit equal to memory plus swap: '-1' to enable unlimited swap
       --memory-swap string          Swap limit equal to memory plus swap: '-1' to enable unlimited swap
       --memory-swappiness int       Tune container memory swappiness (0 to 100) (default -1)
       --memory-swappiness int       Tune container memory swappiness (0 to 100) (default -1)
-      --mount value                 Attach a filesytem mount to the container (default [])
       --name string                 Assign a name to the container
       --name string                 Assign a name to the container
       --network-alias value         Add network-scoped alias for the container (default [])
       --network-alias value         Add network-scoped alias for the container (default [])
       --network string              Connect a container to a network (default "default")
       --network string              Connect a container to a network (default "default")

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

@@ -22,7 +22,7 @@ Usage:  docker node ps [OPTIONS] [NODE...]
 List tasks running on one or more nodes, defaults to current node.
 List tasks running on one or more nodes, defaults to current node.
 
 
 Options:
 Options:
-  -a, --all            Show all tasks (default shows tasks that are or will be running)
+  -a, --all            Display all instances
   -f, --filter value   Filter output based on conditions provided
   -f, --filter value   Filter output based on conditions provided
       --help           Print usage
       --help           Print usage
       --no-resolve     Do not map IDs to Names
       --no-resolve     Do not map IDs to Names

+ 3 - 3
docs/reference/commandline/plugin_inspect.md

@@ -16,13 +16,13 @@ keywords: "plugin, inspect"
 # plugin inspect
 # plugin inspect
 
 
 ```markdown
 ```markdown
-Usage:  docker plugin inspect [OPTIONS] PLUGIN [PLUGIN...]
+Usage:	docker plugin inspect [OPTIONS] PLUGIN|ID [PLUGIN|ID...]
 
 
 Display detailed information on one or more plugins
 Display detailed information on one or more plugins
 
 
 Options:
 Options:
-      -f, --format string   Format the output using the given Go template
-          --help            Print usage
+  -f, --format string   Format the output using the given Go template
+      --help            Print usage
 ```
 ```
 
 
 Returns information about a plugin. By default, this command renders all results
 Returns information about a plugin. By default, this command renders all results

+ 1 - 17
docs/reference/commandline/run.md

@@ -92,7 +92,6 @@ Options:
       --memory-reservation string   Memory soft limit
       --memory-reservation string   Memory soft limit
       --memory-swap string          Swap limit equal to memory plus swap: '-1' to enable unlimited swap
       --memory-swap string          Swap limit equal to memory plus swap: '-1' to enable unlimited swap
       --memory-swappiness int       Tune container memory swappiness (0 to 100) (default -1)
       --memory-swappiness int       Tune container memory swappiness (0 to 100) (default -1)
-      --mount value                 Attach a filesystem mount to the container (default [])
       --name string                 Assign a name to the container
       --name string                 Assign a name to the container
       --network-alias value         Add network-scoped alias for the container (default [])
       --network-alias value         Add network-scoped alias for the container (default [])
       --network string              Connect a container to a network
       --network string              Connect a container to a network
@@ -284,21 +283,6 @@ of a bind mount must be a local directory, not a file.
 
 
 For in-depth information about volumes, refer to [manage data in containers](https://docs.docker.com/engine/tutorials/dockervolumes/)
 For in-depth information about volumes, refer to [manage data in containers](https://docs.docker.com/engine/tutorials/dockervolumes/)
 
 
-### Add bin-mounts or volumes using the --mount flag
-
-The `--mount` flag allows you to mount volumes, host-directories and `tmpfs`
-mounts in a container.
-
-The `--mount` flag supports most options that are supported by the `-v` or the
-`--volume` flag, but uses a different syntax. For in-depth information on the
-`--mount` flag, and a comparison between `--volume` and `--mount`, refer to
-the [service create command reference](service_create.md#add-bind-mounts-or-volumes).
-
-Examples:
-
-    $ docker run --read-only --mount type=volume,target=/icanwrite busybox touch /icanwrite/here
-    $ docker run -t -i --mount type=bind,src=/data,dst=/data busybox sh
-
 ### Publish or expose port (-p, --expose)
 ### Publish or expose port (-p, --expose)
 
 
     $ docker run -p 127.0.0.1:80:8080 ubuntu bash
     $ docker run -p 127.0.0.1:80:8080 ubuntu bash
@@ -678,7 +662,7 @@ The `credentialspec` must be in the format `file://spec.txt` or `registry://keyn
 
 
 ### Stop container with timeout (--stop-timeout)
 ### Stop container with timeout (--stop-timeout)
 
 
-The `--stop-timeout` flag sets the the timeout (in seconds) that a pre-defined (see `--stop-signal`) system call
+The `--stop-timeout` flag sets the timeout (in seconds) that a pre-defined (see `--stop-signal`) system call
 signal that will be sent to the container to exit. After timeout elapses the container will be killed with SIGKILL.
 signal that will be sent to the container to exit. After timeout elapses the container will be killed with SIGKILL.
 
 
 ### Specify isolation technology for container (--isolation)
 ### Specify isolation technology for container (--isolation)

+ 2 - 2
docs/reference/commandline/secret_ls.md

@@ -27,9 +27,9 @@ Options:
   -q, --quiet          Only display IDs
   -q, --quiet          Only display IDs
 ```
 ```
 
 
-Run this command from a manager to list the secrets in the Swarm.
+Run this command on a manager node to list the secrets in the Swarm.
 
 
-On a manager node:
+## Examples
 
 
 ```bash
 ```bash
 $ docker secret ls
 $ docker secret ls

+ 0 - 1
docs/reference/commandline/service_ps.md

@@ -22,7 +22,6 @@ Usage:  docker service ps [OPTIONS] SERVICE
 List the tasks of a service
 List the tasks of a service
 
 
 Options:
 Options:
-  -a, --all             Show all tasks (default shows tasks that are or will be running)
   -f, --filter filter   Filter output based on conditions provided
   -f, --filter filter   Filter output based on conditions provided
       --help            Print usage
       --help            Print usage
       --no-resolve      Do not map IDs to Names
       --no-resolve      Do not map IDs to Names

+ 1 - 1
docs/reference/glossary.md

@@ -280,7 +280,7 @@ A virtual machine is a program that emulates a complete computer and imitates de
 It shares physical hardware resources with other users but isolates the operating system. The
 It shares physical hardware resources with other users but isolates the operating system. The
 end user has the same experience on a Virtual Machine as they would have on dedicated hardware.
 end user has the same experience on a Virtual Machine as they would have on dedicated hardware.
 
 
-Compared to to containers, a virtual machine is heavier to run, provides more isolation,
+Compared to containers, a virtual machine is heavier to run, provides more isolation,
 gets its own set of resources and does minimal sharing.
 gets its own set of resources and does minimal sharing.
 
 
 *Also known as : VM*
 *Also known as : VM*

+ 2 - 2
hack/validate/swagger-gen

@@ -4,7 +4,7 @@ export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 source "${SCRIPTDIR}/.validate"
 source "${SCRIPTDIR}/.validate"
 
 
 IFS=$'\n'
 IFS=$'\n'
-files=( $(validate_diff --diff-filter=ACMR --name-only -- 'api/types/' || true) )
+files=( $(validate_diff --diff-filter=ACMR --name-only -- 'api/types/' 'api/swagger.yaml' || true) )
 unset IFS
 unset IFS
 
 
 if [ ${#files[@]} -gt 0 ]; then
 if [ ${#files[@]} -gt 0 ]; then
@@ -26,5 +26,5 @@ if [ ${#files[@]} -gt 0 ]; then
 		echo 'Congratulations! All api changes are done the right way.'
 		echo 'Congratulations! All api changes are done the right way.'
 	fi
 	fi
 else
 else
-    echo 'No api/types/ changes in diff.'
+    echo 'No api/types/ or api/swagger.yaml changes in diff.'
 fi
 fi

+ 3 - 1
image/tarexport/save.go

@@ -234,7 +234,9 @@ func (s *saveSession) saveImage(id image.ID) (map[layer.DiffID]distribution.Desc
 	var layers []string
 	var layers []string
 	var foreignSrcs map[layer.DiffID]distribution.Descriptor
 	var foreignSrcs map[layer.DiffID]distribution.Descriptor
 	for i := range img.RootFS.DiffIDs {
 	for i := range img.RootFS.DiffIDs {
-		v1Img := image.V1Image{}
+		v1Img := image.V1Image{
+			Created: img.Created,
+		}
 		if i == len(img.RootFS.DiffIDs)-1 {
 		if i == len(img.RootFS.DiffIDs)-1 {
 			v1Img = img.V1Image
 			v1Img = img.V1Image
 		}
 		}

+ 1 - 1
integration-cli/daemon_swarm.go

@@ -317,7 +317,7 @@ func (d *SwarmDaemon) getSecret(c *check.C, id string) *swarm.Secret {
 func (d *SwarmDaemon) deleteSecret(c *check.C, id string) {
 func (d *SwarmDaemon) deleteSecret(c *check.C, id string) {
 	status, out, err := d.SockRequest("DELETE", "/secrets/"+id, nil)
 	status, out, err := d.SockRequest("DELETE", "/secrets/"+id, nil)
 	c.Assert(err, checker.IsNil, check.Commentf(string(out)))
 	c.Assert(err, checker.IsNil, check.Commentf(string(out)))
-	c.Assert(status, checker.Equals, http.StatusOK, check.Commentf("output: %q", string(out)))
+	c.Assert(status, checker.Equals, http.StatusNoContent, check.Commentf("output: %q", string(out)))
 }
 }
 
 
 func (d *SwarmDaemon) getSwarm(c *check.C) swarm.Swarm {
 func (d *SwarmDaemon) getSwarm(c *check.C) swarm.Swarm {

+ 21 - 5
integration-cli/docker_api_containers_test.go

@@ -728,7 +728,7 @@ func (s *DockerSuite) TestContainerAPIInvalidPortSyntax(c *check.C) {
 	c.Assert(string(b[:]), checker.Contains, "invalid port")
 	c.Assert(string(b[:]), checker.Contains, "invalid port")
 }
 }
 
 
-func (s *DockerSuite) TestContainerAPIInvalidRestartPolicyName(c *check.C) {
+func (s *DockerSuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *check.C) {
 	config := `{
 	config := `{
 		"Image": "busybox",
 		"Image": "busybox",
 		"HostConfig": {
 		"HostConfig": {
@@ -748,7 +748,7 @@ func (s *DockerSuite) TestContainerAPIInvalidRestartPolicyName(c *check.C) {
 	c.Assert(string(b[:]), checker.Contains, "invalid restart policy")
 	c.Assert(string(b[:]), checker.Contains, "invalid restart policy")
 }
 }
 
 
-func (s *DockerSuite) TestContainerAPIInvalidRestartPolicyRetryMismatch(c *check.C) {
+func (s *DockerSuite) TestContainerAPIRestartPolicyRetryMismatch(c *check.C) {
 	config := `{
 	config := `{
 		"Image": "busybox",
 		"Image": "busybox",
 		"HostConfig": {
 		"HostConfig": {
@@ -765,10 +765,10 @@ func (s *DockerSuite) TestContainerAPIInvalidRestartPolicyRetryMismatch(c *check
 
 
 	b, err := readBody(body)
 	b, err := readBody(body)
 	c.Assert(err, checker.IsNil)
 	c.Assert(err, checker.IsNil)
-	c.Assert(string(b[:]), checker.Contains, "maximum restart count not valid with restart policy")
+	c.Assert(string(b[:]), checker.Contains, "maximum retry count cannot be used with restart policy")
 }
 }
 
 
-func (s *DockerSuite) TestContainerAPIInvalidRestartPolicyPositiveRetryCount(c *check.C) {
+func (s *DockerSuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *check.C) {
 	config := `{
 	config := `{
 		"Image": "busybox",
 		"Image": "busybox",
 		"HostConfig": {
 		"HostConfig": {
@@ -785,7 +785,23 @@ func (s *DockerSuite) TestContainerAPIInvalidRestartPolicyPositiveRetryCount(c *
 
 
 	b, err := readBody(body)
 	b, err := readBody(body)
 	c.Assert(err, checker.IsNil)
 	c.Assert(err, checker.IsNil)
-	c.Assert(string(b[:]), checker.Contains, "maximum restart count must be a positive integer")
+	c.Assert(string(b[:]), checker.Contains, "maximum retry count cannot be negative")
+}
+
+func (s *DockerSuite) TestContainerAPIRestartPolicyDefaultRetryCount(c *check.C) {
+	config := `{
+		"Image": "busybox",
+		"HostConfig": {
+			"RestartPolicy": {
+				"Name": "on-failure",
+				"MaximumRetryCount": 0
+			}
+		}
+	}`
+
+	res, _, err := sockRequestRaw("POST", "/containers/create", strings.NewReader(config), "application/json")
+	c.Assert(err, checker.IsNil)
+	c.Assert(res.StatusCode, checker.Equals, http.StatusCreated)
 }
 }
 
 
 // Issue 7941 - test to make sure a "null" in JSON is just ignored.
 // Issue 7941 - test to make sure a "null" in JSON is just ignored.

+ 16 - 0
integration-cli/docker_cli_build_test.go

@@ -7311,3 +7311,19 @@ RUN ["cat", "/foo/file"]
 		c.Fatal(err)
 		c.Fatal(err)
 	}
 	}
 }
 }
+
+// Case-insensitive environment variables on Windows
+func (s *DockerSuite) TestBuildWindowsEnvCaseInsensitive(c *check.C) {
+	testRequires(c, DaemonIsWindows)
+	name := "testbuildwindowsenvcaseinsensitive"
+	if _, err := buildImage(name, `
+		FROM `+WindowsBaseImage+`
+		ENV FOO=bar foo=bar
+  `, true); err != nil {
+		c.Fatal(err)
+	}
+	res := inspectFieldJSON(c, name, "Config.Env")
+	if res != `["foo=bar"]` { // Should not have FOO=bar in it - takes the last one processed. And only one entry as deduped.
+		c.Fatalf("Case insensitive environment variables on Windows failed. Got %s", res)
+	}
+}

+ 49 - 0
integration-cli/docker_cli_plugins_test.go

@@ -201,3 +201,52 @@ func (s *DockerSuite) TestPluginCreate(c *check.C) {
 	// The output will consists of one HEADER line and one line of foo/bar-driver
 	// The output will consists of one HEADER line and one line of foo/bar-driver
 	c.Assert(len(strings.Split(strings.TrimSpace(out), "\n")), checker.Equals, 2)
 	c.Assert(len(strings.Split(strings.TrimSpace(out), "\n")), checker.Equals, 2)
 }
 }
+
+func (s *DockerSuite) TestPluginInspect(c *check.C) {
+	testRequires(c, DaemonIsLinux, Network)
+	_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag)
+	c.Assert(err, checker.IsNil)
+
+	out, _, err := dockerCmdWithError("plugin", "ls")
+	c.Assert(err, checker.IsNil)
+	c.Assert(out, checker.Contains, pName)
+	c.Assert(out, checker.Contains, pTag)
+	c.Assert(out, checker.Contains, "true")
+
+	// Find the ID first
+	out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", pNameWithTag)
+	c.Assert(err, checker.IsNil)
+	id := strings.TrimSpace(out)
+	c.Assert(id, checker.Not(checker.Equals), "")
+
+	// Long form
+	out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", id)
+	c.Assert(err, checker.IsNil)
+	c.Assert(strings.TrimSpace(out), checker.Equals, id)
+
+	// Short form
+	out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", id[:5])
+	c.Assert(err, checker.IsNil)
+	c.Assert(strings.TrimSpace(out), checker.Equals, id)
+
+	// Name with tag form
+	out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", pNameWithTag)
+	c.Assert(err, checker.IsNil)
+	c.Assert(strings.TrimSpace(out), checker.Equals, id)
+
+	// Name without tag form
+	out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", pName)
+	c.Assert(err, checker.IsNil)
+	c.Assert(strings.TrimSpace(out), checker.Equals, id)
+
+	_, _, err = dockerCmdWithError("plugin", "disable", pNameWithTag)
+	c.Assert(err, checker.IsNil)
+
+	out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
+	c.Assert(err, checker.IsNil)
+	c.Assert(out, checker.Contains, pNameWithTag)
+
+	// After remove nothing should be found
+	_, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", id[:5])
+	c.Assert(err, checker.NotNil)
+}

+ 27 - 3
integration-cli/docker_cli_restart_test.go

@@ -74,7 +74,7 @@ func (s *DockerSuite) TestRestartWithVolumes(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestRestartPolicyNO(c *check.C) {
 func (s *DockerSuite) TestRestartPolicyNO(c *check.C) {
-	out, _ := dockerCmd(c, "run", "-d", "--restart=no", "busybox", "false")
+	out, _ := dockerCmd(c, "create", "--restart=no", "busybox")
 
 
 	id := strings.TrimSpace(string(out))
 	id := strings.TrimSpace(string(out))
 	name := inspectField(c, id, "HostConfig.RestartPolicy.Name")
 	name := inspectField(c, id, "HostConfig.RestartPolicy.Name")
@@ -82,7 +82,7 @@ func (s *DockerSuite) TestRestartPolicyNO(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestRestartPolicyAlways(c *check.C) {
 func (s *DockerSuite) TestRestartPolicyAlways(c *check.C) {
-	out, _ := dockerCmd(c, "run", "-d", "--restart=always", "busybox", "false")
+	out, _ := dockerCmd(c, "create", "--restart=always", "busybox")
 
 
 	id := strings.TrimSpace(string(out))
 	id := strings.TrimSpace(string(out))
 	name := inspectField(c, id, "HostConfig.RestartPolicy.Name")
 	name := inspectField(c, id, "HostConfig.RestartPolicy.Name")
@@ -95,12 +95,36 @@ func (s *DockerSuite) TestRestartPolicyAlways(c *check.C) {
 }
 }
 
 
 func (s *DockerSuite) TestRestartPolicyOnFailure(c *check.C) {
 func (s *DockerSuite) TestRestartPolicyOnFailure(c *check.C) {
-	out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:1", "busybox", "false")
+	out, _, err := dockerCmdWithError("create", "--restart=on-failure:-1", "busybox")
+	c.Assert(err, check.NotNil, check.Commentf(out))
+	c.Assert(out, checker.Contains, "maximum retry count cannot be negative")
+
+	out, _ = dockerCmd(c, "create", "--restart=on-failure:1", "busybox")
 
 
 	id := strings.TrimSpace(string(out))
 	id := strings.TrimSpace(string(out))
 	name := inspectField(c, id, "HostConfig.RestartPolicy.Name")
 	name := inspectField(c, id, "HostConfig.RestartPolicy.Name")
+	maxRetry := inspectField(c, id, "HostConfig.RestartPolicy.MaximumRetryCount")
+
 	c.Assert(name, checker.Equals, "on-failure")
 	c.Assert(name, checker.Equals, "on-failure")
+	c.Assert(maxRetry, checker.Equals, "1")
+
+	out, _ = dockerCmd(c, "create", "--restart=on-failure:0", "busybox")
 
 
+	id = strings.TrimSpace(string(out))
+	name = inspectField(c, id, "HostConfig.RestartPolicy.Name")
+	maxRetry = inspectField(c, id, "HostConfig.RestartPolicy.MaximumRetryCount")
+
+	c.Assert(name, checker.Equals, "on-failure")
+	c.Assert(maxRetry, checker.Equals, "0")
+
+	out, _ = dockerCmd(c, "create", "--restart=on-failure", "busybox")
+
+	id = strings.TrimSpace(string(out))
+	name = inspectField(c, id, "HostConfig.RestartPolicy.Name")
+	maxRetry = inspectField(c, id, "HostConfig.RestartPolicy.MaximumRetryCount")
+
+	c.Assert(name, checker.Equals, "on-failure")
+	c.Assert(maxRetry, checker.Equals, "0")
 }
 }
 
 
 // a good container with --restart=on-failure:3
 // a good container with --restart=on-failure:3

+ 0 - 178
integration-cli/docker_cli_run_test.go

@@ -4590,184 +4590,6 @@ func (s *DockerSuite) TestRunDuplicateMount(c *check.C) {
 	c.Assert(out, checker.Contains, "null")
 	c.Assert(out, checker.Contains, "null")
 }
 }
 
 
-func (s *DockerSuite) TestRunMount(c *check.C) {
-	testRequires(c, DaemonIsLinux, SameHostDaemon, NotUserNamespace)
-
-	// mnt1, mnt2, and testCatFooBar are commonly used in multiple test cases
-	tmpDir, err := ioutil.TempDir("", "mount")
-	if err != nil {
-		c.Fatal(err)
-	}
-	defer os.RemoveAll(tmpDir)
-	mnt1, mnt2 := path.Join(tmpDir, "mnt1"), path.Join(tmpDir, "mnt2")
-	if err := os.Mkdir(mnt1, 0755); err != nil {
-		c.Fatal(err)
-	}
-	if err := os.Mkdir(mnt2, 0755); err != nil {
-		c.Fatal(err)
-	}
-	if err := ioutil.WriteFile(path.Join(mnt1, "test1"), []byte("test1"), 0644); err != nil {
-		c.Fatal(err)
-	}
-	if err := ioutil.WriteFile(path.Join(mnt2, "test2"), []byte("test2"), 0644); err != nil {
-		c.Fatal(err)
-	}
-	testCatFooBar := func(cName string) error {
-		out, _ := dockerCmd(c, "exec", cName, "cat", "/foo/test1")
-		if out != "test1" {
-			return fmt.Errorf("%s not mounted on /foo", mnt1)
-		}
-		out, _ = dockerCmd(c, "exec", cName, "cat", "/bar/test2")
-		if out != "test2" {
-			return fmt.Errorf("%s not mounted on /bar", mnt2)
-		}
-		return nil
-	}
-
-	type testCase struct {
-		equivalents [][]string
-		valid       bool
-		// fn should be nil if valid==false
-		fn func(cName string) error
-	}
-	cases := []testCase{
-		{
-			equivalents: [][]string{
-				{
-					"--mount", fmt.Sprintf("type=bind,src=%s,dst=/foo", mnt1),
-					"--mount", fmt.Sprintf("type=bind,src=%s,dst=/bar", mnt2),
-				},
-				{
-					"--mount", fmt.Sprintf("type=bind,src=%s,dst=/foo", mnt1),
-					"--mount", fmt.Sprintf("type=bind,src=%s,target=/bar", mnt2),
-				},
-				{
-					"--volume", fmt.Sprintf("%s:/foo", mnt1),
-					"--mount", fmt.Sprintf("type=bind,src=%s,target=/bar", mnt2),
-				},
-			},
-			valid: true,
-			fn:    testCatFooBar,
-		},
-		{
-			equivalents: [][]string{
-				{
-					"--mount", fmt.Sprintf("type=volume,src=%s,dst=/foo", mnt1),
-					"--mount", fmt.Sprintf("type=volume,src=%s,dst=/bar", mnt2),
-				},
-				{
-					"--mount", fmt.Sprintf("type=volume,src=%s,dst=/foo", mnt1),
-					"--mount", fmt.Sprintf("type=volume,src=%s,target=/bar", mnt2),
-				},
-			},
-			valid: false,
-		},
-		{
-			equivalents: [][]string{
-				{
-					"--mount", fmt.Sprintf("type=bind,src=%s,dst=/foo", mnt1),
-					"--mount", fmt.Sprintf("type=volume,src=%s,dst=/bar", mnt2),
-				},
-				{
-					"--volume", fmt.Sprintf("%s:/foo", mnt1),
-					"--mount", fmt.Sprintf("type=volume,src=%s,target=/bar", mnt2),
-				},
-			},
-			valid: false,
-			fn:    testCatFooBar,
-		},
-		{
-			equivalents: [][]string{
-				{
-					"--read-only",
-					"--mount", "type=volume,dst=/bar",
-				},
-			},
-			valid: true,
-			fn: func(cName string) error {
-				_, _, err := dockerCmdWithError("exec", cName, "touch", "/bar/icanwritehere")
-				return err
-			},
-		},
-		{
-			equivalents: [][]string{
-				{
-					"--read-only",
-					"--mount", fmt.Sprintf("type=bind,src=%s,dst=/foo", mnt1),
-					"--mount", "type=volume,dst=/bar",
-				},
-				{
-					"--read-only",
-					"--volume", fmt.Sprintf("%s:/foo", mnt1),
-					"--mount", "type=volume,dst=/bar",
-				},
-			},
-			valid: true,
-			fn: func(cName string) error {
-				out, _ := dockerCmd(c, "exec", cName, "cat", "/foo/test1")
-				if out != "test1" {
-					return fmt.Errorf("%s not mounted on /foo", mnt1)
-				}
-				_, _, err := dockerCmdWithError("exec", cName, "touch", "/bar/icanwritehere")
-				return err
-			},
-		},
-		{
-			equivalents: [][]string{
-				{
-					"--mount", fmt.Sprintf("type=bind,src=%s,dst=/foo", mnt1),
-					"--mount", fmt.Sprintf("type=bind,src=%s,dst=/foo", mnt2),
-				},
-				{
-					"--mount", fmt.Sprintf("type=bind,src=%s,dst=/foo", mnt1),
-					"--mount", fmt.Sprintf("type=bind,src=%s,target=/foo", mnt2),
-				},
-				{
-					"--volume", fmt.Sprintf("%s:/foo", mnt1),
-					"--mount", fmt.Sprintf("type=bind,src=%s,target=/foo", mnt2),
-				},
-			},
-			valid: false,
-		},
-		{
-			equivalents: [][]string{
-				{
-					"--volume", fmt.Sprintf("%s:/foo", mnt1),
-					"--mount", fmt.Sprintf("type=volume,src=%s,target=/foo", mnt2),
-				},
-			},
-			valid: false,
-		},
-		{
-			equivalents: [][]string{
-				{
-					"--mount", "type=volume,target=/foo",
-					"--mount", "type=volume,target=/foo",
-				},
-			},
-			valid: false,
-		},
-	}
-
-	for i, testCase := range cases {
-		for j, opts := range testCase.equivalents {
-			cName := fmt.Sprintf("mount-%d-%d", i, j)
-			_, _, err := dockerCmdWithError(append([]string{"run", "-i", "-d", "--name", cName},
-				append(opts, []string{"busybox", "top"}...)...)...)
-			if testCase.valid {
-				c.Assert(err, check.IsNil,
-					check.Commentf("got error while creating a container with %v (%s)", opts, cName))
-				c.Assert(testCase.fn(cName), check.IsNil,
-					check.Commentf("got error while executing test for %v (%s)", opts, cName))
-				dockerCmd(c, "rm", "-f", cName)
-			} else {
-				c.Assert(err, checker.NotNil,
-					check.Commentf("got nil while creating a container with %v (%s)", opts, cName))
-			}
-		}
-	}
-}
-
 func (s *DockerSuite) TestRunWindowsWithCPUCount(c *check.C) {
 func (s *DockerSuite) TestRunWindowsWithCPUCount(c *check.C) {
 	testRequires(c, DaemonIsWindows)
 	testRequires(c, DaemonIsWindows)
 
 

+ 4 - 1
integration-cli/docker_cli_service_create_test.go

@@ -123,7 +123,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTarget(c *check.C) {
 
 
 func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
 func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
 	d := s.AddDaemon(c, true, true)
 	d := s.AddDaemon(c, true, true)
-	out, err := d.Cmd("service", "create", "--mount", "type=tmpfs,target=/foo", "busybox", "sh", "-c", "mount | grep foo; tail -f /dev/null")
+	out, err := d.Cmd("service", "create", "--mount", "type=tmpfs,target=/foo,tmpfs-size=1MB", "busybox", "sh", "-c", "mount | grep foo; tail -f /dev/null")
 	c.Assert(err, checker.IsNil, check.Commentf(out))
 	c.Assert(err, checker.IsNil, check.Commentf(out))
 	id := strings.TrimSpace(out)
 	id := strings.TrimSpace(out)
 
 
@@ -152,6 +152,8 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
 	c.Assert(mountConfig[0].Source, checker.Equals, "")
 	c.Assert(mountConfig[0].Source, checker.Equals, "")
 	c.Assert(mountConfig[0].Target, checker.Equals, "/foo")
 	c.Assert(mountConfig[0].Target, checker.Equals, "/foo")
 	c.Assert(mountConfig[0].Type, checker.Equals, mount.TypeTmpfs)
 	c.Assert(mountConfig[0].Type, checker.Equals, mount.TypeTmpfs)
+	c.Assert(mountConfig[0].TmpfsOptions, checker.NotNil)
+	c.Assert(mountConfig[0].TmpfsOptions.SizeBytes, checker.Equals, int64(1048576))
 
 
 	// check container mounts actual
 	// check container mounts actual
 	out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .Mounts}}", task.Status.ContainerStatus.ContainerID)
 	out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .Mounts}}", task.Status.ContainerStatus.ContainerID)
@@ -169,4 +171,5 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
 	out, err = s.nodeCmd(c, task.NodeID, "logs", task.Status.ContainerStatus.ContainerID)
 	out, err = s.nodeCmd(c, task.NodeID, "logs", task.Status.ContainerStatus.ContainerID)
 	c.Assert(err, checker.IsNil, check.Commentf(out))
 	c.Assert(err, checker.IsNil, check.Commentf(out))
 	c.Assert(strings.TrimSpace(out), checker.HasPrefix, "tmpfs on /foo type tmpfs")
 	c.Assert(strings.TrimSpace(out), checker.HasPrefix, "tmpfs on /foo type tmpfs")
+	c.Assert(strings.TrimSpace(out), checker.Contains, "size=1024k")
 }
 }

+ 0 - 82
integration-cli/docker_cli_swarm_test.go

@@ -226,88 +226,6 @@ func (s *DockerSwarmSuite) TestSwarmNodeTaskListFilter(c *check.C) {
 	c.Assert(out, checker.Not(checker.Contains), name+".1")
 	c.Assert(out, checker.Not(checker.Contains), name+".1")
 	c.Assert(out, checker.Not(checker.Contains), name+".2")
 	c.Assert(out, checker.Not(checker.Contains), name+".2")
 	c.Assert(out, checker.Not(checker.Contains), name+".3")
 	c.Assert(out, checker.Not(checker.Contains), name+".3")
-
-	out, err = d.Cmd("node", "ps", "--filter", "desired-state=running", "self")
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Contains, name+".1")
-	c.Assert(out, checker.Contains, name+".2")
-	c.Assert(out, checker.Contains, name+".3")
-
-	out, err = d.Cmd("node", "ps", "--filter", "desired-state=shutdown", "self")
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Not(checker.Contains), name+".1")
-	c.Assert(out, checker.Not(checker.Contains), name+".2")
-	c.Assert(out, checker.Not(checker.Contains), name+".3")
-}
-
-func (s *DockerSwarmSuite) TestSwarmServiceTaskListAll(c *check.C) {
-	d := s.AddDaemon(c, true, true)
-
-	name := "service-task-list-1"
-	out, err := d.Cmd("service", "create", "--name", name, "--replicas=3", "busybox", "top")
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
-
-	// make sure task has been deployed.
-	waitAndAssert(c, defaultReconciliationTimeout, d.checkActiveContainerCount, checker.Equals, 3)
-
-	out, err = d.Cmd("service", "ps", name)
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Contains, name+".1")
-	c.Assert(out, checker.Contains, name+".2")
-	c.Assert(out, checker.Contains, name+".3")
-
-	// Get the last container id so we can restart it to cause a task error in the history
-	containerID, err := d.Cmd("ps", "-q", "-l")
-	c.Assert(err, checker.IsNil)
-
-	_, err = d.Cmd("stop", strings.TrimSpace(containerID))
-	c.Assert(err, checker.IsNil)
-
-	waitAndAssert(c, defaultReconciliationTimeout, d.checkActiveContainerCount, checker.Equals, 3)
-
-	out, err = d.Cmd("service", "ps", name)
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Count, name, 3)
-
-	out, err = d.Cmd("service", "ps", name, "-a")
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Count, name, 4)
-}
-
-func (s *DockerSwarmSuite) TestSwarmNodeTaskListAll(c *check.C) {
-	d := s.AddDaemon(c, true, true)
-
-	name := "node-task-list"
-	out, err := d.Cmd("service", "create", "--name", name, "--replicas=3", "busybox", "top")
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
-
-	// make sure task has been deployed.
-	waitAndAssert(c, defaultReconciliationTimeout, d.checkActiveContainerCount, checker.Equals, 3)
-
-	out, err = d.Cmd("service", "ps", name)
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Contains, name+".1")
-	c.Assert(out, checker.Contains, name+".2")
-	c.Assert(out, checker.Contains, name+".3")
-
-	// Get the last container id so we can restart it to cause a task error in the history
-	containerID, err := d.Cmd("ps", "-q", "-l")
-	c.Assert(err, checker.IsNil)
-
-	_, err = d.Cmd("stop", strings.TrimSpace(containerID))
-	c.Assert(err, checker.IsNil)
-
-	waitAndAssert(c, defaultReconciliationTimeout, d.checkActiveContainerCount, checker.Equals, 3)
-
-	out, err = d.Cmd("node", "ps", "self")
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Count, name, 3)
-
-	out, err = d.Cmd("node", "ps", "self", "-a")
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Count, name, 4)
 }
 }
 
 
 // Test case for #25375
 // Test case for #25375

+ 28 - 27
libcontainerd/client_linux.go

@@ -405,13 +405,8 @@ func (clnt *client) getContainerLastEventSinceTime(id string, tsp *timestamp.Tim
 			logrus.Errorf("libcontainerd: failed to get container event for %s: %q", id, err)
 			logrus.Errorf("libcontainerd: failed to get container event for %s: %q", id, err)
 			return nil, err
 			return nil, err
 		}
 		}
-
-		logrus.Debugf("libcontainerd: received past event %#v", e)
-
-		switch e.Type {
-		case StateExit, StatePause, StateResume:
-			ev = e
-		}
+		ev = e
+		logrus.Debugf("libcontainerd: received past event %#v", ev)
 	}
 	}
 
 
 	return ev, nil
 	return ev, nil
@@ -456,30 +451,36 @@ func (clnt *client) Restore(containerID string, attachStdio StdioCallback, optio
 	// Get its last event
 	// Get its last event
 	ev, eerr := clnt.getContainerLastEvent(containerID)
 	ev, eerr := clnt.getContainerLastEvent(containerID)
 	if err != nil || cont.Status == "Stopped" {
 	if err != nil || cont.Status == "Stopped" {
-		if err != nil && !strings.Contains(err.Error(), "container not found") {
-			// Legitimate error
-			return err
+		if err != nil {
+			logrus.Warnf("libcontainerd: failed to retrieve container %s state: %v", containerID, err)
 		}
 		}
-
-		if ev == nil {
-			if _, err := clnt.getContainer(containerID); err == nil {
-				// If ev is nil and the container is running in containerd,
-				// we already consumed all the event of the
-				// container, included the "exit" one.
-				// Thus we return to avoid overriding the Exit Code.
-				logrus.Warnf("libcontainerd: restore was called on a fully synced container (%s)", containerID)
-				return nil
-			}
-			// the container is not running so we need to fix the state within docker
-			ev = &containerd.Event{
-				Type:   StateExit,
-				Status: 1,
+		if ev != nil && (ev.Pid != InitFriendlyName || ev.Type != StateExit) {
+			// Wait a while for the exit event
+			timeout := time.NewTimer(10 * time.Second)
+			tick := time.NewTicker(100 * time.Millisecond)
+		stop:
+			for {
+				select {
+				case <-timeout.C:
+					break stop
+				case <-tick.C:
+					ev, eerr = clnt.getContainerLastEvent(containerID)
+					if eerr != nil {
+						break stop
+					}
+					if ev != nil && ev.Pid == InitFriendlyName && ev.Type == StateExit {
+						break stop
+					}
+				}
 			}
 			}
+			timeout.Stop()
+			tick.Stop()
 		}
 		}
 
 
-		// get the exit status for this container
-		ec := uint32(0)
-		if eerr == nil && ev.Type == StateExit {
+		// get the exit status for this container, if we don't have
+		// one, indicate an error
+		ec := uint32(255)
+		if eerr == nil && ev != nil && ev.Pid == InitFriendlyName && ev.Type == StateExit {
 			ec = ev.Status
 			ec = ev.Status
 		}
 		}
 		clnt.setExited(containerID, ec)
 		clnt.setExited(containerID, ec)

+ 4 - 0
libcontainerd/process_unix.go

@@ -8,6 +8,7 @@ import (
 	"os"
 	"os"
 	"path/filepath"
 	"path/filepath"
 	goruntime "runtime"
 	goruntime "runtime"
+	"strings"
 	"time"
 	"time"
 
 
 	containerd "github.com/docker/containerd/api/grpc/types"
 	containerd "github.com/docker/containerd/api/grpc/types"
@@ -86,6 +87,9 @@ func (p *process) sendCloseStdin() error {
 		Pid:        p.friendlyName,
 		Pid:        p.friendlyName,
 		CloseStdin: true,
 		CloseStdin: true,
 	})
 	})
+	if err != nil && (strings.Contains(err.Error(), "container not found") || strings.Contains(err.Error(), "process not found")) {
+		return nil
+	}
 	return err
 	return err
 }
 }
 
 

+ 1 - 1
man/docker-build.1.md

@@ -83,7 +83,7 @@ set as the **URL**, the repository is cloned locally and then sent as the contex
    Users pass these values at build-time. Docker uses the `buildargs` as the
    Users pass these values at build-time. Docker uses the `buildargs` as the
    environment context for command(s) run via the Dockerfile's `RUN` instruction
    environment context for command(s) run via the Dockerfile's `RUN` instruction
    or for variable expansion in other Dockerfile instructions. This is not meant
    or for variable expansion in other Dockerfile instructions. This is not meant
-   for passing secret values. [Read more about the buildargs instruction](/reference/builder/#arg)
+   for passing secret values. [Read more about the buildargs instruction](https://docs.docker.com/engine/reference/builder/#arg)
 
 
 **--force-rm**=*true*|*false*
 **--force-rm**=*true*|*false*
    Always remove intermediate containers, even after unsuccessful builds. The default is *false*.
    Always remove intermediate containers, even after unsuccessful builds. The default is *false*.

+ 0 - 1
man/docker-create.1.md

@@ -56,7 +56,6 @@ docker-create - Create a new container
 [**--memory-reservation**[=*MEMORY-RESERVATION*]]
 [**--memory-reservation**[=*MEMORY-RESERVATION*]]
 [**--memory-swap**[=*LIMIT*]]
 [**--memory-swap**[=*LIMIT*]]
 [**--memory-swappiness**[=*MEMORY-SWAPPINESS*]]
 [**--memory-swappiness**[=*MEMORY-SWAPPINESS*]]
-[**--mount**[=*MOUNT*]]
 [**--name**[=*NAME*]]
 [**--name**[=*NAME*]]
 [**--network-alias**[=*[]*]]
 [**--network-alias**[=*[]*]]
 [**--network**[=*"bridge"*]]
 [**--network**[=*"bridge"*]]

+ 1 - 1
man/docker-login.1.md

@@ -20,7 +20,7 @@ do not specify a `SERVER`, the command uses Docker's public registry located at
 `docker login` requires user to use `sudo` or be `root`, except when:
 `docker login` requires user to use `sudo` or be `root`, except when:
 
 
 1.  connecting to  a remote daemon, such as a `docker-machine` provisioned `docker engine`.
 1.  connecting to  a remote daemon, such as a `docker-machine` provisioned `docker engine`.
-2.  user is added to the `docker` group.  This will impact the security of your system; the `docker` group is `root` equivalent.  See [Docker Daemon Attack Surface](https://docs.docker.com/articles/security/#docker-daemon-attack-surface) for details.
+2.  user is added to the `docker` group.  This will impact the security of your system; the `docker` group is `root` equivalent.  See [Docker Daemon Attack Surface](https://docs.docker.com/engine/articles/security/#docker-daemon-attack-surface) for details.
 
 
 You can log into any public or private repository for which you have
 You can log into any public or private repository for which you have
 credentials.  When you log in, the command stores encoded credentials in
 credentials.  When you log in, the command stores encoded credentials in

+ 1 - 1
man/docker-pause.1.md

@@ -18,7 +18,7 @@ that it is being suspended, and subsequently resumed. On Windows, only Hyper-V
 containers can be paused.
 containers can be paused.
 
 
 See the [cgroups freezer documentation]
 See the [cgroups freezer documentation]
-(https://www.kernel.org/doc/Documentation/cgroups/freezer-subsystem.txt) for
+(https://www.kernel.org/doc/Documentation/cgroup-v1/freezer-subsystem.txt) for
 further details.
 further details.
 
 
 # OPTIONS
 # OPTIONS

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

@@ -58,7 +58,6 @@ docker-run - Run a command in a new container
 [**--memory-reservation**[=*MEMORY-RESERVATION*]]
 [**--memory-reservation**[=*MEMORY-RESERVATION*]]
 [**--memory-swap**[=*LIMIT*]]
 [**--memory-swap**[=*LIMIT*]]
 [**--memory-swappiness**[=*MEMORY-SWAPPINESS*]]
 [**--memory-swappiness**[=*MEMORY-SWAPPINESS*]]
-[**--mount**[=*MOUNT*]]
 [**--name**[=*NAME*]]
 [**--name**[=*NAME*]]
 [**--network-alias**[=*[]*]]
 [**--network-alias**[=*[]*]]
 [**--network**[=*"bridge"*]]
 [**--network**[=*"bridge"*]]

+ 1 - 1
man/docker-unpause.1.md

@@ -14,7 +14,7 @@ The `docker unpause` command un-suspends all processes in a container.
 On Linux, it does this using the cgroups freezer.
 On Linux, it does this using the cgroups freezer.
 
 
 See the [cgroups freezer documentation]
 See the [cgroups freezer documentation]
-(https://www.kernel.org/doc/Documentation/cgroups/freezer-subsystem.txt) for
+(https://www.kernel.org/doc/Documentation/cgroup-v1/freezer-subsystem.txt) for
 further details.
 further details.
 
 
 # OPTIONS
 # OPTIONS

+ 1 - 1
man/docker-version.1.md

@@ -59,4 +59,4 @@ To view all available fields, you can use the format `{{json .}}`.
 # HISTORY
 # HISTORY
 June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
 June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
 June 2015, updated by John Howard <jhoward@microsoft.com>
 June 2015, updated by John Howard <jhoward@microsoft.com>
-June 2015, updated by Patrick Hemmer <patrick.hemmer@gmail.com
+June 2015, updated by Patrick Hemmer <patrick.hemmer@gmail.com>

+ 5 - 1
pkg/graphdb/conn_sqlite3.go → pkg/graphdb/conn_sqlite3_linux.go

@@ -2,7 +2,11 @@
 
 
 package graphdb
 package graphdb
 
 
-import "database/sql"
+import (
+	"database/sql"
+
+	_ "github.com/mattn/go-sqlite3" // registers sqlite
+)
 
 
 // NewSqliteConn opens a connection to a sqlite
 // NewSqliteConn opens a connection to a sqlite
 // database.
 // database.

+ 0 - 7
pkg/graphdb/conn_sqlite3_unix.go

@@ -1,7 +0,0 @@
-// +build cgo,!windows
-
-package graphdb
-
-import (
-	_ "github.com/mattn/go-sqlite3" // registers sqlite
-)

+ 0 - 7
pkg/graphdb/conn_sqlite3_windows.go

@@ -1,7 +0,0 @@
-// +build cgo,windows
-
-package graphdb
-
-import (
-	_ "github.com/mattn/go-sqlite3" // registers sqlite
-)

+ 0 - 8
pkg/graphdb/conn_unsupported.go

@@ -1,8 +0,0 @@
-// +build !cgo
-
-package graphdb
-
-// NewSqliteConn return a new sqlite connection.
-func NewSqliteConn(root string) (*Database, error) {
-	panic("Not implemented")
-}

+ 0 - 0
pkg/graphdb/graphdb.go → pkg/graphdb/graphdb_linux.go


+ 0 - 0
pkg/graphdb/graphdb_test.go → pkg/graphdb/graphdb_linux_test.go


+ 0 - 0
pkg/graphdb/sort.go → pkg/graphdb/sort_linux.go


+ 0 - 0
pkg/graphdb/sort_test.go → pkg/graphdb/sort_linux_test.go


+ 3 - 0
pkg/graphdb/unsupported.go

@@ -0,0 +1,3 @@
+// +build !cgo !linux
+
+package graphdb

+ 0 - 0
pkg/graphdb/utils.go → pkg/graphdb/utils_linux.go


+ 41 - 18
pkg/namesgenerator/names-generator.go

@@ -15,68 +15,91 @@ var (
 		"amazing",
 		"amazing",
 		"angry",
 		"angry",
 		"awesome",
 		"awesome",
-		"backstabbing",
-		"berserk",
-		"big",
+		"blissful",
 		"boring",
 		"boring",
+		"brave",
 		"clever",
 		"clever",
 		"cocky",
 		"cocky",
 		"compassionate",
 		"compassionate",
+		"competent",
 		"condescending",
 		"condescending",
+		"confident",
 		"cranky",
 		"cranky",
-		"desperate",
+		"dazzling",
 		"determined",
 		"determined",
 		"distracted",
 		"distracted",
 		"dreamy",
 		"dreamy",
-		"drunk",
 		"eager",
 		"eager",
 		"ecstatic",
 		"ecstatic",
 		"elastic",
 		"elastic",
 		"elated",
 		"elated",
 		"elegant",
 		"elegant",
-		"evil",
+		"eloquent",
+		"epic",
 		"fervent",
 		"fervent",
+		"festive",
+		"flamboyant",
 		"focused",
 		"focused",
-		"furious",
-		"gigantic",
-		"gloomy",
+		"friendly",
+		"frosty",
+		"gallant",
+		"gifted",
 		"goofy",
 		"goofy",
-		"grave",
+		"gracious",
 		"happy",
 		"happy",
-		"high",
+		"hardcore",
+		"heuristic",
 		"hopeful",
 		"hopeful",
 		"hungry",
 		"hungry",
 		"infallible",
 		"infallible",
+		"inspiring",
 		"jolly",
 		"jolly",
 		"jovial",
 		"jovial",
+		"keen",
 		"kickass",
 		"kickass",
-		"lonely",
+		"kind",
+		"laughing",
 		"loving",
 		"loving",
-		"mad",
+		"lucid",
+		"mystifying",
 		"modest",
 		"modest",
+		"musing",
 		"naughty",
 		"naughty",
-		"nauseous",
+		"nervous",
+		"nifty",
 		"nostalgic",
 		"nostalgic",
+		"objective",
+		"optimistic",
 		"peaceful",
 		"peaceful",
 		"pedantic",
 		"pedantic",
 		"pensive",
 		"pensive",
-		"prickly",
+		"practical",
+		"priceless",
+		"quirky",
+		"quizzical",
+		"relaxed",
 		"reverent",
 		"reverent",
 		"romantic",
 		"romantic",
 		"sad",
 		"sad",
 		"serene",
 		"serene",
 		"sharp",
 		"sharp",
-		"sick",
 		"silly",
 		"silly",
 		"sleepy",
 		"sleepy",
-		"small",
 		"stoic",
 		"stoic",
 		"stupefied",
 		"stupefied",
 		"suspicious",
 		"suspicious",
 		"tender",
 		"tender",
 		"thirsty",
 		"thirsty",
-		"tiny",
 		"trusting",
 		"trusting",
+		"unruffled",
+		"upbeat",
+		"vibrant",
+		"vigilant",
+		"wizardly",
+		"wonderful",
+		"xenodochial",
+		"youthful",
+		"zealous",
 		"zen",
 		"zen",
 	}
 	}
 
 

+ 13 - 7
pkg/signal/trap.go

@@ -83,15 +83,21 @@ func DumpStacks(dir string) (string, error) {
 		bufferLen *= 2
 		bufferLen *= 2
 	}
 	}
 	buf = buf[:stackSize]
 	buf = buf[:stackSize]
-	path := filepath.Join(dir, fmt.Sprintf(stacksLogNameTemplate, strings.Replace(time.Now().Format(time.RFC3339), ":", "", -1)))
-	f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY, 0666)
-	if err != nil {
-		return "", errors.Wrap(err, "failed to open file to write the goroutine stacks")
+	var f *os.File
+	if dir != "" {
+		path := filepath.Join(dir, fmt.Sprintf(stacksLogNameTemplate, strings.Replace(time.Now().Format(time.RFC3339), ":", "", -1)))
+		var err error
+		f, err = os.OpenFile(path, os.O_CREATE|os.O_WRONLY, 0666)
+		if err != nil {
+			return "", errors.Wrap(err, "failed to open file to write the goroutine stacks")
+		}
+		defer f.Close()
+		defer f.Sync()
+	} else {
+		f = os.Stderr
 	}
 	}
-	defer f.Close()
 	if _, err := f.Write(buf); err != nil {
 	if _, err := f.Write(buf); err != nil {
 		return "", errors.Wrap(err, "failed to write goroutine stacks")
 		return "", errors.Wrap(err, "failed to write goroutine stacks")
 	}
 	}
-	f.Sync()
-	return path, nil
+	return f.Name(), nil
 }
 }

+ 45 - 4
plugin/backend_linux.go

@@ -11,6 +11,7 @@ import (
 	"net/http"
 	"net/http"
 	"os"
 	"os"
 	"path/filepath"
 	"path/filepath"
+	"regexp"
 
 
 	"github.com/Sirupsen/logrus"
 	"github.com/Sirupsen/logrus"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
@@ -23,6 +24,11 @@ import (
 	"golang.org/x/net/context"
 	"golang.org/x/net/context"
 )
 )
 
 
+var (
+	validFullID    = regexp.MustCompile(`^([a-f0-9]{64})$`)
+	validPartialID = regexp.MustCompile(`^([a-f0-9]{1,64})$`)
+)
+
 // Disable deactivates a plugin, which implies that they cannot be used by containers.
 // Disable deactivates a plugin, which implies that they cannot be used by containers.
 func (pm *Manager) Disable(name string) error {
 func (pm *Manager) Disable(name string) error {
 	p, err := pm.pluginStore.GetByName(name)
 	p, err := pm.pluginStore.GetByName(name)
@@ -53,12 +59,32 @@ func (pm *Manager) Enable(name string, config *types.PluginEnableConfig) error {
 }
 }
 
 
 // Inspect examines a plugin config
 // Inspect examines a plugin config
-func (pm *Manager) Inspect(name string) (tp types.Plugin, err error) {
-	p, err := pm.pluginStore.GetByName(name)
-	if err != nil {
+func (pm *Manager) Inspect(refOrID string) (tp types.Plugin, err error) {
+	// Match on full ID
+	if validFullID.MatchString(refOrID) {
+		p, err := pm.pluginStore.GetByID(refOrID)
+		if err == nil {
+			return p.PluginObj, nil
+		}
+	}
+
+	// Match on full name
+	if pluginName, err := getPluginName(refOrID); err == nil {
+		if p, err := pm.pluginStore.GetByName(pluginName); err == nil {
+			return p.PluginObj, nil
+		}
+	}
+
+	// Match on partial ID
+	if validPartialID.MatchString(refOrID) {
+		p, err := pm.pluginStore.Search(refOrID)
+		if err == nil {
+			return p.PluginObj, nil
+		}
 		return tp, err
 		return tp, err
 	}
 	}
-	return p.PluginObj, nil
+
+	return tp, fmt.Errorf("no plugin name or ID associated with %q", refOrID)
 }
 }
 
 
 func (pm *Manager) pull(ref reference.Named, metaHeader http.Header, authConfig *types.AuthConfig, pluginID string) (types.PluginPrivileges, error) {
 func (pm *Manager) pull(ref reference.Named, metaHeader http.Header, authConfig *types.AuthConfig, pluginID string) (types.PluginPrivileges, error) {
@@ -244,3 +270,18 @@ func (pm *Manager) createFromContext(ctx context.Context, pluginID, pluginDir st
 
 
 	return nil
 	return nil
 }
 }
+
+func getPluginName(name string) (string, error) {
+	named, err := reference.ParseNamed(name) // FIXME: validate
+	if err != nil {
+		return "", err
+	}
+	if reference.IsNameOnly(named) {
+		named = reference.WithDefaultTag(named)
+	}
+	ref, ok := named.(reference.NamedTagged)
+	if !ok {
+		return "", fmt.Errorf("invalid name: %s", named.String())
+	}
+	return ref.String(), nil
+}

+ 29 - 0
plugin/store/store.go

@@ -30,6 +30,13 @@ type ErrNotFound string
 
 
 func (name ErrNotFound) Error() string { return fmt.Sprintf("plugin %q not found", string(name)) }
 func (name ErrNotFound) Error() string { return fmt.Sprintf("plugin %q not found", string(name)) }
 
 
+// ErrAmbiguous indicates that a plugin was not found locally.
+type ErrAmbiguous string
+
+func (name ErrAmbiguous) Error() string {
+	return fmt.Sprintf("multiple plugins found for %q", string(name))
+}
+
 // GetByName retreives a plugin by name.
 // GetByName retreives a plugin by name.
 func (ps *Store) GetByName(name string) (*v2.Plugin, error) {
 func (ps *Store) GetByName(name string) (*v2.Plugin, error) {
 	ps.RLock()
 	ps.RLock()
@@ -253,3 +260,25 @@ func (ps *Store) CallHandler(p *v2.Plugin) {
 		}
 		}
 	}
 	}
 }
 }
+
+// Search retreives a plugin by ID Prefix
+// If no plugin is found, then ErrNotFound is returned
+// If multiple plugins are found, then ErrAmbiguous is returned
+func (ps *Store) Search(partialID string) (*v2.Plugin, error) {
+	ps.RLock()
+	defer ps.RUnlock()
+
+	var found *v2.Plugin
+	for id, p := range ps.plugins {
+		if strings.HasPrefix(id, partialID) {
+			if found != nil {
+				return nil, ErrAmbiguous(partialID)
+			}
+			found = p
+		}
+	}
+	if found == nil {
+		return nil, ErrNotFound(partialID)
+	}
+	return found, nil
+}

+ 0 - 5
runconfig/opts/parse.go

@@ -25,7 +25,6 @@ type ContainerOptions struct {
 	attach             opts.ListOpts
 	attach             opts.ListOpts
 	volumes            opts.ListOpts
 	volumes            opts.ListOpts
 	tmpfs              opts.ListOpts
 	tmpfs              opts.ListOpts
-	mounts             opts.MountOpt
 	blkioWeightDevice  WeightdeviceOpt
 	blkioWeightDevice  WeightdeviceOpt
 	deviceReadBps      ThrottledeviceOpt
 	deviceReadBps      ThrottledeviceOpt
 	deviceWriteBps     ThrottledeviceOpt
 	deviceWriteBps     ThrottledeviceOpt
@@ -217,7 +216,6 @@ func AddFlags(flags *pflag.FlagSet) *ContainerOptions {
 	flags.Var(&copts.tmpfs, "tmpfs", "Mount a tmpfs directory")
 	flags.Var(&copts.tmpfs, "tmpfs", "Mount a tmpfs directory")
 	flags.Var(&copts.volumesFrom, "volumes-from", "Mount volumes from the specified container(s)")
 	flags.Var(&copts.volumesFrom, "volumes-from", "Mount volumes from the specified container(s)")
 	flags.VarP(&copts.volumes, "volume", "v", "Bind mount a volume")
 	flags.VarP(&copts.volumes, "volume", "v", "Bind mount a volume")
-	flags.Var(&copts.mounts, "mount", "Attach a filesystem mount to the container")
 
 
 	// Health-checking
 	// Health-checking
 	flags.StringVar(&copts.healthCmd, "health-cmd", "", "Command to run to check health")
 	flags.StringVar(&copts.healthCmd, "health-cmd", "", "Command to run to check health")
@@ -357,8 +355,6 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c
 		}
 		}
 	}
 	}
 
 
-	mounts := copts.mounts.Value()
-
 	var binds []string
 	var binds []string
 	volumes := copts.volumes.GetMap()
 	volumes := copts.volumes.GetMap()
 	// add any bind targets to the list of container volumes
 	// add any bind targets to the list of container volumes
@@ -623,7 +619,6 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c
 		Tmpfs:          tmpfs,
 		Tmpfs:          tmpfs,
 		Sysctls:        copts.sysctls.GetAll(),
 		Sysctls:        copts.sysctls.GetAll(),
 		Runtime:        copts.runtime,
 		Runtime:        copts.runtime,
-		Mounts:         mounts,
 	}
 	}
 
 
 	// only set this value if the user provided the flag, else it should default to nil
 	// only set this value if the user provided the flag, else it should default to nil

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است