mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
skip the volumes mounted when deleting the volumes of container.
This commit is contained in:
parent
3885ef585b
commit
6a693176d6
1 changed files with 6 additions and 2 deletions
|
@ -1104,8 +1104,12 @@ func (srv *Server) ContainerDestroy(name string, removeVolume, removeLink bool)
|
|||
volumes := make(map[string]struct{})
|
||||
// Store all the deleted containers volumes
|
||||
for _, volumeId := range container.Volumes {
|
||||
volumeId = strings.TrimRight(volumeId, "/layer")
|
||||
volumeId = filepath.Base(volumeId)
|
||||
trim_volumeId := strings.TrimSuffix(volumeId, "/layer")
|
||||
// Skip the volumes mounted
|
||||
if trim_volumeId == volumeId {
|
||||
continue
|
||||
}
|
||||
volumeId = filepath.Base(trim_volumeId)
|
||||
volumes[volumeId] = struct{}{}
|
||||
}
|
||||
if err := srv.runtime.Destroy(container); err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue