@@ -23,37 +23,37 @@ function config_user()
2323 # It is meant to run during container's init #
2424 # process. Such process is necessary to better #
2525 # exchange files/bus between host/container. #
26- # Variables DUSER, DUID, DGID are read from the #
27- # environment; if NOUSER is set, do nothing. #
26+ # Variables DOCKER_USER, DOCKER_UID, DOCKER_GID #
27+ # are read from the environment; #
28+ # if NOUSER is set, do nothing. #
2829 # ================================================#
2930
3031 DEFAULT_USER=" user"
3132 DEFAULT_UID=" 1000"
3233 DEFAULT_GID=" 100"
3334
34- [[ ! -z " $NOUSER " ]] && \
35- # nothing to be done here
36- return 0
35+ [[ -n " $NOUSER " ]] && \
36+ return 0 # nothing to be done here
3737
38- DUSER =" ${DUSER :- $DEFAULT_USER } "
39- DUID =" ${DUID :- $DEFAULT_UID } "
40- DGID =" ${DGID :- $DEFAULT_GID } "
38+ DOCKER_USER =" ${DOCKER_USER :- $DEFAULT_USER } "
39+ DOCKER_UID =" ${DOCKER_UID :- $DEFAULT_UID } "
40+ DOCKER_GID =" ${DOCKER_GID :- $DEFAULT_GID } "
4141
42- id $DUSER & > /dev/null || useradd -u " $DUID " \
43- -g " $DGID " \
44- -d " /home/$DUSER " -m \
45- -s /bin/bash \
46- " $DUSER "
42+ id $DOCKER_USER & > /dev/null || useradd -u " $DOCKER_UID " \
43+ -g " $DOCKER_GID " \
44+ -d " /home/$DOCKER_USER " -m \
45+ -s /bin/bash \
46+ " $DOCKER_USER "
4747
48- echo " $DUSER "
48+ echo " $DOCKER_USER "
4949 return 0
5050}
5151
5252
5353# Add a user here
5454USERNAME=$( config_user)
5555
56- # If no user created, define the current one (root)
56+ # If no user created, use the current one (root by default )
5757id " $USERNAME " || USERNAME=" $USER "
5858
5959# Garantee the user will run on a proper place.
0 commit comments