mirror of
https://github.com/docker/cli.git
synced 2026-09-27 17:56:04 -04:00
Merge pull request #22103 from coolljt0725/fix_22093
Fix docker create with duplicate volume failed to remove Upstream-commit: edcc9577bf95c2eeaa15955e7b1c00a18cec7cb6 Component: engine
This commit is contained in:
@@ -65,9 +65,20 @@ func (m mounts) parts(i int) int {
|
||||
// 2. Select the volumes mounted from another containers. Overrides previously configured mount point destination.
|
||||
// 3. Select the bind mounts set by the client. Overrides previously configured mount point destinations.
|
||||
// 4. Cleanup old volumes that are about to be reassigned.
|
||||
func (daemon *Daemon) registerMountPoints(container *container.Container, hostConfig *containertypes.HostConfig) error {
|
||||
func (daemon *Daemon) registerMountPoints(container *container.Container, hostConfig *containertypes.HostConfig) (retErr error) {
|
||||
binds := map[string]bool{}
|
||||
mountPoints := map[string]*volume.MountPoint{}
|
||||
defer func() {
|
||||
// clean up the container mountpoints once return with error
|
||||
if retErr != nil {
|
||||
for _, m := range mountPoints {
|
||||
if m.Volume == nil {
|
||||
continue
|
||||
}
|
||||
daemon.volumes.Dereference(m.Volume, container.ID)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
// 1. Read already configured mount points.
|
||||
for name, point := range container.MountPoints {
|
||||
|
||||
Reference in New Issue
Block a user