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

> EXPOSE instruction should not define an IP address or host-port mapping.

EXPOSE instruction should not define an IP address or host-port mapping.

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

## Description

The `EXPOSE` instruction in a Dockerfile is used to indicate which ports the
container listens on at runtime. It should not include an IP address or
host-port mapping.

Including an IP address or host-port mapping in the `EXPOSE` instruction does
not actually publish the port and can be misleading. Use `docker run -p` or
`docker compose` port mappings to bind host ports at runtime.

## Examples

Bad:

```dockerfile theme={null}
FROM alpine
EXPOSE 127.0.0.1:80:80
```

Good:

```dockerfile theme={null}
FROM alpine
EXPOSE 80
```

Bad:

```dockerfile theme={null}
FROM alpine
EXPOSE 80:80
```

Good:

```dockerfile theme={null}
FROM alpine
EXPOSE 80
```

## Reference

* [buildkit/ExposeInvalidFormat](https://docs.docker.com/reference/build-checks/expose-invalid-format/)


## Related topics

- [BuildKit rules](/rules/buildkit/overview.md)
- [buildkit/InvalidDefinitionDescription](/rules/buildkit/InvalidDefinitionDescription.md)
- [buildkit/ExposeProtoCasing](/rules/buildkit/ExposeProtoCasing.md)
- [buildkit/InvalidDefaultArgInFrom](/rules/buildkit/InvalidDefaultArgInFrom.md)
- [buildkit/InvalidBaseImagePlatform](/rules/buildkit/InvalidBaseImagePlatform.md)


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