docker -P not exposing ports of application started as argument
I’d like to start a container with an argument to start a server inside the container. The problem is the -P switch is not exposing the ports of this server to my host.
docker run -it -e "JAVA_HOME=/opt/jdk1.8.0_45" -e "CARBON_HOME=/opt/IOT/wso2iots-1.0.0-SNAPSHOT" -P ubuntupreped:2.0 /bin/sh /opt/IOT/wso2iots-1.0.0-SNAPSHOT/bin/wso2server.sh
When I build a image exposing the env variables and a script to start the server, the -P switch works as expected.
Any idea whats happening here?