1
0
mirror of https://github.com/docker/cli.git synced 2026-01-16 20:22:36 +03:00

skip the volumes mounted when deleting the volumes of container.

Upstream-commit: 6a693176d6b2dbf4afd36ebda2aeb9495fdf42bc
Component: engine
This commit is contained in:
Liang-Chi Hsieh
2013-10-31 23:49:30 +08:00
parent cd79a08f60
commit 9f0beed503

View File

@@ -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 {