diff options
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r-- | libpod/container_internal.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 33bb35a0b..12d6d5a18 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -1691,13 +1691,6 @@ func (c *Container) mountNamedVolume(v *ContainerNamedVolume, mountpoint string) if vol.state.NeedsCopyUp { logrus.Debugf("Copying up contents from container %s to volume %s", c.ID(), vol.Name()) - // Set NeedsCopyUp to false immediately, so we don't try this - // again when there are already files copied. - vol.state.NeedsCopyUp = false - if err := vol.save(); err != nil { - return nil, err - } - // If the volume is not empty, we should not copy up. volMount := vol.mountPoint() contents, err := ioutil.ReadDir(volMount) @@ -1744,6 +1737,13 @@ func (c *Container) mountNamedVolume(v *ContainerNamedVolume, mountpoint string) return vol, nil } + // Set NeedsCopyUp to false since we are about to do first copy + // Do not copy second time. + vol.state.NeedsCopyUp = false + if err := vol.save(); err != nil { + return nil, err + } + // Buildah Copier accepts a reader, so we'll need a pipe. reader, writer := io.Pipe() defer reader.Close() |