I have following requirement, but do not have clear understanding on approach for it.
Need is to create an image for an application(Web application based on java, running on tomcat, OS is CENTOS 7). There is a .jar file to install this application in unix based machine.
Basically we do following steps when installing our application in unix machine:
Install jdk 8
Install mysql 5.7
Start Mysql
Install application using .jar file
Start application
Access this application from outside of machine (Browser)
Can some one help me out with the approach I should go for.
No, you do not really want to create one image. You want to use some already existing. The underlying OS is not really that important at this point but there are CentOS based images.
Walkthrough from the top.
db: is the label and the name of the service running Mysql. It is also the hostname that you should use in your connection string. Here I use the latest gratest. That is the image:
MySQL needs a password or it will generate it. You can pass it as an enrionment variable.
adminer: is a gui for working with databases. I expose that on port 8088.
web: is our webserver. Using the tomcat with the correct JRE installed.
I expose it to the system on port 8080.
volumes: mounts files and directories from my host system into Docker. I used maven to build my DockerExample.war so it is in the target directory of my project.
Put the docker-compose.yml file in the root of the project and run the command