Thank you for being a valued client of CM First Group. If you have any technical issues or concerns, please open a ticket on support.cmfirstgroup.com, email CM First technical support at support@cmfirstgroup.com or call us on our 24/7 customer hotline at +1 (512) 623-7586.

Follow

How to Create and Run Apache Tomcat Docker Container

Prerequisites:

How to Create an Apache Tomcat Docker with a WAR File Uploaded

  1. Create a directory for the dockerfile with obclient.properties, WebClient.properties, your WAR file, and customized web.xml.

    Most of the time the values in obclient.properties and WebClient.properties are different in the development and deployment environment. To override the obclient.properties and WebClient.properties files that are in the WAR file from the development environment, we will have a separate copy of each obclient.properties, WebClient.properties and web.xml files for deployment environment copied into the docker container. 

    To override obclient.properties from the WAR file, you set the properties below in WebClient.properties file.

    webclient.plex.propertyfilename=/etc/obclient.properties
    webclient.plex.environmentname=Default

    The environment data source in obclient.properties should match the MS SQL docker image name, for example:
    Environment.Default.DataSource=jdbc:sqlserver://mysqlserver:1433;databaseName=yourdatabasename

    See how to externalize WebClient.properties file.

  2. To automatically create a Tomcat web server docker with externalized obclient.properties and WebClient.properties, as well as WAR file uploaded, you will need to create a dockerfile as follows. 

    # Pull base image 
    From tomcat:8-jre8 

    # Maintainer 
    MAINTAINER "youremailaddress" 

    # Copy to images tomcat path 
    ADD web.xml /usr/local/tomcat/conf/ 
    ADD obclient.properties /etc/ 
    ADD WebClient.properties /etc/ 
    ADD yourwarfile.war /usr/local/tomcat/webapps/ 

    To set the username and password to access Tomcat admin page. You can add settings.xml and tomcat-users.xml to the container by adding the following code in the dockerfile after the MAINTAINER line.

    ADD settings.xml /usr/local/tomcat/conf/
    ADD tomcat-users.xml /usr/local/tomcat/conf/

  3. Build the docker file by navigating to the directory where your dockerfile is created.

    docker build --tag mywebserver .

  4.  How to run the image container.

    docker run -it --rm -p 8888:8080 mywebserver

    You can then go to http://localhost:8888 or http://host-ip:8888 in a browser.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk