"Docker" imports the corresponding war package for Docker operation

Source: Internet
Author: User
Tags tomcat

Docker's container operation is no problem, and the next step is to integrate with our Tomcat app to deliver the actual service.
According to the official web, two ways of packaging and publishing .
One is to build maven Dockerdirectly and then package it directly by placing the war package under the corresponding build file.
The other is to manually add the war package , pack it into the container, and then start the container and load the war.

The first to build Maven Docker after the operation of the time to toss, first the following the second kind of direct import, binding war to do a real exercise.
So the first is to build Dockerfile.
Next, write the code in Dockerfile that corresponds to the location of the war package resource.

From Lekko/tomcat8
ADD  ./hpapppay.war usr/local/tomcat/webapps/
CMD ["catalina.sh", "Run"]

The third is to execute, the dockerfile, to let this resource load into this docker.

[Root@master tomcat4docker]# Docker build-t lekko/tomcat8/usr/local/tomcat4docker/
Sending build context to Docker Daemon 17.59 MB
step 1:from lekko/tomcat8
 ---> 30d95ba23356
step 2:add/hpapppay.war usr/local/tomcat/ webapps/
 ---> 09C0C62ADABF
removing Intermediate container e1406510edfa
Step 3:cmd catalina.sh Run
 ---> Running in 3f1b4b34ff9e
 ---> 0246df675802
removing Intermediate container 3f1b4b34ff9e
Successfully built 0246df675802

At this point, we run the image again to see the correct result.

If the result does not appear as expected, use the
Docker exec-it Containerid/bin/bash
For viewing and configuration.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.