Mark --volume-driver as experimental
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
This commit is contained in:
parent
7da5a7eb66
commit
4fc37a1ede
5 changed files with 42 additions and 17 deletions
|
@ -142,6 +142,7 @@ Create a container
|
|||
"ExposedPorts": {
|
||||
"22/tcp": {}
|
||||
},
|
||||
VolumeDriver: "local",
|
||||
"HostConfig": {
|
||||
"Binds": ["/tmp:/tmp"],
|
||||
"Links": ["redis3:redis"],
|
||||
|
@ -222,15 +223,15 @@ Json Parameters:
|
|||
container
|
||||
- **ExposedPorts** - An object mapping ports to an empty object in the form of:
|
||||
`"ExposedPorts": { "<port>/<tcp|udp>: {}" }`
|
||||
- **VolumeDriver** - A string value containing the volume driver to use, `local` by default.
|
||||
- **HostConfig**
|
||||
- **Binds** – A list of volume bindings for this container. Each volume
|
||||
binding is a string of the form `container_path` (to create a new
|
||||
volume for the container), `host_path:container_path` (to bind-mount
|
||||
a host path into the container), `host_path:container_path:ro`
|
||||
(to make the bind-mount read-only inside the container), or
|
||||
`volume_plugin/volume_name:container_path` (to provision a
|
||||
volume named `volume_name` from a [volume plugin](/userguide/plugins)
|
||||
named `volume_plugin`).
|
||||
`volume_name:container_path` (to provision a volume named `volume_name`
|
||||
from a [volume plugin](/userguide/plugins)).
|
||||
- **Links** - A list of links for the container. Each link entry should be
|
||||
in the form of `container_name:alias`.
|
||||
- **LxcConf** - LXC specific configurations. These configurations will only
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// +build experimental
|
||||
// +build !windows
|
||||
|
||||
package main
|
||||
|
@ -136,15 +137,3 @@ func (s *ExternalVolumeSuite) TestStartExternalVolumeDriver(c *check.C) {
|
|||
c.Fatalf("External volume mount failed. Output: %s\n", out)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ExternalVolumeSuite) TestStartExternalVolumeNamedDriver(c *check.C) {
|
||||
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")
|
||||
out, stderr, exitCode, err := runCommandWithStdoutStderr(runCmd)
|
||||
if err != nil && exitCode != 0 {
|
||||
c.Fatal(out, stderr, err)
|
||||
}
|
||||
|
||||
if !strings.Contains(out, s.server.URL) {
|
||||
c.Fatalf("External volume mount failed. Output: %s\n", out)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,6 @@ func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe
|
|||
flReadonlyRootfs = cmd.Bool([]string{"-read-only"}, false, "Mount the container's root filesystem as read only")
|
||||
flLoggingDriver = cmd.String([]string{"-log-driver"}, "", "Logging driver for container")
|
||||
flCgroupParent = cmd.String([]string{"-cgroup-parent"}, "", "Optional parent cgroup for the container")
|
||||
flVolumeDriver = cmd.String([]string{"-volume-driver"}, "", "Optional volume driver for the container")
|
||||
)
|
||||
|
||||
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
|
|||
cmd.Var(flUlimits, []string{"-ulimit"}, "Ulimit options")
|
||||
cmd.Var(&flLoggingOpts, []string{"-log-opt"}, "Log driver options")
|
||||
|
||||
expFlags := attachExperimentalFlags(cmd)
|
||||
|
||||
cmd.Require(flag.Min, 1)
|
||||
|
||||
if err := cmd.ParseFlags(args, true); err != nil {
|
||||
|
@ -318,7 +319,6 @@ func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe
|
|||
Entrypoint: entrypoint,
|
||||
WorkingDir: *flWorkingDir,
|
||||
Labels: convertKVStringsToMap(labels),
|
||||
VolumeDriver: *flVolumeDriver,
|
||||
}
|
||||
|
||||
hostConfig := &HostConfig{
|
||||
|
@ -357,6 +357,8 @@ func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe
|
|||
CgroupParent: *flCgroupParent,
|
||||
}
|
||||
|
||||
applyExperimentalFlags(expFlags, config, hostConfig)
|
||||
|
||||
// When allocating stdin in attached mode, close stdin at client disconnect
|
||||
if config.OpenStdin && config.AttachStdin {
|
||||
config.StdinOnce = true
|
||||
|
|
19
runconfig/parse_experimental.go
Normal file
19
runconfig/parse_experimental.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
// +build experimental
|
||||
|
||||
package runconfig
|
||||
|
||||
import flag "github.com/docker/docker/pkg/mflag"
|
||||
|
||||
type experimentalFlags struct {
|
||||
flags map[string]interface{}
|
||||
}
|
||||
|
||||
func attachExperimentalFlags(cmd *flag.FlagSet) *experimentalFlags {
|
||||
flags := make(map[string]interface{})
|
||||
flags["volume-driver"] = cmd.String([]string{"-volume-driver"}, "", "Optional volume driver for the container")
|
||||
return &experimentalFlags{flags: flags}
|
||||
}
|
||||
|
||||
func applyExperimentalFlags(exp *experimentalFlags, config *Config, hostConfig *HostConfig) {
|
||||
config.VolumeDriver = *(exp.flags["volume-driver"]).(*string)
|
||||
}
|
14
runconfig/parse_stub.go
Normal file
14
runconfig/parse_stub.go
Normal file
|
@ -0,0 +1,14 @@
|
|||
// +build !experimental
|
||||
|
||||
package runconfig
|
||||
|
||||
import flag "github.com/docker/docker/pkg/mflag"
|
||||
|
||||
type experimentalFlags struct{}
|
||||
|
||||
func attachExperimentalFlags(cmd *flag.FlagSet) *experimentalFlags {
|
||||
return nil
|
||||
}
|
||||
|
||||
func applyExperimentalFlags(flags *experimentalFlags, config *Config, hostConfig *HostConfig) {
|
||||
}
|
Loading…
Add table
Reference in a new issue