- Create a custom bridged network. You can see the docker network that you have with the following command.
docker network lsCreate your custom bridged network with the following command.
docker network create --driver=bridge my-network
- 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)
- 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
- 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
- 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.
- 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:
# 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