Skip to content

Commit b71bb87

Browse files
committed
Fix overwriting docker feature flags
Signed-off-by: Evan Lezar <[email protected]>
1 parent cc88c55 commit b71bb87

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pkg/config/engine/docker/docker.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,20 @@ func (c Config) DefaultRuntime() string {
105105

106106
// EnableCDI sets features.cdi to true in the docker config.
107107
func (c *Config) EnableCDI() {
108-
(*c)["features"] = map[string]bool{"cdi": true}
108+
if c == nil {
109+
return
110+
}
111+
config := *c
112+
113+
features, ok := config["features"].(map[string]bool)
114+
if !ok {
115+
features = make(map[string]bool)
116+
}
117+
features["cdi"] = true
118+
119+
config["features"] = features
120+
121+
*c = config
109122
}
110123

111124
// RemoveRuntime removes a runtime from the docker config

0 commit comments

Comments
 (0)