Skip to content

Commit 252e32e

Browse files
Ton Sharp66Ton99
authored andcommitted
defaults: use user-writable data root on darwin
Signed-off-by: Anton Shapka <anton.shapka@oracle.com>
1 parent cbf6e47 commit 252e32e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/defaults/defaults_darwin.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@
2020

2121
package defaults
2222

23-
import gocni "github.com/containerd/go-cni"
23+
import (
24+
"os"
25+
"path/filepath"
26+
27+
gocni "github.com/containerd/go-cni"
28+
)
2429

2530
const (
2631
AppArmorProfileName = ""
@@ -41,6 +46,9 @@ func CNINetConfPath() string {
4146
}
4247

4348
func DataRoot() string {
49+
if home, err := os.UserHomeDir(); err == nil && home != "" {
50+
return filepath.Join(home, ".local", "share", "nerdctl")
51+
}
4452
return "/var/lib/nerdctl"
4553
}
4654

0 commit comments

Comments
 (0)