nix-community / docker-nixpkgs

docker images from nixpkgs [maintainer=@zimbatm]
https://hub.docker.com/u/nixpkgs
MIT License
185 stars 36 forks source link

"getDirectoryContents:openDirStream: permission denied" in custom image #39

Closed aidalgol closed 2 years ago

aidalgol commented 2 years ago

I have defined an image for nix-linter following the existing images' examples,

{ buildCLIImage
, nix-linter
}:
buildCLIImage {
  drv = nix-linter;
}

and when I try to run it, I get a "permission denied" error:

$ podman run --rm localhost/nix-linter-0.2.0.3:rfj89prik95nb35nrpsrr1cf5ik8323i nix-linter --recursive .
nix-linter: /proc/tty/driver: getDirectoryContents:openDirStream: permission denied (Permission denied)

Other images from this repository run fine under podman, so I don't think it's a podman issue.

zimbatm commented 2 years ago

It looks like nix-linter is traversing the whole filesystem and trying to open the /proc/tty/driver file and failing.

I think what you wanted to do is not lint the content of the container, but the content of the current folder. If podman works like docker it would look like this:

$ podman run -v "$PWD:/src" --rm localhost/nix-linter-0.2.0.3:rfj89prik95nb35nrpsrr1cf5ik8323i nix-linter --recursive /src
aidalgol commented 2 years ago

Ah, of course. That was the problem. Thank you!