Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

[release/1.4] Use fs.RootPath when mounting volumes #1655

Merged
merged 1 commit into from
Mar 2, 2022
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
6 changes: 4 additions & 2 deletions pkg/containerd/opts/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"io/ioutil"
"os"
"path/filepath"

"github.com/containerd/containerd"
"github.com/containerd/containerd/containers"
Expand Down Expand Up @@ -88,7 +87,10 @@ func WithVolumes(volumeMounts map[string]string) containerd.NewContainerOpts {
}()

for host, volume := range volumeMounts {
src := filepath.Join(root, volume)
src, err := fs.RootPath(root, volume)
if err != nil {
return errors.Wrapf(err, "rootpath on root %s, volume %s", root, volume)
}
if _, err := os.Stat(src); err != nil {
if os.IsNotExist(err) {
// Skip copying directory if it does not exist.
Expand Down