Signed-off-by: Kara Alexandra <kalexandra@us.ibm.com>
Kara Alexandra authored on 2016/06/15 07:42:30... | ... |
@@ -26,17 +26,25 @@ func newCreateCommand(dockerCli *client.DockerCli) *cobra.Command { |
26 | 26 |
} |
27 | 27 |
|
28 | 28 |
cmd := &cobra.Command{ |
29 |
- Use: "create [OPTIONS]", |
|
29 |
+ Use: "create [OPTIONS] [VOLUME]", |
|
30 | 30 |
Short: "Create a volume", |
31 | 31 |
Long: createDescription, |
32 |
- Args: cli.NoArgs, |
|
32 |
+ Args: cli.RequiresMaxArgs(1), |
|
33 | 33 |
RunE: func(cmd *cobra.Command, args []string) error { |
34 |
+ if len(args) == 1 { |
|
35 |
+ if opts.name != "" { |
|
36 |
+ fmt.Fprint(dockerCli.Err(), "Conflicting options: either specify --name or provide positional arg, not both\n") |
|
37 |
+ return cli.StatusError{StatusCode: 1} |
|
38 |
+ } |
|
39 |
+ opts.name = args[0] |
|
40 |
+ } |
|
34 | 41 |
return runCreate(dockerCli, opts) |
35 | 42 |
}, |
36 | 43 |
} |
37 | 44 |
flags := cmd.Flags() |
38 | 45 |
flags.StringVarP(&opts.driver, "driver", "d", "local", "Specify volume driver name") |
39 | 46 |
flags.StringVar(&opts.name, "name", "", "Specify volume name") |
47 |
+ flags.Lookup("name").Hidden = true |
|
40 | 48 |
flags.VarP(&opts.driverOpts, "opt", "o", "Set driver specific options") |
41 | 49 |
flags.StringSliceVar(&opts.labels, "label", []string{}, "Set metadata for a volume") |
42 | 50 |
|
... | ... |
@@ -67,7 +75,7 @@ Creates a new volume that containers can consume and store data in. If a name |
67 | 67 |
is not specified, Docker generates a random name. You create a volume and then |
68 | 68 |
configure the container to use it, for example: |
69 | 69 |
|
70 |
- $ docker volume create --name hello |
|
70 |
+ $ docker volume create hello |
|
71 | 71 |
hello |
72 | 72 |
$ docker run -d -v hello:/world busybox ls /world |
73 | 73 |
|
... | ... |
@@ -11,7 +11,7 @@ parent = "smn_cli" |
11 | 11 |
# volume create |
12 | 12 |
|
13 | 13 |
```markdown |
14 |
-Usage: docker volume create [OPTIONS] |
|
14 |
+Usage: docker volume create [OPTIONS] [VOLUME] |
|
15 | 15 |
|
16 | 16 |
Create a volume |
17 | 17 |
|
... | ... |
@@ -19,14 +19,13 @@ Options: |
19 | 19 |
-d, --driver string Specify volume driver name (default "local") |
20 | 20 |
--help Print usage |
21 | 21 |
--label value Set metadata for a volume (default []) |
22 |
- --name string Specify volume name |
|
23 | 22 |
-o, --opt value Set driver specific options (default map[]) |
24 | 23 |
``` |
25 | 24 |
|
26 | 25 |
Creates a new volume that containers can consume and store data in. If a name is not specified, Docker generates a random name. You create a volume and then configure the container to use it, for example: |
27 | 26 |
|
28 | 27 |
```bash |
29 |
-$ docker volume create --name hello |
|
28 |
+$ docker volume create hello |
|
30 | 29 |
hello |
31 | 30 |
|
32 | 31 |
$ docker run -d -v hello:/world busybox ls /world |
... | ... |
@@ -62,19 +61,19 @@ The built-in `local` driver on Linux accepts options similar to the linux `mount |
62 | 62 |
For example, the following creates a `tmpfs` volume called `foo` with a size of 100 megabyte and `uid` of 1000. |
63 | 63 |
|
64 | 64 |
```bash |
65 |
-$ docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 --name foo |
|
65 |
+$ docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 foo |
|
66 | 66 |
``` |
67 | 67 |
|
68 | 68 |
Another example that uses `btrfs`: |
69 | 69 |
|
70 | 70 |
```bash |
71 |
-$ docker volume create --driver local --opt type=btrfs --opt device=/dev/sda2 --name foo |
|
71 |
+$ docker volume create --driver local --opt type=btrfs --opt device=/dev/sda2 foo |
|
72 | 72 |
``` |
73 | 73 |
|
74 | 74 |
Another example that uses `nfs` to mount the `/path/to/dir` in `rw` mode from `192.168.1.1`: |
75 | 75 |
|
76 | 76 |
```bash |
77 |
-$ docker volume create --driver local --opt type=nfs --opt o=addr=192.168.1.1,rw --opt device=:/path/to/dir --name foo |
|
77 |
+$ docker volume create --driver local --opt type=nfs --opt o=addr=192.168.1.1,rw --opt device=:/path/to/dir foo |
|
78 | 78 |
``` |
79 | 79 |
|
80 | 80 |
|
... | ... |
@@ -34,9 +34,9 @@ Lists all the volumes Docker knows about. You can filter using the `-f` or `--fi |
34 | 34 |
Example output: |
35 | 35 |
|
36 | 36 |
```bash |
37 |
-$ docker volume create --name rosemary |
|
37 |
+$ docker volume create rosemary |
|
38 | 38 |
rosemary |
39 |
-$docker volume create --name tyler |
|
39 |
+$docker volume create tyler |
|
40 | 40 |
tyler |
41 | 41 |
$ docker volume ls |
42 | 42 |
DRIVER VOLUME NAME |
... | ... |
@@ -91,9 +91,9 @@ a `label` and a value. |
91 | 91 |
First, let's create some volumes to illustrate this; |
92 | 92 |
|
93 | 93 |
```bash |
94 |
-$ docker volume create --name the-doctor --label is-timelord=yes |
|
94 |
+$ docker volume create the-doctor --label is-timelord=yes |
|
95 | 95 |
the-doctor |
96 |
-$ docker volume create --name daleks --label is-timelord=no |
|
96 |
+$ docker volume create daleks --label is-timelord=no |
|
97 | 97 |
daleks |
98 | 98 |
``` |
99 | 99 |
|
... | ... |
@@ -203,7 +203,7 @@ The following example also creates the `my-named-volume` volume, this time |
203 | 203 |
using the `docker volume create` command. |
204 | 204 |
|
205 | 205 |
```bash |
206 |
-$ docker volume create -d flocker --name my-named-volume -o size=20GB |
|
206 |
+$ docker volume create -d flocker my-named-volume -o size=20GB |
|
207 | 207 |
|
208 | 208 |
$ docker run -d -P \ |
209 | 209 |
-v my-named-volume:/opt/webapp \ |
... | ... |
@@ -196,7 +196,7 @@ func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) { |
196 | 196 |
} |
197 | 197 |
}() |
198 | 198 |
|
199 |
- out, err = s.d.Cmd("volume", "create", "-d", pluginName, "--name", volName) |
|
199 |
+ out, err = s.d.Cmd("volume", "create", "-d", pluginName, volName) |
|
200 | 200 |
if err != nil { |
201 | 201 |
c.Fatalf("Could not create volume: %v %s", err, out) |
202 | 202 |
} |
... | ... |
@@ -1827,7 +1827,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartRmVolumeInUse(c *check.C) { |
1827 | 1827 |
func (s *DockerDaemonSuite) TestDaemonRestartLocalVolumes(c *check.C) { |
1828 | 1828 |
c.Assert(s.d.Start(), check.IsNil) |
1829 | 1829 |
|
1830 |
- _, err := s.d.Cmd("volume", "create", "--name", "test") |
|
1830 |
+ _, err := s.d.Cmd("volume", "create", "test") |
|
1831 | 1831 |
c.Assert(err, check.IsNil) |
1832 | 1832 |
c.Assert(s.d.Restart(), check.IsNil) |
1833 | 1833 |
|
... | ... |
@@ -178,7 +178,7 @@ func (s *DockerSuite) TestVolumeEvents(c *check.C) { |
178 | 178 |
since := daemonUnixTime(c) |
179 | 179 |
|
180 | 180 |
// Observe create/mount volume actions |
181 |
- dockerCmd(c, "volume", "create", "--name", "test-event-volume-local") |
|
181 |
+ dockerCmd(c, "volume", "create", "test-event-volume-local") |
|
182 | 182 |
dockerCmd(c, "run", "--name", "test-volume-container", "--volume", "test-event-volume-local:/foo", "-d", "busybox", "true") |
183 | 183 |
waitRun("test-volume-container") |
184 | 184 |
|
... | ... |
@@ -355,7 +355,7 @@ func (s *DockerSuite) TestEventsFilterVolumeAndNetworkType(c *check.C) { |
355 | 355 |
since := daemonUnixTime(c) |
356 | 356 |
|
357 | 357 |
dockerCmd(c, "network", "create", "test-event-network-type") |
358 |
- dockerCmd(c, "volume", "create", "--name", "test-event-volume-type") |
|
358 |
+ dockerCmd(c, "volume", "create", "test-event-volume-type") |
|
359 | 359 |
|
360 | 360 |
out, _ := dockerCmd(c, "events", "--filter", "type=volume", "--filter", "type=network", "--since", since, "--until", daemonUnixTime(c)) |
361 | 361 |
events := strings.Split(strings.TrimSpace(out), "\n") |
... | ... |
@@ -373,7 +373,7 @@ func (s *DockerSuite) TestEventsFilterVolumeID(c *check.C) { |
373 | 373 |
|
374 | 374 |
since := daemonUnixTime(c) |
375 | 375 |
|
376 |
- dockerCmd(c, "volume", "create", "--name", "test-event-volume-id") |
|
376 |
+ dockerCmd(c, "volume", "create", "test-event-volume-id") |
|
377 | 377 |
out, _ := dockerCmd(c, "events", "--filter", "volume=test-event-volume-id", "--since", since, "--until", daemonUnixTime(c)) |
378 | 378 |
events := strings.Split(strings.TrimSpace(out), "\n") |
379 | 379 |
c.Assert(events, checker.HasLen, 1) |
... | ... |
@@ -409,7 +409,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverRetryNotImmediatelyE |
409 | 409 |
} |
410 | 410 |
|
411 | 411 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverBindExternalVolume(c *check.C) { |
412 |
- dockerCmd(c, "volume", "create", "-d", "test-external-volume-driver", "--name", "foo") |
|
412 |
+ dockerCmd(c, "volume", "create", "-d", "test-external-volume-driver", "foo") |
|
413 | 413 |
dockerCmd(c, "run", "-d", "--name", "testing", "-v", "foo:/bar", "busybox", "top") |
414 | 414 |
|
415 | 415 |
var mounts []struct { |
... | ... |
@@ -424,7 +424,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverBindExternalVolume(c |
424 | 424 |
} |
425 | 425 |
|
426 | 426 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverList(c *check.C) { |
427 |
- dockerCmd(c, "volume", "create", "-d", "test-external-volume-driver", "--name", "abc3") |
|
427 |
+ dockerCmd(c, "volume", "create", "-d", "test-external-volume-driver", "abc3") |
|
428 | 428 |
out, _ := dockerCmd(c, "volume", "ls") |
429 | 429 |
ls := strings.Split(strings.TrimSpace(out), "\n") |
430 | 430 |
c.Assert(len(ls), check.Equals, 2, check.Commentf("\n%s", out)) |
... | ... |
@@ -443,7 +443,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *check.C) { |
443 | 443 |
c.Assert(s.ec.gets, check.Equals, 1) |
444 | 444 |
c.Assert(out, checker.Contains, "No such volume") |
445 | 445 |
|
446 |
- dockerCmd(c, "volume", "create", "--name", "test", "-d", "test-external-volume-driver") |
|
446 |
+ dockerCmd(c, "volume", "create", "test", "-d", "test-external-volume-driver") |
|
447 | 447 |
out, _ = dockerCmd(c, "volume", "inspect", "test") |
448 | 448 |
|
449 | 449 |
type vol struct { |
... | ... |
@@ -458,7 +458,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *check.C) { |
458 | 458 |
} |
459 | 459 |
|
460 | 460 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverWithDaemonRestart(c *check.C) { |
461 |
- dockerCmd(c, "volume", "create", "-d", "test-external-volume-driver", "--name", "abc1") |
|
461 |
+ dockerCmd(c, "volume", "create", "-d", "test-external-volume-driver", "abc1") |
|
462 | 462 |
err := s.d.Restart() |
463 | 463 |
c.Assert(err, checker.IsNil) |
464 | 464 |
|
... | ... |
@@ -474,7 +474,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverWithDaemonRestart(c |
474 | 474 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGetEmptyResponse(c *check.C) { |
475 | 475 |
c.Assert(s.d.Start(), checker.IsNil) |
476 | 476 |
|
477 |
- out, err := s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--name", "abc2", "--opt", "ninja=1") |
|
477 |
+ out, err := s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "abc2", "--opt", "ninja=1") |
|
478 | 478 |
c.Assert(err, checker.IsNil, check.Commentf(out)) |
479 | 479 |
|
480 | 480 |
out, err = s.d.Cmd("volume", "inspect", "abc2") |
... | ... |
@@ -487,7 +487,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverPathCalls(c *check.C |
487 | 487 |
c.Assert(s.d.Start(), checker.IsNil) |
488 | 488 |
c.Assert(s.ec.paths, checker.Equals, 0) |
489 | 489 |
|
490 |
- out, err := s.d.Cmd("volume", "create", "--name=test", "--driver=test-external-volume-driver") |
|
490 |
+ out, err := s.d.Cmd("volume", "create", "test", "--driver=test-external-volume-driver") |
|
491 | 491 |
c.Assert(err, checker.IsNil, check.Commentf(out)) |
492 | 492 |
c.Assert(s.ec.paths, checker.Equals, 1) |
493 | 493 |
|
... | ... |
@@ -516,7 +516,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverCapabilities(c *chec |
516 | 516 |
c.Assert(s.ec.caps, checker.Equals, 0) |
517 | 517 |
|
518 | 518 |
for i := 0; i < 3; i++ { |
519 |
- out, err := s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", "--name", fmt.Sprintf("test%d", i)) |
|
519 |
+ out, err := s.d.Cmd("volume", "create", "-d", "test-external-volume-driver", fmt.Sprintf("test%d", i)) |
|
520 | 520 |
c.Assert(err, checker.IsNil, check.Commentf(out)) |
521 | 521 |
c.Assert(s.ec.caps, checker.Equals, 1) |
522 | 522 |
out, err = s.d.Cmd("volume", "inspect", "--format={{.Scope}}", fmt.Sprintf("test%d", i)) |
... | ... |
@@ -282,11 +282,12 @@ func testCommand(cmd string, newEnvs []string, scanForHome bool, home string) er |
282 | 282 |
|
283 | 283 |
// These commands will never print a short-usage so don't test |
284 | 284 |
noShortUsage := map[string]string{ |
285 |
- "images": "", |
|
286 |
- "login": "", |
|
287 |
- "logout": "", |
|
288 |
- "network": "", |
|
289 |
- "stats": "", |
|
285 |
+ "images": "", |
|
286 |
+ "login": "", |
|
287 |
+ "logout": "", |
|
288 |
+ "network": "", |
|
289 |
+ "stats": "", |
|
290 |
+ "volume create": "", |
|
290 | 291 |
} |
291 | 292 |
|
292 | 293 |
if _, ok := noShortUsage[cmd]; !ok { |
... | ... |
@@ -704,7 +704,7 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) { |
704 | 704 |
|
705 | 705 |
mp := prefix + slash + "test" |
706 | 706 |
|
707 |
- dockerCmd(c, "volume", "create", "--name", "ps-volume-test") |
|
707 |
+ dockerCmd(c, "volume", "create", "ps-volume-test") |
|
708 | 708 |
// volume mount containers |
709 | 709 |
runSleepingContainer(c, "--name=volume-test-1", "--volume", "ps-volume-test:"+mp) |
710 | 710 |
c.Assert(waitRun("volume-test-1"), checker.IsNil) |
... | ... |
@@ -4307,7 +4307,7 @@ func (s *DockerSuite) TestRunNamedVolumeCopyImageData(c *check.C) { |
4307 | 4307 |
func (s *DockerSuite) TestRunNamedVolumeNotRemoved(c *check.C) { |
4308 | 4308 |
prefix, _ := getPrefixAndSlashFromDaemonPlatform() |
4309 | 4309 |
|
4310 |
- dockerCmd(c, "volume", "create", "--name", "test") |
|
4310 |
+ dockerCmd(c, "volume", "create", "test") |
|
4311 | 4311 |
|
4312 | 4312 |
dockerCmd(c, "run", "--rm", "-v", "test:"+prefix+"/foo", "-v", prefix+"/bar", "busybox", "true") |
4313 | 4313 |
dockerCmd(c, "volume", "inspect", "test") |
... | ... |
@@ -4324,7 +4324,7 @@ func (s *DockerSuite) TestRunNamedVolumeNotRemoved(c *check.C) { |
4324 | 4324 |
func (s *DockerSuite) TestRunNamedVolumesFromNotRemoved(c *check.C) { |
4325 | 4325 |
prefix, _ := getPrefixAndSlashFromDaemonPlatform() |
4326 | 4326 |
|
4327 |
- dockerCmd(c, "volume", "create", "--name", "test") |
|
4327 |
+ dockerCmd(c, "volume", "create", "test") |
|
4328 | 4328 |
dockerCmd(c, "run", "--name=parent", "-v", "test:"+prefix+"/foo", "-v", prefix+"/bar", "busybox", "true") |
4329 | 4329 |
dockerCmd(c, "run", "--name=child", "--volumes-from=parent", "busybox", "true") |
4330 | 4330 |
|
... | ... |
@@ -4381,7 +4381,7 @@ func (s *DockerSuite) TestRunVolumeCopyFlag(c *check.C) { |
4381 | 4381 |
) |
4382 | 4382 |
c.Assert(err, checker.IsNil) |
4383 | 4383 |
|
4384 |
- dockerCmd(c, "volume", "create", "--name=test") |
|
4384 |
+ dockerCmd(c, "volume", "create", "test") |
|
4385 | 4385 |
|
4386 | 4386 |
// test with the nocopy flag |
4387 | 4387 |
out, _, err := dockerCmdWithError("run", "-v", "test:/foo:nocopy", "volumecopy") |
... | ... |
@@ -18,20 +18,29 @@ func (s *DockerSuite) TestVolumeCliCreate(c *check.C) { |
18 | 18 |
_, err := runCommand(exec.Command(dockerBinary, "volume", "create", "-d", "nosuchdriver")) |
19 | 19 |
c.Assert(err, check.Not(check.IsNil)) |
20 | 20 |
|
21 |
+ // test using hidden --name option |
|
21 | 22 |
out, _ := dockerCmd(c, "volume", "create", "--name=test") |
22 | 23 |
name := strings.TrimSpace(out) |
23 | 24 |
c.Assert(name, check.Equals, "test") |
25 |
+ |
|
26 |
+ out, _ = dockerCmd(c, "volume", "create", "test2") |
|
27 |
+ name = strings.TrimSpace(out) |
|
28 |
+ c.Assert(name, check.Equals, "test2") |
|
24 | 29 |
} |
25 | 30 |
|
26 | 31 |
func (s *DockerSuite) TestVolumeCliCreateOptionConflict(c *check.C) { |
27 |
- dockerCmd(c, "volume", "create", "--name=test") |
|
28 |
- out, _, err := dockerCmdWithError("volume", "create", "--name", "test", "--driver", "nosuchdriver") |
|
32 |
+ dockerCmd(c, "volume", "create", "test") |
|
33 |
+ out, _, err := dockerCmdWithError("volume", "create", "test", "--driver", "nosuchdriver") |
|
29 | 34 |
c.Assert(err, check.NotNil, check.Commentf("volume create exception name already in use with another driver")) |
30 | 35 |
c.Assert(out, checker.Contains, "A volume named test already exists") |
31 | 36 |
|
32 | 37 |
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Driver }}", "test") |
33 |
- _, _, err = dockerCmdWithError("volume", "create", "--name", "test", "--driver", strings.TrimSpace(out)) |
|
38 |
+ _, _, err = dockerCmdWithError("volume", "create", "test", "--driver", strings.TrimSpace(out)) |
|
34 | 39 |
c.Assert(err, check.IsNil) |
40 |
+ |
|
41 |
+ // make sure hidden --name option conflicts with positional arg name |
|
42 |
+ out, _, err = dockerCmdWithError("volume", "create", "--name", "test2", "test2") |
|
43 |
+ c.Assert(err, check.NotNil, check.Commentf("Conflicting options: either specify --name or provide positional arg, not both")) |
|
35 | 44 |
} |
36 | 45 |
|
37 | 46 |
func (s *DockerSuite) TestVolumeCliInspect(c *check.C) { |
... | ... |
@@ -46,15 +55,15 @@ func (s *DockerSuite) TestVolumeCliInspect(c *check.C) { |
46 | 46 |
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Name }}", name) |
47 | 47 |
c.Assert(strings.TrimSpace(out), check.Equals, name) |
48 | 48 |
|
49 |
- dockerCmd(c, "volume", "create", "--name", "test") |
|
49 |
+ dockerCmd(c, "volume", "create", "test") |
|
50 | 50 |
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Name }}", "test") |
51 | 51 |
c.Assert(strings.TrimSpace(out), check.Equals, "test") |
52 | 52 |
} |
53 | 53 |
|
54 | 54 |
func (s *DockerSuite) TestVolumeCliInspectMulti(c *check.C) { |
55 |
- dockerCmd(c, "volume", "create", "--name", "test1") |
|
56 |
- dockerCmd(c, "volume", "create", "--name", "test2") |
|
57 |
- dockerCmd(c, "volume", "create", "--name", "not-shown") |
|
55 |
+ dockerCmd(c, "volume", "create", "test1") |
|
56 |
+ dockerCmd(c, "volume", "create", "test2") |
|
57 |
+ dockerCmd(c, "volume", "create", "not-shown") |
|
58 | 58 |
|
59 | 59 |
result := dockerCmdWithResult("volume", "inspect", "--format={{ .Name }}", "test1", "test2", "doesntexist", "not-shown") |
60 | 60 |
c.Assert(result, icmd.Matches, icmd.Expected{ |
... | ... |
@@ -73,11 +82,11 @@ func (s *DockerSuite) TestVolumeCliInspectMulti(c *check.C) { |
73 | 73 |
|
74 | 74 |
func (s *DockerSuite) TestVolumeCliLs(c *check.C) { |
75 | 75 |
prefix, _ := getPrefixAndSlashFromDaemonPlatform() |
76 |
- dockerCmd(c, "volume", "create", "--name", "aaa") |
|
76 |
+ dockerCmd(c, "volume", "create", "aaa") |
|
77 | 77 |
|
78 |
- dockerCmd(c, "volume", "create", "--name", "test") |
|
78 |
+ dockerCmd(c, "volume", "create", "test") |
|
79 | 79 |
|
80 |
- dockerCmd(c, "volume", "create", "--name", "soo") |
|
80 |
+ dockerCmd(c, "volume", "create", "soo") |
|
81 | 81 |
dockerCmd(c, "run", "-v", "soo:"+prefix+"/foo", "busybox", "ls", "/") |
82 | 82 |
|
83 | 83 |
out, _ := dockerCmd(c, "volume", "ls") |
... | ... |
@@ -88,9 +97,9 @@ func (s *DockerSuite) TestVolumeCliLs(c *check.C) { |
88 | 88 |
} |
89 | 89 |
|
90 | 90 |
func (s *DockerSuite) TestVolumeLsFormat(c *check.C) { |
91 |
- dockerCmd(c, "volume", "create", "--name", "aaa") |
|
92 |
- dockerCmd(c, "volume", "create", "--name", "test") |
|
93 |
- dockerCmd(c, "volume", "create", "--name", "soo") |
|
91 |
+ dockerCmd(c, "volume", "create", "aaa") |
|
92 |
+ dockerCmd(c, "volume", "create", "test") |
|
93 |
+ dockerCmd(c, "volume", "create", "soo") |
|
94 | 94 |
|
95 | 95 |
out, _ := dockerCmd(c, "volume", "ls", "--format", "{{.Name}}") |
96 | 96 |
lines := strings.Split(strings.TrimSpace(string(out)), "\n") |
... | ... |
@@ -104,9 +113,9 @@ func (s *DockerSuite) TestVolumeLsFormat(c *check.C) { |
104 | 104 |
} |
105 | 105 |
|
106 | 106 |
func (s *DockerSuite) TestVolumeLsFormatDefaultFormat(c *check.C) { |
107 |
- dockerCmd(c, "volume", "create", "--name", "aaa") |
|
108 |
- dockerCmd(c, "volume", "create", "--name", "test") |
|
109 |
- dockerCmd(c, "volume", "create", "--name", "soo") |
|
107 |
+ dockerCmd(c, "volume", "create", "aaa") |
|
108 |
+ dockerCmd(c, "volume", "create", "test") |
|
109 |
+ dockerCmd(c, "volume", "create", "soo") |
|
110 | 110 |
|
111 | 111 |
config := `{ |
112 | 112 |
"volumesFormat": "{{ .Name }} default" |
... | ... |
@@ -147,9 +156,9 @@ func assertVolList(c *check.C, out string, expectVols []string) { |
147 | 147 |
|
148 | 148 |
func (s *DockerSuite) TestVolumeCliLsFilterDangling(c *check.C) { |
149 | 149 |
prefix, _ := getPrefixAndSlashFromDaemonPlatform() |
150 |
- dockerCmd(c, "volume", "create", "--name", "testnotinuse1") |
|
151 |
- dockerCmd(c, "volume", "create", "--name", "testisinuse1") |
|
152 |
- dockerCmd(c, "volume", "create", "--name", "testisinuse2") |
|
150 |
+ dockerCmd(c, "volume", "create", "testnotinuse1") |
|
151 |
+ dockerCmd(c, "volume", "create", "testisinuse1") |
|
152 |
+ dockerCmd(c, "volume", "create", "testisinuse2") |
|
153 | 153 |
|
154 | 154 |
// Make sure both "created" (but not started), and started |
155 | 155 |
// containers are included in reference counting |
... | ... |
@@ -225,7 +234,7 @@ func (s *DockerSuite) TestVolumeCliRm(c *check.C) { |
225 | 225 |
out, _ := dockerCmd(c, "volume", "create") |
226 | 226 |
id := strings.TrimSpace(out) |
227 | 227 |
|
228 |
- dockerCmd(c, "volume", "create", "--name", "test") |
|
228 |
+ dockerCmd(c, "volume", "create", "test") |
|
229 | 229 |
dockerCmd(c, "volume", "rm", id) |
230 | 230 |
dockerCmd(c, "volume", "rm", "test") |
231 | 231 |
|
... | ... |
@@ -290,7 +299,7 @@ func (s *DockerSuite) TestVolumeCliInspectTmplError(c *check.C) { |
290 | 290 |
func (s *DockerSuite) TestVolumeCliCreateWithOpts(c *check.C) { |
291 | 291 |
testRequires(c, DaemonIsLinux) |
292 | 292 |
|
293 |
- dockerCmd(c, "volume", "create", "-d", "local", "--name", "test", "--opt=type=tmpfs", "--opt=device=tmpfs", "--opt=o=size=1m,uid=1000") |
|
293 |
+ dockerCmd(c, "volume", "create", "-d", "local", "test", "--opt=type=tmpfs", "--opt=device=tmpfs", "--opt=o=size=1m,uid=1000") |
|
294 | 294 |
out, _ := dockerCmd(c, "run", "-v", "test:/foo", "busybox", "mount") |
295 | 295 |
|
296 | 296 |
mounts := strings.Split(out, "\n") |
... | ... |
@@ -315,7 +324,7 @@ func (s *DockerSuite) TestVolumeCliCreateLabel(c *check.C) { |
315 | 315 |
testLabel := "foo" |
316 | 316 |
testValue := "bar" |
317 | 317 |
|
318 |
- out, _, err := dockerCmdWithError("volume", "create", "--label", testLabel+"="+testValue, "--name", testVol) |
|
318 |
+ out, _, err := dockerCmdWithError("volume", "create", "--label", testLabel+"="+testValue, testVol) |
|
319 | 319 |
c.Assert(err, check.IsNil) |
320 | 320 |
|
321 | 321 |
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+testLabel+" }}", testVol) |
... | ... |
@@ -333,7 +342,6 @@ func (s *DockerSuite) TestVolumeCliCreateLabelMultiple(c *check.C) { |
333 | 333 |
args := []string{ |
334 | 334 |
"volume", |
335 | 335 |
"create", |
336 |
- "--name", |
|
337 | 336 |
testVol, |
338 | 337 |
} |
339 | 338 |
|
... | ... |
@@ -352,11 +360,11 @@ func (s *DockerSuite) TestVolumeCliCreateLabelMultiple(c *check.C) { |
352 | 352 |
|
353 | 353 |
func (s *DockerSuite) TestVolumeCliLsFilterLabels(c *check.C) { |
354 | 354 |
testVol1 := "testvolcreatelabel-1" |
355 |
- out, _, err := dockerCmdWithError("volume", "create", "--label", "foo=bar1", "--name", testVol1) |
|
355 |
+ out, _, err := dockerCmdWithError("volume", "create", "--label", "foo=bar1", testVol1) |
|
356 | 356 |
c.Assert(err, check.IsNil) |
357 | 357 |
|
358 | 358 |
testVol2 := "testvolcreatelabel-2" |
359 |
- out, _, err = dockerCmdWithError("volume", "create", "--label", "foo=bar2", "--name", testVol2) |
|
359 |
+ out, _, err = dockerCmdWithError("volume", "create", "--label", "foo=bar2", testVol2) |
|
360 | 360 |
c.Assert(err, check.IsNil) |
361 | 361 |
|
362 | 362 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "label=foo") |
... | ... |
@@ -396,7 +404,7 @@ func (s *DockerSuite) TestVolumeCliRmForce(c *check.C) { |
396 | 396 |
testRequires(c, SameHostDaemon, DaemonIsLinux) |
397 | 397 |
|
398 | 398 |
name := "test" |
399 |
- out, _ := dockerCmd(c, "volume", "create", "--name", name) |
|
399 |
+ out, _ := dockerCmd(c, "volume", "create", name) |
|
400 | 400 |
id := strings.TrimSpace(out) |
401 | 401 |
c.Assert(id, checker.Equals, name) |
402 | 402 |
|
... | ... |
@@ -410,7 +418,7 @@ func (s *DockerSuite) TestVolumeCliRmForce(c *check.C) { |
410 | 410 |
dockerCmd(c, "volume", "rm", "-f", "test") |
411 | 411 |
out, _ = dockerCmd(c, "volume", "ls") |
412 | 412 |
c.Assert(out, checker.Not(checker.Contains), name) |
413 |
- dockerCmd(c, "volume", "create", "--name", "test") |
|
413 |
+ dockerCmd(c, "volume", "create", "test") |
|
414 | 414 |
out, _ = dockerCmd(c, "volume", "ls") |
415 | 415 |
c.Assert(out, checker.Contains, name) |
416 | 416 |
} |