Dockerfile instructions

Dockerfile EXPOSE

Records intended listening ports; TCP is the default. It neither creates a listener nor publishes a port. Runtime publication and security policy remain separate. No port is published by this recipe; do not use automatic publication in the offline lab.

Formal Syntax & Structure

docker syntaxdocker
EXPOSE <port>[/<protocol>] ...

Parameters & Attributes

NameTypeDescription
portstringContainer port.
protocolstringOptional tcp or udp.

Working Example

Example Snippetdocker
FROM busybox:1.37EXPOSE 8080/tcpCMD ["echo", "metadata-only"]
Docker Reference