NOTE: Most of the contents of this repository have been migrated to the new devcontainers GitHub org (https://github.com/devcontainers). See https://github.com/devcontainers/template-starter and https://github.com/devcontainers/feature-starter for information on creating your own!
Check the UID of the User within the devcontainer via id. If switching to the non-root user via USER ${NON_ROOT_USER}, you should get the UID of the user from the host. If switching via USER ${NON_ROOT_UID}, the UID will remain at 1000.
Steps to Reproduce:
ARG NON_ROOT_USER=non_root_user ARG NON_ROOT_UID=1000 ARG NON_ROOT_GID=100
USER root
Create non-root user
RUN useradd \ --no-log-init \ --no-user-group \ --shell /bin/bash \ --create-home \ --uid ${NON_ROOT_UID} \ --gid ${NON_ROOT_GID} \ ${NON_ROOT_USER}
This works:
USER ${NON_ROOT_USER}
This does not work:
USER ${NON_ROOT_UID}
id
. If switching to the non-root user viaUSER ${NON_ROOT_USER}
, you should get the UID of the user from the host. If switching viaUSER ${NON_ROOT_UID}
, the UID will remain at 1000.