Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied (os error 13) when writing to file from Dockerfile #317

Open
luPhz opened this issue Oct 26, 2023 · 2 comments
Open

Permission denied (os error 13) when writing to file from Dockerfile #317

luPhz opened this issue Oct 26, 2023 · 2 comments

Comments

@luPhz
Copy link

luPhz commented Oct 26, 2023

I setup a directory like in the example https://github.com/denoland/deno_docker/tree/main/example

the only content of main.ts is
await Deno.writeTextFile("hello.txt", "Hello World");
like in the deno examples.

running this on ubuntu
$ docker build -t app . && docker run -it -v ${PWD}:/app -p 1993:1993 app
lead to the error message

await Deno.writeTextFile("hello.txt", "Hello World");
^
    at async writeFile (ext:deno_fs/30_fs.js:805:7)
    at async file:///app/main.ts:1:1

Removing USER deno from the dockerfile works for the moment. What is going on here?

@irbull
Copy link

irbull commented Nov 21, 2024

Not much to add other than I experienced this too. It's working fine in our production (linux) systems, but on my development machine (mac M1) this is failing to write (new) files. Writing to existing files seems to work ok.

@irbull
Copy link

irbull commented Nov 21, 2024

In my case, the Dockerfile was copying in a directory with the same name as the directory I was trying to create / write to in Deno. The copy operation resulted in different permissions, and it failed to write. Of course, if I didn't user USER deno, then Docker defaults to USER root and this worked. Maybe not related to your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants