mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-06 05:31:47 +00:00
Set bind driver after volume is created
When using a named volume without --volume-driver, the driver was hardcoded to "local". Even when the volume was already created by some other driver (and visible in `docker volume ls`), the container would store in it's own config that it was the `local` driver. The external driver would work perfecly fine until the daemon is restarted, at which point the `local` driver was assumed because that is as it was set in the container config. Set the bind driver to the driver returned by createVolume. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
@@ -350,3 +350,19 @@ func (s *DockerExternalVolumeSuite) TestStartExternalVolumeDriverRetryNotImmedia
|
||||
c.Assert(s.ec.mounts, check.Equals, 1)
|
||||
c.Assert(s.ec.unmounts, check.Equals, 1)
|
||||
}
|
||||
|
||||
func (s *DockerExternalVolumeSuite) TestStartExternalVolumeDriverBindExternalVolume(c *check.C) {
|
||||
dockerCmd(c, "volume", "create", "-d", "test-external-volume-driver", "--name", "foo")
|
||||
dockerCmd(c, "run", "-d", "--name", "testing", "-v", "foo:/bar", "busybox", "top")
|
||||
|
||||
var mounts []struct {
|
||||
Name string
|
||||
Driver string
|
||||
}
|
||||
out, err := inspectFieldJSON("testing", "Mounts")
|
||||
c.Assert(err, check.IsNil)
|
||||
c.Assert(json.NewDecoder(strings.NewReader(out)).Decode(&mounts), check.IsNil)
|
||||
c.Assert(len(mounts), check.Equals, 1, check.Commentf(out))
|
||||
c.Assert(mounts[0].Name, check.Equals, "foo")
|
||||
c.Assert(mounts[0].Driver, check.Equals, "test-external-volume-driver")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user