Merge pull request #41161 from thaJeztah/fix_volumes_from_status

This commit is contained in:
Brian Goff 2020-06-29 09:36:12 -07:00 committed by GitHub
commit b0a8e75c6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View file

@ -95,12 +95,12 @@ func (daemon *Daemon) registerMountPoints(container *container.Container, hostCo
for _, v := range hostConfig.VolumesFrom {
containerID, mode, err := parser.ParseVolumesFrom(v)
if err != nil {
return err
return errdefs.InvalidParameter(err)
}
c, err := daemon.GetContainer(containerID)
if err != nil {
return err
return errdefs.InvalidParameter(err)
}
for _, m := range c.MountPoints {

View file

@ -621,3 +621,18 @@ func TestCreateDifferentPlatform(t *testing.T) {
assert.Assert(t, client.IsErrNotFound(err), err)
})
}
func TestCreateVolumesFromNonExistingContainer(t *testing.T) {
defer setupTest(t)()
cli := testEnv.APIClient()
_, err := cli.ContainerCreate(
context.Background(),
&container.Config{Image: "busybox"},
&container.HostConfig{VolumesFrom: []string{"nosuchcontainer"}},
nil,
nil,
"",
)
assert.Check(t, errdefs.IsInvalidParameter(err))
}