Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
| ... | ... |
@@ -142,6 +142,7 @@ Create a container |
| 142 | 142 |
"ExposedPorts": {
|
| 143 | 143 |
"22/tcp": {}
|
| 144 | 144 |
}, |
| 145 |
+ VolumeDriver: "local", |
|
| 145 | 146 |
"HostConfig": {
|
| 146 | 147 |
"Binds": ["/tmp:/tmp"], |
| 147 | 148 |
"Links": ["redis3:redis"], |
| ... | ... |
@@ -222,15 +223,15 @@ Json Parameters: |
| 222 | 222 |
container |
| 223 | 223 |
- **ExposedPorts** - An object mapping ports to an empty object in the form of: |
| 224 | 224 |
`"ExposedPorts": { "<port>/<tcp|udp>: {}" }`
|
| 225 |
+- **VolumeDriver** - A string value containing the volume driver to use, `local` by default. |
|
| 225 | 226 |
- **HostConfig** |
| 226 | 227 |
- **Binds** – A list of volume bindings for this container. Each volume |
| 227 | 228 |
binding is a string of the form `container_path` (to create a new |
| 228 | 229 |
volume for the container), `host_path:container_path` (to bind-mount |
| 229 | 230 |
a host path into the container), `host_path:container_path:ro` |
| 230 | 231 |
(to make the bind-mount read-only inside the container), or |
| 231 |
- `volume_plugin/volume_name:container_path` (to provision a |
|
| 232 |
- volume named `volume_name` from a [volume plugin](/userguide/plugins) |
|
| 233 |
- named `volume_plugin`). |
|
| 232 |
+ `volume_name:container_path` (to provision a volume named `volume_name` |
|
| 233 |
+ from a [volume plugin](/userguide/plugins)). |
|
| 234 | 234 |
- **Links** - A list of links for the container. Each link entry should be |
| 235 | 235 |
in the form of `container_name:alias`. |
| 236 | 236 |
- **LxcConf** - LXC specific configurations. These configurations will only |
| ... | ... |
@@ -1,3 +1,4 @@ |
| 1 |
+// +build experimental |
|
| 1 | 2 |
// +build !windows |
| 2 | 3 |
|
| 3 | 4 |
package main |
| ... | ... |
@@ -136,15 +137,3 @@ func (s *ExternalVolumeSuite) TestStartExternalVolumeDriver(c *check.C) {
|
| 136 | 136 |
c.Fatalf("External volume mount failed. Output: %s\n", out)
|
| 137 | 137 |
} |
| 138 | 138 |
} |
| 139 |
- |
|
| 140 |
-func (s *ExternalVolumeSuite) TestStartExternalVolumeNamedDriver(c *check.C) {
|
|
| 141 |
- runCmd := exec.Command(dockerBinary, "run", "--name", "test-data", "-v", "test-external-volume-driver/volume-1:/tmp/external-volume-test", "busybox:latest", "cat", "/tmp/external-volume-test/test") |
|
| 142 |
- out, stderr, exitCode, err := runCommandWithStdoutStderr(runCmd) |
|
| 143 |
- if err != nil && exitCode != 0 {
|
|
| 144 |
- c.Fatal(out, stderr, err) |
|
| 145 |
- } |
|
| 146 |
- |
|
| 147 |
- if !strings.Contains(out, s.server.URL) {
|
|
| 148 |
- c.Fatalf("External volume mount failed. Output: %s\n", out)
|
|
| 149 |
- } |
|
| 150 |
-} |
| ... | ... |
@@ -77,7 +77,6 @@ func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe |
| 77 | 77 |
flReadonlyRootfs = cmd.Bool([]string{"-read-only"}, false, "Mount the container's root filesystem as read only")
|
| 78 | 78 |
flLoggingDriver = cmd.String([]string{"-log-driver"}, "", "Logging driver for container")
|
| 79 | 79 |
flCgroupParent = cmd.String([]string{"-cgroup-parent"}, "", "Optional parent cgroup for the container")
|
| 80 |
- flVolumeDriver = cmd.String([]string{"-volume-driver"}, "", "Optional volume driver for the container")
|
|
| 81 | 80 |
) |
| 82 | 81 |
|
| 83 | 82 |
cmd.Var(&flAttach, []string{"a", "-attach"}, "Attach to STDIN, STDOUT or STDERR")
|
| ... | ... |
@@ -101,6 +100,8 @@ func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe |
| 101 | 101 |
cmd.Var(flUlimits, []string{"-ulimit"}, "Ulimit options")
|
| 102 | 102 |
cmd.Var(&flLoggingOpts, []string{"-log-opt"}, "Log driver options")
|
| 103 | 103 |
|
| 104 |
+ expFlags := attachExperimentalFlags(cmd) |
|
| 105 |
+ |
|
| 104 | 106 |
cmd.Require(flag.Min, 1) |
| 105 | 107 |
|
| 106 | 108 |
if err := cmd.ParseFlags(args, true); err != nil {
|
| ... | ... |
@@ -318,7 +319,6 @@ func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe |
| 318 | 318 |
Entrypoint: entrypoint, |
| 319 | 319 |
WorkingDir: *flWorkingDir, |
| 320 | 320 |
Labels: convertKVStringsToMap(labels), |
| 321 |
- VolumeDriver: *flVolumeDriver, |
|
| 322 | 321 |
} |
| 323 | 322 |
|
| 324 | 323 |
hostConfig := &HostConfig{
|
| ... | ... |
@@ -357,6 +357,8 @@ func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe |
| 357 | 357 |
CgroupParent: *flCgroupParent, |
| 358 | 358 |
} |
| 359 | 359 |
|
| 360 |
+ applyExperimentalFlags(expFlags, config, hostConfig) |
|
| 361 |
+ |
|
| 360 | 362 |
// When allocating stdin in attached mode, close stdin at client disconnect |
| 361 | 363 |
if config.OpenStdin && config.AttachStdin {
|
| 362 | 364 |
config.StdinOnce = true |
| 363 | 365 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,19 @@ |
| 0 |
+// +build experimental |
|
| 1 |
+ |
|
| 2 |
+package runconfig |
|
| 3 |
+ |
|
| 4 |
+import flag "github.com/docker/docker/pkg/mflag" |
|
| 5 |
+ |
|
| 6 |
+type experimentalFlags struct {
|
|
| 7 |
+ flags map[string]interface{}
|
|
| 8 |
+} |
|
| 9 |
+ |
|
| 10 |
+func attachExperimentalFlags(cmd *flag.FlagSet) *experimentalFlags {
|
|
| 11 |
+ flags := make(map[string]interface{})
|
|
| 12 |
+ flags["volume-driver"] = cmd.String([]string{"-volume-driver"}, "", "Optional volume driver for the container")
|
|
| 13 |
+ return &experimentalFlags{flags: flags}
|
|
| 14 |
+} |
|
| 15 |
+ |
|
| 16 |
+func applyExperimentalFlags(exp *experimentalFlags, config *Config, hostConfig *HostConfig) {
|
|
| 17 |
+ config.VolumeDriver = *(exp.flags["volume-driver"]).(*string) |
|
| 18 |
+} |
| 0 | 19 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,14 @@ |
| 0 |
+// +build !experimental |
|
| 1 |
+ |
|
| 2 |
+package runconfig |
|
| 3 |
+ |
|
| 4 |
+import flag "github.com/docker/docker/pkg/mflag" |
|
| 5 |
+ |
|
| 6 |
+type experimentalFlags struct{}
|
|
| 7 |
+ |
|
| 8 |
+func attachExperimentalFlags(cmd *flag.FlagSet) *experimentalFlags {
|
|
| 9 |
+ return nil |
|
| 10 |
+} |
|
| 11 |
+ |
|
| 12 |
+func applyExperimentalFlags(flags *experimentalFlags, config *Config, hostConfig *HostConfig) {
|
|
| 13 |
+} |