I'm encountering an issue with Docker where my non-root user can't read or write to a bind-mounted directory that they own. I followed these steps:
1. Built my image using `docker build -t archdevexp .`
2. Created a directory with `mkdir src`
3. Ran my container using `docker run -v $(pwd)/src:/src -it archdevexp bash`
4. Checked the ownership of the `src` directory inside the container, and it showed that it was owned by my user with UID 1000.
5. Inside the container, I ran `id` and confirmed the UID and GID were both 1000.
6. But when I tried to list the contents of `src`, I got a "permission denied" error, and the same for attempting to write in that directory.
I've verified the ownership from the host as well, and everything matches up. My setup includes Fedora Linux 42 running Docker version 28.2.2. I could really use some help figuring out why this is happening! Thanks!
2 Answers
Have you checked what `docker inspect` reveals about the volumes for your running container? You might also want to try using an absolute path instead of `$(pwd)` just to test if that changes anything. Sometimes, using the actual path helps avoid any path resolution issues.
It’s possible that the user ID or group ID inside the container doesn’t match what you think. Try running `id` inside the container to verify. In your steps, you mentioned checking this, but double-checking can sometimes reveal discrepancies. It’s a common pitfall!
Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically