Skip to content

Commit

Permalink
Instead of using usermod, delete the users and create anew, so we can…
Browse files Browse the repository at this point in the history
… use --no-log-init option. Without this option, users with very large UID numbers were experiencing docker build hangs, and filling up drives. See moby/moby#5419
  • Loading branch information
jonpugh committed Apr 23, 2018
1 parent 90d76d4 commit b858c2f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions dockerfiles/set-user-ids.sh
Expand Up @@ -11,12 +11,17 @@ USER_NAME=$1
USER_UID=$2
WEB_UID=$3

echo "$PREFIX Changing user '$USER_NAME' UID/GID to '$USER_UID'...
echo "$PREFIX Recreating user '$USER_NAME' UID/GID to '$USER_UID'...
"
usermod -u $USER_UID $USER_NAME
groupmod -g $USER_UID $USER_NAME
userdel $USER_NAME
chown $USER_UID:$USER_UID /var/$USER_NAME

addgroup --gid $USER_UID $USER_NAME
useradd --no-log-init --uid $USER_UID --gid $USER_UID --system --home-dir /var/$USER_NAME $USER_NAME

echo "$PREFIX Changing user 'www-data' UID/GID to '$WEB_UID'...
"
usermod -u $WEB_UID www-data
groupmod -g $WEB_UID www-data

userdel www-data
addgroup --gid $WEB_UID www-data
useradd --no-log-init --uid $WEB_UID --gid $WEB_UID --system www-data

0 comments on commit b858c2f

Please sign in to comment.