mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #23535 from dmcgowan/cleanup-symlinks-overlay2
Remove symlinks on layer removal for overlay2
This commit is contained in:
commit
8a6cb9c19f
1 changed files with 9 additions and 1 deletions
|
@ -340,7 +340,15 @@ func (d *Driver) getLowerDirs(id string) ([]string, error) {
|
|||
|
||||
// Remove cleans the directories that are created for this id.
|
||||
func (d *Driver) Remove(id string) error {
|
||||
if err := os.RemoveAll(d.dir(id)); err != nil && !os.IsNotExist(err) {
|
||||
dir := d.dir(id)
|
||||
lid, err := ioutil.ReadFile(path.Join(dir, "link"))
|
||||
if err == nil {
|
||||
if err := os.RemoveAll(path.Join(d.home, linkDir, string(lid))); err != nil {
|
||||
logrus.Debugf("Failed to remove link: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := os.RemoveAll(dir); err != nil && !os.IsNotExist(err) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue