Skip to content

fix: standardize to vscode user across all configurations#438

Merged
nazia-datainn merged 3 commits intodevelopfrom
fix/standardize-vscode-user
Jan 2, 2026
Merged

fix: standardize to vscode user across all configurations#438
nazia-datainn merged 3 commits intodevelopfrom
fix/standardize-vscode-user

Conversation

@MohsinHashmi-DataInn
Copy link
Copy Markdown
Contributor

Summary

Standardizes all devcontainer and Coder configurations to use the vscode non-root user instead of root for improved security and consistency.

Changes

1. Dockerfile (.devcontainer/Dockerfile)

  • Added final USER vscode directive before CMD
  • Ensures container starts as vscode user by default, even without devcontainer.json
  • Critical for Coder deployments which don't use devcontainer.json

2. Coder Template (.coder/template.tf)

  • Updated environment variables:
    • HISTFILE: /root/.../home/vscode/...
    • GIT_CONFIG_GLOBAL: /root/.../home/vscode/...
  • Updated all 11 volume mounts to use /home/vscode/ instead of /root/:
    • .vscode-server/extensions, .m2, .npm (caches)
    • .claude, .gemini, .config/gh, .bash_history_dir, .gitconfig_dir, .ssh, .docker, .kube (user credentials)
  • Removed duplicate .claude.json file mount (now part of .claude/ directory)

Impact

✅ Benefits

  • Security: Non-root principle across all deployment methods
  • Consistency: Same user behavior in local Docker, VS Code devcontainers, and Coder workspaces
  • Simplicity: No permission issues with mounted files
  • Portability: Works identically across platforms

🔧 Fixes

  • Resolves "EISDIR: illegal operation on a directory, open '/root/.claude.json'" error
  • Eliminates permission conflicts between container user and mounted volumes
  • Ensures consistent file ownership across development environments

Testing

Verified across all deployment methods:

  • ✅ Local Docker with docker-compose
  • ✅ VS Code Dev Containers
  • ✅ Coder workspace (tested in template)

Alignment Matrix

Configuration User Env Vars Volume Mounts Status
Dockerfile vscode N/A N/A ✅ Updated
devcontainer.json vscode /home/vscode/ N/A ✅ Already correct
docker-compose.yml N/A N/A /home/vscode/ ✅ Already correct
docker-compose.override.yml N/A /home/vscode/ /home/vscode/ ✅ Already correct
Coder template.tf N/A /home/vscode/ /home/vscode/ ✅ Updated

Migration Notes

For Existing Coder Workspaces

Existing workspaces will need to be recreated to use the new paths:

  1. Update template: coder templates push simpleaccounts-uae
  2. Recreate workspace: coder delete <workspace> then coder create <workspace>

For Local Development

Simply rebuild the devcontainer to apply changes.

🤖 Generated with Claude Code

- Update Dockerfile to set default USER to vscode before CMD
  This ensures container starts as vscode user even without devcontainer.json

- Update Coder template.tf to use /home/vscode/ paths instead of /root/
  - Environment variables: HISTFILE, GIT_CONFIG_GLOBAL
  - All volume mounts: .claude, .gemini, .m2, .npm, .vscode-server, etc.
  - Remove duplicate .claude.json file mount (now part of .claude/ directory)

This aligns all deployment methods (local Docker, devcontainer, Coder) to
consistently use the vscode non-root user for security and consistency.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

MohsinHashmi-DataInn and others added 2 commits January 2, 2026 00:04
Force bash shell instead of PowerShell for the Maven settings copy step
to ensure cross-platform compatibility. PowerShell doesn't support
`mkdir -p` the same way as Unix shells.

Fixes failing Windows matrix test in CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@nazia-datainn nazia-datainn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gtg

@nazia-datainn nazia-datainn merged commit 7ecd87c into develop Jan 2, 2026
24 checks passed
@nazia-datainn nazia-datainn deleted the fix/standardize-vscode-user branch January 2, 2026 05:24
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

Successfully merging this pull request may close these issues.

3 participants