summaryrefslogtreecommitdiff
path: root/libpod/in_memory_state.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/in_memory_state.go')
-rw-r--r--libpod/in_memory_state.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/libpod/in_memory_state.go b/libpod/in_memory_state.go
index a38e080b7..386ace5b6 100644
--- a/libpod/in_memory_state.go
+++ b/libpod/in_memory_state.go
@@ -126,9 +126,12 @@ func (s *InMemoryState) AddContainer(ctr *Container) error {
// But in-memory state is intended purely for testing and not production
// use, so this should be fine.
depCtrs := ctr.Dependencies()
- for _, depCtr := range depCtrs {
- if _, ok := s.containers[depCtr]; !ok {
- return errors.Wrapf(ErrNoSuchCtr, "cannot depend on nonexistent container %s", depCtr)
+ for _, depID := range depCtrs {
+ depCtr, ok := s.containers[depID]
+ if !ok {
+ return errors.Wrapf(ErrNoSuchCtr, "cannot depend on nonexistent container %s", depID)
+ } else if depCtr.config.Pod != "" {
+ return errors.Wrapf(ErrInvalidArg, "cannot depend on container in a pod if not part of same pod")
}
}