I have downloaded a tomcat image from docker hub and made three instance in an docker container of that tomcat . now issue i cant edit the configuration file of instance . so can anyone help how can i edit the conf file to change server , http,ajp ports of the conf file and make instance according to my choice of port so that i can make multiple instance in tomcat.
Create the file on the host. Then either
Copy it from host to containers ( see the dockerfile ADD command)
Use the volume option on docker run command to map that folder into the container at the right location
We have already tried this and could no changed ports. Are their any alternatives for the same ?
sorry, I do not understand… this is what I do for a custom deployment
you create a customized image using the docker build command, and some local files
from tomcat:latest (or whatever source image u are using)
Update the default apache site with the config we created.
ADD ports.conf /etc/apache2/ports.conf
note that virtual host port must match ports.conf setting
ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf
ADD apache.conf /etc/apache2/apache2.conf
— if u change the default port, you should add an expose for that
expose ??? (same port as in ports.conf)
CMD /usr/sbin/apache2ctl -D FOREGROUND
then docker build -t your_image_name .
then docker run your_image_name
you could make folders on the docker host that have the apache config files in them
and then use -v or --volume to map those folders over the source image versions on docker run.
then u wouldn’t have to create a new image.
we are not facing issue with Apache but we are facing issues in tomcat instances as we are running multiple tomcat instances on the server and that I need to do using docker.
ok, explain more… i see the tomcat image uses port 8080 as default.
for eg. I am having a tomcat which contains 3 instances.
Tomcat A is using shutdown port : 8005, http : 8080 and ajp : 8009
Tomcat B is using shutdown port : 8006, http : 8081 and ajp : 8010
Tomcat C is using shutdown port : 8007, http : 8082 and ajp : 8011
How I can do such using docker?
ok… according to the tomcat/conf/server.xml in the tomcat image (tomcat:latest)
the image shutdown is 8005, http is 8080, and ajp is 8009.
mapping each container port :xxxx to a host port yyyy:
# Tomcat A docker run -d -p 8005:8005 -p 8009:8009 -p 8080:8080 tomcat # Tomcat B docker run -d -p 8006:8005 -p 8010:8009 -p 8081:8080 tomcat # Tomcat C docker run -d -p 8007:8005 -p 8011:8009 -p 8082:8080 tomcat