Skip to main content
useradd without flag -l and high UID will result in excessively large image.

Description

Without the -l or --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 inflates container image sizes due to the lack of support for sparse files in overlay filesystems.

Examples

Problematic code

Correct code

Auto-fix

Inserts -l flag after useradd when UID is greater than 99999 and -l/--no-log-init is not already present.

Reference