diff --git a/daemon/mgr/container.go b/daemon/mgr/container.go index 986a7ca18..6c60d0043 100644 --- a/daemon/mgr/container.go +++ b/daemon/mgr/container.go @@ -1467,7 +1467,6 @@ func (mgr *ContainerManager) parseBinds(ctx context.Context, meta *ContainerMeta for _, oldMountPoint := range oldMeta.Mounts { mp := &types.MountPoint{ - Name: oldMountPoint.Name, Source: oldMountPoint.Source, Destination: oldMountPoint.Destination, Driver: oldMountPoint.Driver, @@ -1476,7 +1475,7 @@ func (mgr *ContainerManager) parseBinds(ctx context.Context, meta *ContainerMeta Propagation: oldMountPoint.Propagation, } - if _, exist := meta.Config.Volumes[oldMountPoint.Name]; !exist { + if _, exist := meta.Config.Volumes[oldMountPoint.Name]; len(oldMountPoint.Name) > 0 && !exist { mp.Name = oldMountPoint.Name mp.Source, mp.Driver, err = mgr.bindVolume(ctx, oldMountPoint.Name, meta) if err != nil { diff --git a/test/cli_run_test.go b/test/cli_run_test.go index ed611a773..10798b72d 100644 --- a/test/cli_run_test.go +++ b/test/cli_run_test.go @@ -941,6 +941,7 @@ func (suite *PouchRunSuite) TestRunWithVolumesFrom(c *check.C) { // run container1 command.PouchRun("run", "-d", "-v", volumeName+":/mnt", + "-v", "/tmp:/tmp", "--name", containerName1, busyboxImage, "top").Assert(c, icmd.Success) defer func() { command.PouchRun("rm", "-f", containerName1).Assert(c, icmd.Success)