From 6b5666b659a590e8057a1272632f2f272f14c583 Mon Sep 17 00:00:00 2001 From: Kunal Kushwaha Date: Wed, 12 Dec 2018 11:26:32 +0900 Subject: condition fixed for adding volume to boltdb. Signed-off-by: Kunal Kushwaha --- libpod/boltdb_state_internal.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libpod') diff --git a/libpod/boltdb_state_internal.go b/libpod/boltdb_state_internal.go index 0970f4d41..06f8dcb24 100644 --- a/libpod/boltdb_state_internal.go +++ b/libpod/boltdb_state_internal.go @@ -565,10 +565,12 @@ func (s *BoltState) addContainer(ctr *Container, pod *Pod) error { } // Add container to volume dependencies bucket if container is using a named volume + if ctr.runtime.config.VolumePath == "" { + return nil + } for _, vol := range ctr.config.Spec.Mounts { if strings.Contains(vol.Source, ctr.runtime.config.VolumePath) { volName := strings.Split(vol.Source[len(ctr.runtime.config.VolumePath)+1:], "/")[0] - volDB := volBkt.Bucket([]byte(volName)) if volDB == nil { return errors.Wrapf(ErrNoSuchVolume, "no volume with name %s found in database", volName) -- cgit v1.2.3-54-g00ecf