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 Connect Tomcat Docker Container with MS SQL Docker Container

  1. Create a custom bridged network. You can see the docker network that you have with the following command.

    docker network ls

    Create your custom bridged network with the following command.

    docker network create --driver=bridge my-network

  2. If you already have Tomcat and MS SQL docker containers running, you can stop them with the following commands.

    docker stop $(docker ps -a -q)
    docker rm $(docker ps -a -q)

  3. In order to connect Tomcat docker container with MS SQL docker container, we need to run them on the same bridged network. To run MS SQL docker with the bridged network.

    docker run -p 1433 --net=my-network --name mysqlserver -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -v C:/temp:/dbdump -d mysqlserver

  4. After the MS SQL docker container is running successfully, you can check the ip address of the container by using the following command.

    docker inspect mysqlserver

  5. To connect Tomcat docker container with MS SQL docker, we will need to add MS SQL container ip address to Tomcat container.

    docker run -it --rm -p 8888:8080 --net=my-network --add-host mysqlserver:172.18.0.2 --name=mywebserver <mywebserver imageid>

    To check the imageid of mywebserver, you can use the following command.

    docker images

  6. After the Tomcat docker is running successfully, you can go to your WebClient application url. To access your WebClient log file.

    To access the webclient log file in the docker image, you can use the following steps.
    # find ID of your running container:
    docker ps
    # create image (snapshot) from container filesystem
    docker commit 12345678904b5 mysnapshot
    # explore this filesystem using bash (for example)
    docker run -t -i mysnapshot /bin/bash
    #Get the last 100 lines from the log file
    tail -n 100 /var/log/yourlogfilename.log

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

Comments

Powered by Zendesk