MCPcopy Index your code
hub / github.com/docker/docker-agent / SetRoot

Function SetRoot

pkg/paths/paths.go:57–67  ·  view source on GitHub ↗

SetRoot re-homes all docker-agent state under one directory: data, config, and cache land in the "data", "config", and "cache" subdirectories of root. It is the one-call override for embedders that must keep their embedded agent's state isolated from a docker-agent installation on the same machine (

(root string)

Source from the content-addressed store, hash-verified

55// Sandboxes homes everything under ~/.sbx/gordon). An empty root restores
56// the per-directory defaults.
57func SetRoot(root string) {
58 if root == "" {
59 SetDataDir("")
60 SetConfigDir("")
61 SetCacheDir("")
62 return
63 }
64 SetDataDir(filepath.Join(root, "data"))
65 SetConfigDir(filepath.Join(root, "config"))
66 SetCacheDir(filepath.Join(root, "cache"))
67}
68
69// GetCacheDir returns the user's cache directory for docker agent.
70//

Callers 1

TestSetRootFunction · 0.92

Calls 3

SetDataDirFunction · 0.85
SetConfigDirFunction · 0.85
SetCacheDirFunction · 0.85

Tested by 1

TestSetRootFunction · 0.74