Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pkg/opts/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ func WithVolumes(volumeMounts map[string]string) containerd.NewContainerOpts {
defer unix.Unmount(root, 0) // nolint: errcheck

for host, volume := range volumeMounts {
if err := copyExistingContents(filepath.Join(root, volume), host); err != nil {
src := filepath.Join(root, volume)
if _, err := os.Stat(src); err != nil {
if os.IsNotExist(err) {
// Skip copying directory if it does not exist.
continue
}
return errors.Wrap(err, "stat volume in rootfs")
}
if err := copyExistingContents(src, host); err != nil {
return errors.Wrap(err, "taking runtime copy of volume")
}
}
Expand Down