i really do not understand the following command in Dockerfile
EXPOSE 8080
I built a java application and dockerized it via this Dockerfile
FROM openjdk:10-jre-slim
WORKDIR /app
COPY ./target/display-console-1.0-SNAPSHOT.jar /app
CMD ["java", "-jar", "display-console-1.0-SNAPSHOT.jar"]
My java application got a controller which listen on port 8085. So when i use it from my localhost, i just do something like
docker run -ti my-docker-hub-account/my-image -p 8085:8085
and all works perfectly !
So, what is the interest of command
EXPOSE XXXX
in Dockerfile ?
thanks by advance