summaryrefslogtreecommitdiff
path: root/oci
diff options
context:
space:
mode:
authorSebastiaan van Stijn <github@gone.nl>2022-10-07 23:57:09 +0200
committerSebastiaan van Stijn <github@gone.nl>2022-11-29 17:02:50 +0100
commit9f3e5eead5accb9fb405398af700d97e830a3b5b (patch)
tree87be15a3273bc4b00d97fdc8674f9d1fe201fc10 /oci
parent73261bb8c77da7c8cc7e090382080e3c11e05be1 (diff)
downloaddocker-9f3e5eead5accb9fb405398af700d97e830a3b5b.tar.gz
pkg/system: deprecate DefaultPathEnv, move to oci
This patch: - Deprecates pkg/system.DefaultPathEnv - Moves the implementation inside oci - Adds TODOs to align the default in the Builder with the one used elsewhere Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'oci')
-rw-r--r--oci/defaults.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/oci/defaults.go b/oci/defaults.go
index b79892ddc2..03afad4c62 100644
--- a/oci/defaults.go
+++ b/oci/defaults.go
@@ -9,6 +9,24 @@ import (
func iPtr(i int64) *int64 { return &i }
+const defaultUnixPathEnv = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
+
+// DefaultPathEnv is unix style list of directories to search for
+// executables. Each directory is separated from the next by a colon
+// ':' character .
+// For Windows containers, an empty string is returned as the default
+// path will be set by the container, and Docker has no context of what the
+// default path should be.
+//
+// TODO(thaJeztah) align Windows default with BuildKit; see https://github.com/moby/buildkit/pull/1747
+// TODO(thaJeztah) use defaults from containerd (but align it with BuildKit; see https://github.com/moby/buildkit/pull/1747)
+func DefaultPathEnv(os string) string {
+ if os == "windows" {
+ return ""
+ }
+ return defaultUnixPathEnv
+}
+
// DefaultSpec returns the default spec used by docker for the current Platform
func DefaultSpec() specs.Spec {
if runtime.GOOS == "windows" {