Tomcat servers in Single Docker image

Hi,

I would like to know can we Install multiple tomcat servers in single docker image and deploy different war files to diff tomcat servers with different ports and they should able to communicate each other
When i run the single docker image all tomcat servers inside that docker image should run

How can we achieve this ?

Thanks

You can achieve it by using startup shell script that will start the various Tomcats (which must be configured to use different ports) on container start.

This is not recommended way of use docker. Much cleaner solution would be using one container per Tomcat and start multiple containers using docker-compose. This way, you can use same ports internally and remap them at docker-compose level.

See the documentation at https://docs.docker.com/compose/

Thanks for your reply, Can you help me to suggest which is best docker way to implement
How two different images containers can communicate? (which docker network is the best to implement?