EXPOSE <port> [<port>...]
The
EXPOSE
instruction informs Docker that the container listens on the specified network ports at runtime.EXPOSE
does not make the ports of the container accessible to the host. To do that, you must use either the-p
flag to publish a range of ports or the-P
flag to publish all of the exposed ports. You can expose one port number and publish it externally under another number.
Inside your Dockerfile:
EXPOSE 8765
To access this port from the host machine, include this argument in your docker run
command:
-p 8765:8765