Exposing Docker Ports Via EXPOSE or –expose
The port is not actually published by the EXPOSE command. It serves as a form of documentation regarding which ports are meant to be released between the person who produces the image and the person who runs the container. Use the -p flag on docker run to actually publish and map one or more ports when starting the container.
Note: The EXPOSE command tells Docker that the container is now listening on the given network ports.
Syntax:
EXPOSE 8080
How to Map Ports in Docker?
In docker, all the application in the container runs on particular ports when you run a container. If you want to access the particular application with the help of a port number you need to map the port number of the container with the port number of the docker host.
Contact Us