I want to run two containers inside a k8s pod.
- tomcat exporter ( which runs on port 8080 )
- tomcat application ( which also runs on the port 8080 )
As multiple running containers inside a pod cant share a same port , I am looking forward to build a custom tomcat image with a different port ( say 9090 ( default tomcat port is : 8080 ))
This is what the Dockerfile I have used.
cat Dockerfile
FROM tomcat:9.0.34
RUN sed -i 's/8080/9090/' /usr/local/tomcat/conf/server.xml
EXPOSE 9090
After building that image and running a container, I see that 9090 port has been assigned , but I also see 8080 is also still existing.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b66e1e9c3db8 chakilams3/tomcatchangedport:v1 "catalina.sh run" 3 seconds ago Up 2 seconds 8080/tcp, 0.0.0.0:9090->9090/tcp test
I am wondering from where does this 8080/tcp port comes from , even after I have changed all refferences of 8080 to 9090 in the server.xml file
Any thoughts are appreciated.