question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running with Docker/Podman: Permission Denied

See original GitHub issue

When I run the Docker image with Docker or Podman I get the following error

› podman run -it -v "$(pwd)":/data:z minlag/mermaid-cli -i /data/diagram.mmd
node:fs:582
  handleErrorFromBinding(ctx);
  ^

Error: EACCES: permission denied, open '/data/diagram.mmd.svg'
    at Object.openSync (node:fs:582:3)
    at Object.writeFileSync (node:fs:2143:35)
    at /home/mermaidcli/node_modules/@mermaid-js/mermaid-cli/index.bundle.js:169:10
    at Generator.next (<anonymous>)
    at step (/home/mermaidcli/node_modules/@mermaid-js/mermaid-cli/index.bundle.js:4:191)
    at /home/mermaidcli/node_modules/@mermaid-js/mermaid-cli/index.bundle.js:4:361
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/data/diagram.mmd.svg'
}

How can I run the CLI without root?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MindaugasLaganeckascommented, Oct 12, 2021

I will update the Known issues in README and close this issue. Please, reopen if you disagree.

1reaction
chebrocommented, Oct 3, 2021

@MindaugasLaganeckas i could replicate the issue on ubuntu, docker uses the host file permissions when using bind mounts so the (host) data directory doesn’t provide write access to the docker (mermaidcli) user.

i see two possible solutions to this (without modifying the dockerfile),

  1. pass -u $UID at runtime. (as suggested by @fconil )
  2. modify the permissions for the data directory to 777 that way user groups outside of the host user can have write access to it (but this is a security risk).
Read more comments on GitHub >

github_iconTop Results From Across the Web

Container permission denied: How to diagnose this error
Rootless Podman uses the user namespace, which causes some security issues and can cause permission to be denied. You can diagnose this by ......
Read more >
Permission denied when trying to use the /var/run/docker.sock ...
Means that you don't have podman-docker package installed in podman machine and as a result podman doesn't listen on the socket. podman machine ......
Read more >
Permission denied trying to use rootless Podman + docker ...
To use the leaked socket in the container, you need to run podman run with the command-line option --security-opt label=disable . $ systemctl...
Read more >
Permission denied running a container with --user and named ...
I can resolve this issue by running podman inspect alp-pvc and then podman unshare on the named volume path, but that can't be...
Read more >
How to Fix Docker Permission Denied? - phoenixNAP
Running a privileged container should eliminate the "Permission Denied" error. 2. Find the container you want to inspect and copy its ID.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found