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 container as different user fails with permission denied error

See original GitHub issue
  • Version: coderaiser/cloudcmd:10.4.1
  • Node Version: v10.6.0
  • OS: Linux infosak 4.4.0-127-generic #153-Ubuntu SMP Sat May 19 10:58:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Browser name/version: Chrome/67
  • Used Command Line Parameters: docker run --name cloudcmd -u 10000 -p 8000:8000 -v /var/www:/var/www -v /var/log:/var/log coderaiser/cloudcmd:10.4.1
  • Changed Config: Using different user to run container

When I use different user other than default root to launch a container I am unable to get it started as it tries to switch to /root directory and gets permission denied.

docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "chdir to cwd (\"/root\") set in config.json failed: permission denied": unknown.

I have a use case where I allow access to file which has sensitive information only to web user www-data where other users cannot view that file, hence it makes sense to run the container as different user.

In the Dockerfile I see WORKDIR is changed to /root. Removing the line should fix this problem.

https://github.com/coderaiser/cloudcmd/blob/4c453e22be1b8860fc8f43caf432d978cdd3e936/Dockerfile#L16

Please kindly check and do the needful.

Thank you

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
coderaisercommented, Nov 22, 2018

The thing is root is default user in docker images used by Cloud Commander, and WORKDIR was set to root as a home directory of root user, as shown in example:

docker run -t --rm -v ~:/root -v /:/mnt/fs -w=/root -p 8000:8000 coderaiser/cloudcmd

To have ability to see home directory files straight after run. Anyways there is an workdir option that can be used to set any workdir you want.

0reactions
coderaisercommented, Nov 22, 2018

Fixed with d16e345 🔨. Landed in v11.8.2 🎉.

Is it works for you?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Container permission denied: How to diagnose this error
1. Confirm the problem is security ... Use the --privileged flag to ensure it is a security problem. Sometimes the problem is related...
Read more >
How to Fix Docker Permission Denied? - phoenixNAP
Docker outputs the "Permission Denied" error when a non-root user without sufficient privileges attempts to execute a Docker command.
Read more >
Troubleshooting Docker Permission Denied Problems
If you're running into errors like docker permission denied, use this tutorial as your troubleshooting guide!
Read more >
How to Fix Docker Permission Denied Error on Ubuntu
Fix 1: Run all the docker commands with sudo​​ If you have sudo access on your system, you may run each docker command...
Read more >
How to fix docker: Got permission denied issue - Stack Overflow
If you want to run docker as non-root user then you need to add it to the docker group. Create the docker group...
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