File tree 1 file changed +42
-0
lines changed
1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1
1
# tomcat-docker
2
2
An example of an docker image containing tomcat 8 and oracle jdk 8
3
+
4
+ ## To run with tomcat maven plugin on local env
5
+
6
+ * mvn clean install
7
+ * mvn tomcat7: run
8
+
9
+ ## To run dockerfile
10
+
11
+ ### MAVEN
12
+ mvn clean install -P docker
13
+
14
+ ### DOCKER COMMAND LINES
15
+ * First copy paste the war from target directory to target/docker directory
16
+ ``` sh
17
+ $ cp target/tomcat-docker-1.0.0-SNAPSHOT.war target/docker/
18
+ ```
19
+
20
+ * Then build the docker image (it can take some time as it's curling oracle jdk and tomcat 8)
21
+ ``` sh
22
+ docker build -t tomcat-docker target/docker/
23
+ ```
24
+
25
+ * Finally you're good to start the image in the background
26
+ ``` sh
27
+ docker run -d -p 8080:8080 tomcat-docker
28
+ ```
29
+ * To connect in ssh to docker image with bash
30
+ ``` sh
31
+ docker exec -it ${IMAGE_ID_GENERATED_BY_DOCKER} bash
32
+ ```
33
+ * To stop the container
34
+ ``` sh
35
+ docker stop $( docker ps -q --filter ancestor=tomcat-docker:1.0.0-SNAPSHOT)
36
+ ```
37
+ ## Check that the app is running
38
+
39
+ http://localhost:8080/tomcatDocker/index.xhtml
40
+
41
+ ## About logs
42
+ Logs are written in docker image. /log/ for the application and /opt/tomcat/logs for tomcat.
43
+ This is not a good practice, it is better to use a mount point to write logs on a NAS (check
44
+ docker directive VOLUME to do that).
You can’t perform that action at this time.
0 commit comments