Skip to content

Commit 85cc98d

Browse files
authored
added passwd entry change for arbitrary uid
1 parent 0651b09 commit 85cc98d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

entrypoint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
#!/bin/bash
22

3+
# add a /etc/passwd entry for the current
4+
# arbitrary UID generated randomly by OpenShift at runtime
5+
# (or added by -u switch to docker run)
6+
# (source: container-rhel-examples/starter-arbitrary-uid)
7+
# note that root is required to execute this script (e.g. at entrypoint)
8+
9+
# if ! whoami &> /dev/null; then
10+
if [ -w /etc/passwd ]; then
11+
# append a new entry for the user, using the current arbitrary UID
12+
echo "${USER_NAME}:x:$(id -u):${MY_GID}:${USER_NAME} user:${HOME}:" >> /etc/passwd
13+
fi
14+
# fi
15+
316
# # create the sock dir properly
417
# # caution: this would require root,
518
# # so cannot be run at entrypoint in user mode

0 commit comments

Comments
 (0)