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

> Do not use `apt` as it is meant to be an end-user tool, use `apt-get` or `apt-cache` instead.

Do not use `apt` as it is meant to be an end-user tool, use `apt-get` or `apt-cache` instead.

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

## Description

`apt` is discouraged by the Linux distributions as an unattended tool as its interface may change between versions. Use the more stable `apt-get` and
`apt-cache` commands in Dockerfiles instead.

## Examples

### Problematic code

```dockerfile theme={null}
FROM busybox
RUN apt install curl=1.1.0
```

### Correct code

```dockerfile theme={null}
FROM busybox
RUN apt-get install curl=1.1.0
```

## Auto-fix

Replaces `apt` with `apt-get` or `apt-cache` depending on the subcommand.

* **Safe fix** (`FixSafe`): `install`, `remove`, `update`, `upgrade`, `autoremove`, `purge`, `clean`, `autoclean` are replaced with `apt-get`
* **Suggestion fix** (`FixSuggestion`): `search`, `show`, `policy` are replaced with `apt-cache`

```dockerfile theme={null}
# Before
RUN apt install -y curl && apt search python

# After (with --fix)
RUN apt-get install -y curl && apt-cache search python
```

## Reference

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


## Related topics

- [Hadolint rules](https://tally.wharflab.com/rules/hadolint/overview.md)
- [hadolint/DL3000](https://tally.wharflab.com/rules/hadolint/DL3000.md)
- [hadolint/DL3001](https://tally.wharflab.com/rules/hadolint/DL3001.md)
- [hadolint/DL3002](https://tally.wharflab.com/rules/hadolint/DL3002.md)
- [hadolint/DL3003](https://tally.wharflab.com/rules/hadolint/DL3003.md)


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