diff options
Diffstat (limited to 'libpod/container.go')
-rw-r--r-- | libpod/container.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libpod/container.go b/libpod/container.go index 965ac67fe..cbfa09538 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -205,6 +205,8 @@ type ContainerConfig struct { // Namespace Config // IDs of container to share namespaces with // NetNsCtr conflicts with the CreateNetNS bool + // These containers are considered dependencies of the given container + // They must be started before the given container is started IPCNsCtr string `json:"ipcNsCtr,omitempty"` MountNsCtr string `json:"mountNsCtr,omitempty"` NetNsCtr string `json:"netNsCtr,omitempty"` @@ -213,6 +215,10 @@ type ContainerConfig struct { UTSNsCtr string `json:"utsNsCtr,omitempty"` CgroupNsCtr string `json:"cgroupNsCtr,omitempty"` + // IDs of dependency containers + // These containers must be started before this container is started + Dependencies []string + // Network Config // CreateNetNS indicates that libpod should create and configure a new // network namespace for the container @@ -363,6 +369,8 @@ func (c *Container) User() string { func (c *Container) Dependencies() []string { // Collect in a map first to remove dupes dependsCtrs := map[string]bool{} + + // First add all namespace containers if c.config.IPCNsCtr != "" { dependsCtrs[c.config.IPCNsCtr] = true } @@ -385,6 +393,11 @@ func (c *Container) Dependencies() []string { dependsCtrs[c.config.CgroupNsCtr] = true } + // Add all generic dependencies + for _, id := range c.config.Dependencies { + dependsCtrs[id] = true + } + if len(dependsCtrs) == 0 { return []string{} } |