-
Notifications
You must be signed in to change notification settings - Fork 18.7k
/
reload_unix.go
54 lines (45 loc) · 1.39 KB
/
reload_unix.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//go:build linux || freebsd
package daemon // import "github.com/docker/docker/daemon"
import (
"bytes"
"strconv"
"github.com/docker/docker/daemon/config"
)
// reloadPlatform updates configuration with platform specific options
// and updates the passed attributes
func (daemon *Daemon) reloadPlatform(txn *reloadTxn, newCfg *configStore, conf *config.Config, attributes map[string]string) error {
if conf.DefaultRuntime != "" {
newCfg.DefaultRuntime = conf.DefaultRuntime
}
if conf.IsValueSet("runtimes") {
newCfg.Config.Runtimes = conf.Runtimes
}
var err error
newCfg.Runtimes, err = setupRuntimes(&newCfg.Config)
if err != nil {
return err
}
if conf.IsValueSet("default-shm-size") {
newCfg.ShmSize = conf.ShmSize
}
if conf.CgroupNamespaceMode != "" {
newCfg.CgroupNamespaceMode = conf.CgroupNamespaceMode
}
if conf.IpcMode != "" {
newCfg.IpcMode = conf.IpcMode
}
// Update attributes
var runtimeList bytes.Buffer
for name, rt := range newCfg.Config.Runtimes {
if runtimeList.Len() > 0 {
runtimeList.WriteRune(' ')
}
runtimeList.WriteString(name + ":" + rt.Path)
}
attributes["runtimes"] = runtimeList.String()
attributes["default-runtime"] = newCfg.DefaultRuntime
attributes["default-shm-size"] = strconv.FormatInt(int64(newCfg.ShmSize), 10)
attributes["default-ipc-mode"] = newCfg.IpcMode
attributes["default-cgroupns-mode"] = newCfg.CgroupNamespaceMode
return nil
}