> ## Documentation Index
> Fetch the complete documentation index at: https://tally.wharflab.com/llms.txt
> Use this file to discover all available pages before exploring further.

# hadolint/DL3046

> `useradd` without flag `-l` and high UID will result in excessively large image.

`useradd` without flag `-l` and high UID will result in excessively large image.

| Property | Value         |
| -------- | ------------- |
| Severity | Warning       |
| Category | Performance   |
| Default  | Enabled       |
| Auto-fix | Yes (`--fix`) |

## 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

```dockerfile theme={null}
RUN useradd -u 123456 foobar
```

### Correct code

```dockerfile theme={null}
RUN useradd -l -u 123456 foobar
```

## Auto-fix

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

```dockerfile theme={null}
# Before
RUN useradd -u 100001 appuser

# After (with --fix)
RUN useradd -u 100001 -l appuser
```

## Reference

* [hadolint/DL3046](https://github.com/hadolint/hadolint/wiki/DL3046)
