From c11de8a3e9f76b2195143c9f56d670630103bd63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20=C5=A0trauch?= Date: Mon, 7 Feb 2022 18:20:22 +0100 Subject: [PATCH] Removing volume directory fix Directory mounted in the container wasn't removed along the container so we ended up with a lot of empty directories on the server. --- containers/tools.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/containers/tools.go b/containers/tools.go index ceca1df..3b398cf 100644 --- a/containers/tools.go +++ b/containers/tools.go @@ -62,7 +62,7 @@ func du(path string) (int, int, error) { return space, inodes, nil } -// Removes content of given directory +// Removes content of given directory and then the directory itself func removeDirectory(dir string) error { d, err := os.Open(dir) if err != nil { @@ -79,6 +79,12 @@ func removeDirectory(dir string) error { return err } } + + err = os.Remove(filepath.Join(dir)) + if err != nil { + return err + } + return nil }