Browse code

Merge pull request #29962 from vieux/1.13.0-rc6-cherrypicks

1.13.0 rc6 cherrypicks

Vincent Demeester authored on 2017/01/10 18:09:04
Showing 12 changed files
... ...
@@ -110,7 +110,7 @@ To manually remove all plugins and resolve this problem, take the following step
110 110
 * Remove `--name` from `docker volume create` [#23830](https://github.com/docker/docker/pull/23830)
111 111
 + Add `docker stack ls` [#23886](https://github.com/docker/docker/pull/23886)
112 112
 + Add a new `is-task` ps filter [#24411](https://github.com/docker/docker/pull/24411)
113
-+ Add `--env-file` flag to `docker create service` [#24844](https://github.com/docker/docker/pull/24844)
113
++ Add `--env-file` flag to `docker service create` [#24844](https://github.com/docker/docker/pull/24844)
114 114
 + Add `--format` on `docker stats` [#24987](https://github.com/docker/docker/pull/24987)
115 115
 + Make `docker node ps` default to `self` in swarm node [#25214](https://github.com/docker/docker/pull/25214)
116 116
 + Add `--group` in `docker service create` [#25317](https://github.com/docker/docker/pull/25317)
... ...
@@ -297,17 +297,19 @@ func workdir(b *Builder, args []string, attributes map[string]bool, original str
297 297
 	}
298 298
 	b.runConfig.Image = b.image
299 299
 
300
+	cmd := b.runConfig.Cmd
301
+	comment := "WORKDIR " + b.runConfig.WorkingDir
302
+	// reset the command for cache detection
303
+	b.runConfig.Cmd = strslice.StrSlice(append(getShell(b.runConfig), "#(nop) "+comment))
304
+	defer func(cmd strslice.StrSlice) { b.runConfig.Cmd = cmd }(cmd)
305
+
300 306
 	if hit, err := b.probeCache(); err != nil {
301 307
 		return err
302 308
 	} else if hit {
303 309
 		return nil
304 310
 	}
305 311
 
306
-	// Actually copy the struct
307
-	workdirConfig := *b.runConfig
308
-	workdirConfig.Cmd = strslice.StrSlice(append(getShell(b.runConfig), fmt.Sprintf("#(nop) WORKDIR %s", b.runConfig.WorkingDir)))
309
-
310
-	container, err := b.docker.ContainerCreate(types.ContainerCreateConfig{Config: &workdirConfig})
312
+	container, err := b.docker.ContainerCreate(types.ContainerCreateConfig{Config: b.runConfig})
311 313
 	if err != nil {
312 314
 		return err
313 315
 	}
... ...
@@ -316,7 +318,7 @@ func workdir(b *Builder, args []string, attributes map[string]bool, original str
316 316
 		return err
317 317
 	}
318 318
 
319
-	return b.commit(container.ID, b.runConfig.Cmd, "WORKDIR "+b.runConfig.WorkingDir)
319
+	return b.commit(container.ID, cmd, comment)
320 320
 }
321 321
 
322 322
 // RUN some command yo
... ...
@@ -27,17 +27,17 @@ func newSecretCreateCommand(dockerCli *command.DockerCli) *cobra.Command {
27 27
 	}
28 28
 
29 29
 	cmd := &cobra.Command{
30
-		Use:   "create [OPTIONS] SECRET",
30
+		Use:   "create [OPTIONS] SECRET file|-",
31 31
 		Short: "Create a secret from a file or STDIN as content",
32
-		Args:  cli.ExactArgs(1),
32
+		Args:  cli.ExactArgs(2),
33 33
 		RunE: func(cmd *cobra.Command, args []string) error {
34 34
 			createOpts.name = args[0]
35
+			createOpts.file = args[1]
35 36
 			return runSecretCreate(dockerCli, createOpts)
36 37
 		},
37 38
 	}
38 39
 	flags := cmd.Flags()
39 40
 	flags.VarP(&createOpts.labels, "label", "l", "Secret labels")
40
-	flags.StringVarP(&createOpts.file, "file", "f", "", "Read from a file or STDIN ('-')")
41 41
 
42 42
 	return cmd
43 43
 }
... ...
@@ -46,10 +46,6 @@ func runSecretCreate(dockerCli *command.DockerCli, options createOptions) error
46 46
 	client := dockerCli.Client()
47 47
 	ctx := context.Background()
48 48
 
49
-	if options.file == "" {
50
-		return fmt.Errorf("Please specify either a file name or STDIN ('-') with --file")
51
-	}
52
-
53 49
 	var in io.Reader = dockerCli.In()
54 50
 	if options.file != "-" {
55 51
 		file, err := system.OpenSequential(options.file)
... ...
@@ -23,6 +23,7 @@
23 23
 # DOCKER_COMPLETION_SHOW_CONTAINER_IDS
24 24
 # DOCKER_COMPLETION_SHOW_NETWORK_IDS
25 25
 # DOCKER_COMPLETION_SHOW_NODE_IDS
26
+# DOCKER_COMPLETION_SHOW_PLUGIN_IDS
26 27
 # DOCKER_COMPLETION_SHOW_SECRET_IDS
27 28
 # DOCKER_COMPLETION_SHOW_SERVICE_IDS
28 29
 #   "no"  - Show names only (default)
... ...
@@ -286,9 +287,17 @@ __docker_complete_plugins_bundled() {
286 286
 
287 287
 # __docker_plugins_installed returns a list of all plugins that were installed with
288 288
 # the Docker plugin API.
289
+# By default, only names are returned.
290
+# Set DOCKER_COMPLETION_SHOW_PLUGIN_IDS=yes to also complete IDs.
289 291
 # For built-in pugins, see `__docker_plugins_bundled`.
290 292
 __docker_plugins_installed() {
291
-	__docker_q plugin ls | awk 'NR>1 {print $1}'
293
+	local fields
294
+	if [ "$DOCKER_COMPLETION_SHOW_PLUGIN_IDS" = yes ] ; then
295
+		fields='$1,$2'
296
+	else
297
+		fields='$2'
298
+	fi
299
+	__docker_q plugin ls | awk "NR>1 {print $fields}"
292 300
 }
293 301
 
294 302
 # __docker_complete_plugins_installed applies completion of plugins that were installed
... ...
@@ -917,7 +917,7 @@ __docker_image_subcommand() {
917 917
                 "($help)*--label=[Set metadata for an image]:label=value: " \
918 918
                 "($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: " \
919 919
                 "($help)--memory-swap=[Total memory limit with swap]:Memory limit: " \
920
-                "($help)--network=[Connect a container to a network]:network mode:(bridge none container host)"
920
+                "($help)--network=[Connect a container to a network]:network mode:(bridge none container host)" \
921 921
                 "($help)--no-cache[Do not use cache when building the image]" \
922 922
                 "($help)--pull[Attempt to pull a newer version of the image]" \
923 923
                 "($help -q --quiet)"{-q,--quiet}"[Suppress verbose build output]" \
... ...
@@ -16,12 +16,11 @@ keywords: ["secret, create"]
16 16
 # secret create
17 17
 
18 18
 ```Markdown
19
-Usage:	docker secret create [OPTIONS] SECRET
19
+Usage:	docker secret create [OPTIONS] SECRET file|-
20 20
 
21 21
 Create a secret from a file or STDIN as content
22 22
 
23 23
 Options:
24
-  -f, --file string   Read from a file or STDIN ('-')
25 24
       --help          Print usage
26 25
   -l, --label list    Secret labels (default [])
27 26
 ```
... ...
@@ -34,7 +33,7 @@ command on a manager node.
34 34
 ### Create a secret
35 35
 
36 36
 ```bash
37
-$ echo <secret> | docker secret create -f - my_secret
37
+$ echo <secret> | docker secret create my_secret -
38 38
 mhv17xfe3gh6xc4rij5orpfds
39 39
 
40 40
 $ docker secret ls
... ...
@@ -45,7 +44,7 @@ mhv17xfe3gh6xc4rij5orpfds   my_secret               2016-10-27 23:25:43.90918108
45 45
 ### Create a secret with a file
46 46
 
47 47
 ```bash
48
-$ docker secret create -f secret.json my_secret
48
+$ docker secret create my_secret ./secret.json
49 49
 mhv17xfe3gh6xc4rij5orpfds
50 50
 
51 51
 $ docker secret ls
... ...
@@ -56,7 +55,7 @@ mhv17xfe3gh6xc4rij5orpfds   my_secret               2016-10-27 23:25:43.90918108
56 56
 ### Create a secret with labels
57 57
 
58 58
 ```bash
59
-$ docker secret create -f secret.json --label env=dev --label rev=20161102 my_secret
59
+$ docker secret create --label env=dev --label rev=20161102 my_secret ./secret.json
60 60
 jtn7g6aukl5ky7nr9gvwafoxh
61 61
 
62 62
 $ docker secret inspect my_secret
... ...
@@ -11,10 +11,10 @@ import (
11 11
 )
12 12
 
13 13
 var (
14
-	authzPluginName            = "tonistiigi/authz-no-volume-plugin"
14
+	authzPluginName            = "riyaz/authz-no-volume-plugin"
15 15
 	authzPluginTag             = "latest"
16 16
 	authzPluginNameWithTag     = authzPluginName + ":" + authzPluginTag
17
-	authzPluginBadManifestName = "tonistiigi/authz-plugin-bad-manifest"
17
+	authzPluginBadManifestName = "riyaz/authz-plugin-bad-manifest"
18 18
 	nonexistentAuthzPluginName = "riyaz/nonexistent-authz-plugin"
19 19
 )
20 20
 
... ...
@@ -7383,6 +7383,10 @@ func (s *DockerSuite) TestBuildWorkdirCmd(c *check.C) {
7383 7383
                 FROM golang:1.7-alpine
7384 7384
                 WORKDIR /
7385 7385
                 `
7386
-	_, err := buildImage("testbuildworkdircmd", dockerFile, false)
7386
+	_, err := buildImage("testbuildworkdircmd", dockerFile, true)
7387 7387
 	c.Assert(err, checker.IsNil)
7388
+
7389
+	_, out, err := buildImageWithOut("testbuildworkdircmd", dockerFile, true)
7390
+	c.Assert(err, checker.IsNil)
7391
+	c.Assert(strings.Count(out, "Using cache"), checker.Equals, 1)
7388 7392
 }
... ...
@@ -772,7 +772,7 @@ func (s *DockerNetworkSuite) TestDockerPluginV2NetworkDriver(c *check.C) {
772 772
 	testRequires(c, DaemonIsLinux, IsAmd64, Network)
773 773
 
774 774
 	var (
775
-		npName        = "tonistiigi/test-docker-netplugin"
775
+		npName        = "tiborvass/test-docker-netplugin"
776 776
 		npTag         = "latest"
777 777
 		npNameWithTag = npName + ":" + npTag
778 778
 	)
... ...
@@ -15,8 +15,8 @@ import (
15 15
 
16 16
 var (
17 17
 	pluginProcessName = "sample-volume-plugin"
18
-	pName             = "tonistiigi/sample-volume-plugin"
19
-	npName            = "tonistiigi/test-docker-netplugin"
18
+	pName             = "tiborvass/sample-volume-plugin"
19
+	npName            = "tiborvass/test-docker-netplugin"
20 20
 	pTag              = "latest"
21 21
 	pNameWithTag      = pName + ":" + pTag
22 22
 	npNameWithTag     = npName + ":" + pTag
... ...
@@ -121,20 +121,11 @@ func (s *DockerSwarmSuite) TestSecretCreateWithFile(c *check.C) {
121 121
 	c.Assert(err, checker.IsNil, check.Commentf("failed to write to temporary file"))
122 122
 
123 123
 	testName := "test_secret"
124
-	out, err := d.Cmd("secret", "create", "--file", testFile.Name(), testName)
124
+	out, err := d.Cmd("secret", "create", testName, testFile.Name())
125 125
 	c.Assert(err, checker.IsNil)
126 126
 	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "", check.Commentf(out))
127 127
 
128 128
 	id := strings.TrimSpace(out)
129 129
 	secret := d.getSecret(c, id)
130 130
 	c.Assert(secret.Spec.Name, checker.Equals, testName)
131
-
132
-	testName = "test_secret_2"
133
-	out, err = d.Cmd("secret", "create", testName, "-f", testFile.Name())
134
-	c.Assert(err, checker.IsNil)
135
-	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "", check.Commentf(out))
136
-
137
-	id = strings.TrimSpace(out)
138
-	secret = d.getSecret(c, id)
139
-	c.Assert(secret.Spec.Name, checker.Equals, testName)
140 131
 }
... ...
@@ -2,7 +2,7 @@
2 2
 github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62
3 3
 github.com/Microsoft/hcsshim v0.5.9
4 4
 github.com/Microsoft/go-winio v0.3.7
5
-github.com/Sirupsen/logrus f76d643702a30fbffecdfe50831e11881c96ceb3 https://github.com/aaronlehmann/logrus
5
+github.com/Sirupsen/logrus v0.11.0
6 6
 github.com/davecgh/go-spew 6d212800a42e8ab5c146b8ace3490ee17e5225f9
7 7
 github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
8 8
 github.com/go-check/check 4ed411733c5785b40214c70bce814c3a3a689609 https://github.com/cpuguy83/check.git
... ...
@@ -108,7 +108,7 @@ github.com/google/certificate-transparency d90e65c3a07988180c5b1ece71791c0b65068
108 108
 golang.org/x/crypto 3fbbcd23f1cb824e69491a5930cfeff09b12f4d2
109 109
 golang.org/x/time a4bde12657593d5e90d0533a3e4fd95e635124cb
110 110
 github.com/mreiferson/go-httpclient 63fe23f7434723dc904c901043af07931f293c47
111
-github.com/hashicorp/go-memdb 608dda3b1410a73eaf3ac8b517c9ae7ebab6aa87 https://github.com/floridoo/go-memdb
111
+github.com/hashicorp/go-memdb 608dda3b1410a73eaf3ac8b517c9ae7ebab6aa87
112 112
 github.com/hashicorp/go-immutable-radix 8e8ed81f8f0bf1bdd829593fdd5c29922c1ea990
113 113
 github.com/hashicorp/golang-lru a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4
114 114
 github.com/coreos/pkg fa29b1d70f0beaddd4c7021607cc3c3be8ce94b8