Docker Community Forums

Share and learn in the Docker community.

Tomcat servers in Single Docker image


(Test96) #1

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


(Miroadamy) #2

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/