devcontainers / templates

Repository for Dev Container Templates that are managed by Dev Container spec maintainers. See https://github.com/devcontainers/template-starter to create your own!
https://containers.dev/templates
MIT License
924 stars 242 forks source link

"Permission Denied Error when Running Non-Root Podman Development Container: mkdir: cannot create directory ‘/root’" #268

Open mimowen opened 2 months ago

mimowen commented 2 months ago

I find an issue with the VSCode Dev Container template image trying to create files in the /root directory within the container using the vscode username. Here's the error I received:

[16535 ms] Exit code 1 [16535 ms] Start: Run in container: test -d '/vscode/vscode-server/bin/linux-x64/ea1445cc7016315d0f5728f8e8b12a45dc0a7286' [16579 ms] [16579 ms] [16579 ms] Start: Run in container: mkdir -p '/root/.vscode-server/bin' && ln -snf '/vscode/vscode-server/bin/linux-x64/ea1445cc7016315d0f5728f8e8b12a45dc0a7286' '/root/.vscode-server/bin/ea1445cc7016315d0f5728f8e8b12a45dc0a7286' [16623 ms] [16623 ms] mkdir: cannot create directory ‘/root’: Permission denied [16623 ms] Exit code 1 [16624 ms] Start: Run: podman rm -f 16650b67a2fdcc48a91885454e657b9caecf1c6511e7c774d8d0526108239cb9 [16627 ms] Command in container failed: mkdir -p '/root/.vscode-server/bin' && ln -snf '/vscode/vscode-server/bin/linux-x64/ea1445cc7016315d0f5728f8e8b12a45dc0a7286' '/root/.vscode-server/bin/ea1445cc7016315d0f5728f8e8b12a45dc0a7286' [16628 ms] mkdir: cannot create directory ‘/root’: Permission denied [16628 ms] Exit code 1

The /root directory has default permissions set to 700 in Ubuntu 22.04.4 LTS, which caused this error.

After modifying the /root directory permissions, I found that the Dev Container extension is able to create the /root/.vscode-server directory within the container. Everything works fine now, and I can happily use the Dev Container extension.

image

So I want to know why this happened ?what caused this?

Environment Information

VSCode Version:

Host:

Podman Version:

Test Docker Templates Image Mirror Address:

samruddhikhandale commented 1 month ago

@gauravsaini04 / @prathameshzarkar9 Can either of you help investigate the issue? thanks!