-
Notifications
You must be signed in to change notification settings - Fork 480
DL3046
Moritz Röhrich edited this page May 9, 2022
·
1 revision
RUN useradd -u 123456 foobarRUN useradd -l -u 123456 foobarWithout the -l or the --no-log-init flag, useradd will add the user to the lastlog and faillog databases. This can result in the creation of logically large (sparse) files under /var/log, which in turn unnecessarily inflates container image sizes. This is due to the lack of support for sparse files in overlay filesystems. For what it's worth, this behavior becomes more apparent with longer UIDs, resulting in a few megabytes of extra image size with a six digit UID, up to several gigabytes of excessive image size with even longer UIDs.
Disabling this functionality from useradd has minimal disadvantages in a container but saves space and build time.