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

# tally/no-multi-spaces

> Disallows multiple consecutive spaces within Dockerfile instructions.

Disallows multiple consecutive spaces within Dockerfile instructions.

| Property | Value |
| - | - |
| Severity | Style |
| Category | Style |
| Default | Enabled |
| Auto-fix | Yes (safe) |

## Description

Multiple consecutive spaces within Dockerfile instructions are usually accidental and make the code harder to read. This rule flags any run of 2 or
more consecutive space characters within instruction lines.

The following are excluded:

* **Leading indentation**: whitespace before the instruction keyword
* **Heredoc body lines**: content between heredoc markers (semantically significant)
* **Comment lines**: lines starting with `#`

## Examples

### Bad

```dockerfile theme={null}
FROM  alpine:3.20
RUN  apk add  --no-cache  curl
COPY  . /app
```

### Good

```dockerfile theme={null}
FROM alpine:3.20
RUN apk add --no-cache curl
COPY . /app
```

## Auto-fix

This rule provides a safe auto-fix that replaces each run of multiple spaces with a single space:

```bash theme={null}
tally lint --fix Dockerfile
```

Each contiguous run of extra spaces is replaced independently, so a line with multiple occurrences receives one edit per run.

## Configuration

No custom configuration options. The rule is enabled by default with severity "style".

```toml theme={null}
# Disable the rule
[rules.tally.no-multi-spaces]
severity = "off"
```


## Related topics

- [tally/no-trailing-spaces](https://tally.wharflab.com/rules/tally/no-trailing-spaces.md)
- [tally/no-multiple-empty-lines](https://tally.wharflab.com/rules/tally/no-multiple-empty-lines.md)
- [tally/consistent-indentation](https://tally.wharflab.com/rules/tally/consistent-indentation.md)
- [tally/labels/no-stale-base-digest](https://tally.wharflab.com/rules/tally/labels/no-stale-base-digest.md)
- [tally/windows/no-chown-flag](https://tally.wharflab.com/rules/tally/windows/no-chown-flag.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.