Skip to content

Commit fd138c2

Browse files
committed
Give the possibilty to set the group id of the user in the container
1 parent e362c7c commit fd138c2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ ARG WILDFLY_VERSION=15.0.1
2121
ARG JAVA_VERSION=8
2222

2323
# Because the source code is shared between the host and the container, it is required the identifier
24-
# of the owner is the same between this two environments. By default, it is set at 1000.
24+
# of the owner and of its group are the same between this two environments. By default, they are both set at 1000.
25+
# The user in the Docker container is also in the group users (id 100 by default)
2526
ARG USER_ID=1000
27+
ARG GROUP_ID=1000
2628

2729
COPY src/maven-deps.zip /tmp/
2830

@@ -48,7 +50,8 @@ RUN apt-get update && apt-get install -y \
4850
gpgv \
4951
&& rm -rf /var/lib/apt/lists/* \
5052
&& update-ca-certificates -f \
51-
&& useradd -g users -u ${USER_ID} -d /home/silveruser -ms /bin/bash silveruser \
53+
&& groupadd -g ${GROUP_ID} silveruser \
54+
&& useradd -u ${USER_ID} -g ${GROUP_ID} -G users -d /home/silveruser -s /bin/bash -m silveruser \
5255
&& mkdir -p /usr/share/maven /usr/share/maven/ref \
5356
&& curl -fsSL -o /tmp/apache-maven.tar.gz https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
5457
&& echo "${MAVEN_SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \

0 commit comments

Comments
 (0)