ExposeInvalidFormat
Table of contents
Output
EXPOSE instruction should not define an IP address or host-port mapping, found '127.0.0.1:80:80'
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, as this is
not the intended use of the EXPOSE
instruction. Instead, it should only
specify the port number and optionally the protocol (TCP or UDP).
ImportantThis will become an error in a future release.
Examples
❌ Bad: IP address and host-port mapping used.
FROM alpine
EXPOSE 127.0.0.1:80:80
✅ Good: only the port number is specified.
FROM alpine
EXPOSE 80
❌ Bad: Host-port mapping used.
FROM alpine
EXPOSE 80:80
✅ Good: only the port number is specified.
FROM alpine
EXPOSE 80