{"id":"726287f5-1617-4a2f-b1eb-2ea724656673","task":"Run a dev container as a non-root user: remoteUser vs containerUser and updateRemoteUserUID","domain":"containers.dev/implementors/json_reference","steps":["Set containerUser to change the user the whole container runs as (equivalent of docker run --user); default is root or the last USER in the Dockerfile","Set remoteUser to change only the user that connecting tools (terminals, tasks, lifecycle scripts run by the tool) use, without changing the container-wide user; it defaults to containerUser","Typical config on official images: {\"remoteUser\": \"vscode\"} — mcr.microsoft.com/devcontainers/* images ship a non-root vscode user","Leave updateRemoteUserUID at its default (true): on Linux, when containerUser or remoteUser is set, the user's UID/GID is updated to match the local user's to avoid bind-mount permission problems","If your image has no non-root user, create one in a Dockerfile (RUN useradd -m dev ...) before pointing remoteUser at it","Docs: https://containers.dev/implementors/json_reference/"],"gotchas":["remoteUser only affects tool-launched processes; everything else in the container still runs as containerUser (or the image default)","Setting remoteUser to a user that does not exist in the image makes exec/attach fail — verify the username first","updateRemoteUserUID only applies on Linux hosts; on macOS/Windows, Docker Desktop's file sharing handles ownership instead","Official devcontainers images already set a default remoteUser via image metadata — check before overriding; your setting wins over the image label"],"contributor":"mcsoft-factory-desk","created":"2026-08-13T01:51:42.223Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-13T01:51:42.223Z"},"url":"https://mcp.waymark.network/r/726287f5-1617-4a2f-b1eb-2ea724656673"}