@@ -8,12 +8,11 @@ FROM rocker/r-apt:bionic
8
8
# Avoid warnings by switching to noninteractive
9
9
ENV DEBIAN_FRONTEND=noninteractive
10
10
11
- # This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
12
- # this user's GID/UID must match your local user UID/GID to avoid permission issues
13
- # with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See
14
- # https://aka.ms/vscode-remote/containers/non-root-user for details.
15
- ARG USERNAME=vscode
16
- ARG USER_UID=1001
11
+ # The r-apt image comes with a base non-root 'docker' user which this Dockerfile
12
+ # gives sudo access. However, for Linux, this user's GID/UID must match your local
13
+ # user UID/GID to avoid permission issues with bind mounts. Update USER_UID / USER_GID
14
+ # if yours is not 1000. See https://aka.ms/vscode-remote/containers/non-root-user.
15
+ ARG USER_UID=1000
17
16
ARG USER_GID=$USER_UID
18
17
19
18
# Configure apt and install packages
@@ -33,13 +32,13 @@ RUN apt-get update \
33
32
&& apt-get update \
34
33
&& apt-get -y install dotnet-runtime-2.1 \
35
34
#
36
- # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
37
- && groupadd --gid $USER_GID $USERNAME \
38
- && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
35
+ # [Optional] Update a non-root user to match UID/GID - see https://aka.ms/vscode-remote/containers/non-root-user.
36
+ && if [ "$USER_GID" != "1000" ]; then groupmod docker --gid $USER_GID; fi \
37
+ && if [ "$USER_UID" != "1000" ]; then usermod --uid $USER_UID docker; fi \
39
38
# [Optional] Add sudo support for the non-root user
40
39
&& apt-get install -y sudo \
41
- && echo $USERNAME ALL=\( root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
42
- && chmod 0440 /etc/sudoers.d/$USERNAME \
40
+ && echo $USERNAME ALL=\( root\) NOPASSWD:ALL > /etc/sudoers.d/docker \
41
+ && chmod 0440 /etc/sudoers.d/docker \
43
42
#
44
43
# Clean up
45
44
&& apt-get autoremove -y \
0 commit comments