From 7afee9259bfc5e828cd3e35b29d7b2ce4eb13e01 Mon Sep 17 00:00:00 2001 From: Marat Radchenko Date: Sun, 24 Dec 2023 22:48:12 +0300 Subject: [PATCH] Add support for devfs on macOS --- oci/defaults.go | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/oci/defaults.go b/oci/defaults.go index c3dae8b1099ed..b44d37bfa8410 100644 --- a/oci/defaults.go +++ b/oci/defaults.go @@ -29,10 +29,33 @@ func DefaultPathEnv(os string) string { // DefaultSpec returns the default spec used by docker for the current Platform func DefaultSpec() specs.Spec { - if runtime.GOOS == "windows" { + switch runtime.GOOS { + case "darwin": + return DefaultDarwinSpec() + case "windows": return DefaultWindowsSpec() + default: + return DefaultLinuxSpec() + } +} + +// DefaultWindowsSpec create a default spec for running Darwin containers +func DefaultDarwinSpec() specs.Spec { + return specs.Spec{ + Version: specs.Version, + Windows: &specs.Windows{}, + Process: &specs.Process{}, + Root: &specs.Root{}, + Linux: &specs.Linux{}, + Mounts: []specs.Mount{ + { + Destination: "/dev", + Type: "devfs", + Source: "devfs", + Options: []string{}, + }, + }, } - return DefaultLinuxSpec() } // DefaultWindowsSpec create a default spec for running Windows containers