Skip to content

Commit 553df4e

Browse files
committed
Running commands as seluser instead of root.
1 parent ca4da7a commit 553df4e

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

Hub/Dockerfile.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
USER seluser
2+
13
#========================
24
# Selenium Configuration
35
#========================
@@ -21,11 +23,12 @@ ENV GRID_TIMEOUT 30
2123
# Debug
2224
ENV GRID_DEBUG false
2325

24-
COPY generate_config /opt/selenium/generate_config
25-
COPY entry_point.sh /opt/bin/entry_point.sh
26-
RUN /opt/selenium/generate_config > /opt/selenium/config.json
27-
RUN chown -R seluser /opt/selenium
28-
29-
USER seluser
26+
COPY generate_config \
27+
entry_point.sh \
28+
/opt/bin/
29+
# Running this command as sudo just to avoid the message:
30+
# To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details.
31+
# When logging into the container
32+
RUN sudo /opt/bin/generate_config > /home/seluser/selenium/config.json
3033

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

Hub/entry_point.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22

3-
ROOT=/opt/selenium
3+
ROOT=/home/seluser/selenium
44
CONF=$ROOT/config.json
55

6-
$ROOT/generate_config >$CONF
6+
/opt/bin/generate_config >$CONF
77

88
echo "starting selenium hub with configuration:"
99
cat $CONF
@@ -19,11 +19,11 @@ function shutdown {
1919
echo "shutdown complete"
2020
}
2121

22-
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
22+
java ${JAVA_OPTS} -jar /home/seluser/selenium/selenium-server-standalone.jar \
2323
-role hub \
2424
-hubConfig $CONF \
2525
${SE_OPTS} &
2626
NODE_PID=$!
2727

2828
trap shutdown SIGTERM SIGINT
29-
wait $NODE_PID
29+
wait $NODE_PID

0 commit comments

Comments
 (0)