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

> Use `SHELL` to change the default shell.

Use `SHELL` to change the default shell.

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

## Description

Docker provides a `SHELL` instruction which does not require overwriting `/bin/sh` in your container. Instead of using `ln -sf` to redirect `/bin/sh`,
use the `SHELL` instruction to set the desired shell.

## Examples

### Problematic code

```dockerfile theme={null}
RUN apk add --update-cache bash=4.3.42-r3
RUN ln -sfv /bin/bash /bin/sh
```

### Correct code

```dockerfile theme={null}
RUN apk add --update-cache bash=4.3.42-r3
SHELL ["/bin/bash", "-c"]
```

## Auto-fix

Replaces `ln -sf` targeting `/bin/sh` with a `SHELL` instruction. If the `ln` command is part of a larger `RUN`, the `ln` portion is removed and a
`SHELL` instruction is inserted after.

```dockerfile theme={null}
# Before
RUN ln -sf /bin/bash /bin/sh && apk add curl

# After (with --fix)
RUN apk add curl
SHELL ["/bin/bash", "-c"]
```

## Reference

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


## Related topics

- [Hadolint rules](/rules/hadolint/overview.md)
- [hadolint/DL3020](/rules/hadolint/DL3020.md)
- [hadolint/DL3021](/rules/hadolint/DL3021.md)
- [hadolint/DL3022](/rules/hadolint/DL3022.md)
- [hadolint/DL3023](/rules/hadolint/DL3023.md)


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