Skip to content

Commit

Permalink
Merge pull request moby#47559 from AkihiroSuda/fix-47436
Browse files Browse the repository at this point in the history
rootless: fix `open /etc/docker/plugins: permission denied`
  • Loading branch information
thaJeztah authored Mar 16, 2024
2 parents 23339a6 + d742659 commit 70e46f2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/plugins/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"strings"
"sync"

"github.com/containerd/containerd/pkg/userns"
"github.com/containerd/log"
"github.com/pkg/errors"
)

Expand Down Expand Up @@ -56,10 +58,16 @@ func (l *LocalRegistry) Scan() ([]string, error) {

for _, p := range l.specsPaths {
dirEntries, err = os.ReadDir(p)
if err != nil && !os.IsNotExist(err) {
if err != nil {
if os.IsNotExist(err) {
continue
}
if os.IsPermission(err) && userns.RunningInUserNS() {
log.L.Debug(err.Error())
continue
}
return nil, errors.Wrap(err, "error reading dir entries")
}

for _, entry := range dirEntries {
if entry.IsDir() {
infos, err := os.ReadDir(filepath.Join(p, entry.Name()))
Expand Down

0 comments on commit 70e46f2

Please sign in to comment.