From c92b4705d147ee9626ea9c46862b5c1c79884e95 Mon Sep 17 00:00:00 2001 From: Ashley Cui Date: Fri, 9 Dec 2022 15:25:41 -0500 Subject: [PATCH] Add to default machine volumes for MacOS On MacOS, mount /Users, /private/, /var/folders by default for better docker compat. The homedir on MacOS is /Users/, so that will be mounted automatically anyway with this change. Docker also mounts /Volumes and /tmp, /Volumes fails with a Too many levels of symbolic links, as Volumes on Mac is just a symlink to / which seems like a bad idea to mount anyway. /tmp fails because the Podman machine uses the tmp directory inside the machine and writes content to it on boot, causing the mount to fail. However, on Mac, /tmp is symlinked to /private/tmp anyway, so those files are accessible from there. Signed-off-by: Ashley Cui --- common/docs/containers.conf.5.md | 2 ++ common/pkg/config/default_darwin.go | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/common/docs/containers.conf.5.md b/common/docs/containers.conf.5.md index 4358e8f9f5..dcea3b7b0f 100644 --- a/common/docs/containers.conf.5.md +++ b/common/docs/containers.conf.5.md @@ -745,6 +745,8 @@ Environment variables like $HOME as well as complete paths are supported for the source and destination. An optional third field `:ro` can be used to tell the container engines to mount the volume readonly. +On Mac, the default volumes are: `"/Users:/Users", "/private:/private", "/var/folders:/var/folders"` + # FILES **containers.conf** diff --git a/common/pkg/config/default_darwin.go b/common/pkg/config/default_darwin.go index 5d857df4f2..7557666209 100644 --- a/common/pkg/config/default_darwin.go +++ b/common/pkg/config/default_darwin.go @@ -14,5 +14,9 @@ func getLibpodTmpDir() string { // getDefaultMachineVolumes returns default mounted volumes (possibly with env vars, which will be expanded) func getDefaultMachineVolumes() []string { - return []string{"$HOME:$HOME"} + return []string{ + "/Users:/Users", + "/private:/private", + "/var/folders:/var/folders", + } }