Skip to content

Commit 42778d9

Browse files
authored
Use a numeric USER instruction in Dockerfiles (#1082)
1 parent bba2ca8 commit 42778d9

File tree

8 files changed

+15
-11
lines changed

8 files changed

+15
-11
lines changed

Base/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,15 @@ RUN echo "${TZ}" > /etc/timezone \
4141
&& dpkg-reconfigure --frontend noninteractive tzdata
4242

4343
#========================================
44-
# Add normal user with passwordless sudo
44+
# Add normal user and group with passwordless sudo
4545
#========================================
46-
RUN useradd seluser \
47-
--shell /bin/bash \
46+
RUN groupadd seluser \
47+
--gid 1201 \
48+
&& useradd seluser \
4849
--create-home \
50+
--gid 1201 \
51+
--shell /bin/bash \
52+
--uid 1200 \
4953
&& usermod -a -G sudo seluser \
5054
&& echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers \
5155
&& echo 'seluser:secret' | chpasswd
@@ -75,7 +79,7 @@ RUN mkdir -p /opt/selenium /var/run/supervisor /var/log/supervisor \
7579
#===================================================
7680
# Run the following commands as non-privileged user
7781
#===================================================
78-
USER seluser
82+
USER 1200:1201
7983

8084

8185
CMD ["/opt/bin/entry_point.sh"]

Hub/Dockerfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
USER seluser
1+
USER 1200
22

33
#========================
44
# Selenium Configuration

NodeBase/Dockerfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ RUN apt-get -qqy update \
6868
# Run the following commands as non-privileged user
6969
#===================================================
7070

71-
USER seluser
71+
USER 1200
7272

7373
#==============================
7474
# Scripts to run Selenium Node and XVFB

NodeChrome/Dockerfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key
2525
COPY wrap_chrome_binary /opt/bin/wrap_chrome_binary
2626
RUN /opt/bin/wrap_chrome_binary
2727

28-
USER seluser
28+
USER 1200
2929

3030
#============================================
3131
# Chrome webdriver

NodeDebug/Dockerfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUN apt-get update -qqy \
1717
fluxbox \
1818
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
1919

20-
USER seluser
20+
USER 1200
2121

2222
#==============================
2323
# Generating the VNC password as seluser

NodeFirefox/Dockerfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ RUN GK_VERSION=$(if [ ${GECKODRIVER_VERSION:-latest} = "latest" ]; then echo "0.
3030
&& chmod 755 /opt/geckodriver-$GK_VERSION \
3131
&& ln -fs /opt/geckodriver-$GK_VERSION /usr/bin/geckodriver
3232

33-
USER seluser
33+
USER 1200
3434

3535
COPY generate_config /opt/bin/generate_config
3636

NodeOpera/Dockerfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RUN wget -q -O - https://deb.opera.com/archive.key | apt-key add - \
3232
COPY wrap_opera_binary /opt/bin/wrap_opera_binary
3333
RUN /opt/bin/wrap_opera_binary
3434

35-
USER seluser
35+
USER 1200
3636

3737
#=====================
3838
# Opera webdriver

Standalone/Dockerfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
USER seluser
1+
USER 1200
22

33
#====================================
44
# Scripts to run Selenium Standalone

0 commit comments

Comments
 (0)