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)
| 55 | // Sandboxes homes everything under ~/.sbx/gordon). An empty root restores |
| 56 | // the per-directory defaults. |
| 57 | func 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 | // |