Skip to content

Commit abb5a2c

Browse files
authored
Add --no-log-init to useradd call (#781)
* Move base image to new heredoc format There are no functional changes * Add --no-log-init to useradd call This is to work around a bug in Go/Docker when large user ids are used and is in preparation of further security relevant changes where we are going to change the default user id * Hadolint * Hadolint * Remove explicit creation of home directory as useradd will create it already * useradd now creates home directory as well better formatting of command
1 parent f63cbb9 commit abb5a2c

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

stackable-base/Dockerfile

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,32 @@ microdnf install \
9090
nano \
9191
tar
9292

93+
###
94+
### Add Stackable user and group
95+
###
9396
# Added only temporarily to create the user and group, removed again below
9497
microdnf install shadow-utils
9598
groupadd --gid 1000 --system stackable
96-
useradd --gid stackable --uid 1000 --system stackable -d /stackable
9799

98-
mkdir /stackable
99-
chown stackable:stackable /stackable
100+
# The --no-log-init is required to work around a bug/problem in Go/Docker when very large UIDs are used
101+
# See https://github.com/moby/moby/issues/5419#issuecomment-41478290 for more context
102+
# Making this a system user prevents a mail dir from being created, expiry of passwords etc. but it will warn:
103+
# useradd warning: stackable's uid 1000 is greater than SYS_UID_MAX 999
104+
# We can safely ignore this warning, to get rid of the warning we could change /etc/login.defs but that does not seem worth it
105+
useradd \
106+
--no-log-init \
107+
--gid stackable \
108+
--uid 1000 \
109+
--system \
110+
--create-home \
111+
--home-dir /stackable \
112+
stackable
100113
microdnf remove shadow-utils
101114
microdnf clean all
102115

116+
###
117+
### Make shell usage in our containers "nicer"
118+
###
103119
{
104120
echo "alias ll='ls -alF --color=auto'"
105121
echo "alias ls='ls --color=auto'"

0 commit comments

Comments
 (0)