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

# buildkit/UndefinedArgInFrom

> FROM argument is not declared.

FROM argument is not declared.

| Property | Value |
| - | - |
| Severity | Warning |
| Category | Correctness |
| Default | Enabled |

## Description

This rule warns for cases where you are consuming an undefined build argument
in `FROM` instructions.

Interpolating build arguments in `FROM` instructions can be a good way to add
flexibility to your build. However, if the argument is never declared with
`ARG`, the variable silently resolves to an empty string, which is almost
certainly not the intended behavior.

This check also tries to detect and warn when a `FROM` instruction references
misspelled built-in build arguments, like `BUILDPLATFORM`.

## Examples

Bad:

```dockerfile theme={null}
FROM node:22${VARIANT} AS jsbuilder
```

Good:

```dockerfile theme={null}
ARG VARIANT="-alpine3.20"
FROM node:22${VARIANT} AS jsbuilder
```

You can also pass the argument at build time:

```console theme={null}
docker buildx build --build-arg ALPINE_VERSION=edge .
```

## Reference

* [buildkit/UndefinedArgInFrom](https://docs.docker.com/reference/build-checks/undefined-arg-in-from/)


## Related topics

- [BuildKit rules](https://tally.wharflab.com/rules/buildkit/overview.md)
- [buildkit/UndefinedVar](https://tally.wharflab.com/rules/buildkit/UndefinedVar.md)
- [buildkit/JSONArgsRecommended](https://tally.wharflab.com/rules/buildkit/JSONArgsRecommended.md)
- [buildkit/InvalidDefaultArgInFrom](https://tally.wharflab.com/rules/buildkit/InvalidDefaultArgInFrom.md)
- [buildkit/SecretsUsedInArgOrEnv](https://tally.wharflab.com/rules/buildkit/SecretsUsedInArgOrEnv.md)


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