-
Notifications
You must be signed in to change notification settings - Fork 18.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix docker create with duplicate volume failed to remove #22103
Conversation
WindowsTP5 failure on TestRunNoDupVolume appears legitimate. Probably because volumes are case insensitive on Windows. https://github.com/docker/docker/blob/master/volume/volume_windows.go#L95 |
@jhowardmsft beat me to it :D https://jenkins.dockerproject.org/job/Docker-PRs-WoW-TP5/733/console
|
binds := map[string]bool{} | ||
mountPoints := map[string]*volume.MountPoint{} | ||
defer func() { | ||
// clean up the container mountpoints once return with error | ||
if retErr != nil && len(mountPoints) != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to check len
on mountPoints
since it's a range
I also think this may be too deep in the stack. I'd expect the caller to unwind this on error (and use https://github.com/docker/docker/blob/master/daemon/mounts.go#L20)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpuguy83 if registerMountPoints
returns error, the mountpoints which has been registered in registerMountPoints
would not in container.MountPoint
, the caller unwind this on error in https://github.com/docker/docker/blob/master/daemon/create.go#L107 based on container.MountPoint
yup, len
is duplicate here
Oh, looks like Windows is failing;
|
ping @coolljt0725 |
@LK4D4 @thaJeztah really sorry for the late response, it's very busy these days and miss the github notes. updated. |
Signed-off-by: Lei Jitang <leijitang@huawei.com>
tested this and works for me LGTM ping @vdemeester @runcom PTAL |
LGTM |
LGTM 🐸 |
cherry-pick from moby#22103 fix DTS2017070404731 Signed-off-by: Lei Jitang <leijitang@huawei.com> (cherry picked from commit 5e5e1d7)
Fix docker create with duplicate volume failed to remove cherry-pick from moby#22103 fix DTS2017070404731 Signed-off-by: Lei Jitang <leijitang@huawei.com> (cherry picked from commit 5e5e1d7) See merge request docker/docker!645
*- What I did
fix #22093
- How I did it
During the
registerMountPoints
on container creation, it could be some volumes registersuccessfully but some failed, this will cause the container failed but with some volumes has
reference to this container, and these volume can't be remove.
The fix is to remove the mountpoints once
registerMountPoints
return failed.- How to verify it
see #22093
- A picture of a cute animal (not mandatory but encouraged)