Skip to content

Commit 85195eb

Browse files
committedApr 6, 2017
Adding description in README.md file
1 parent bd3ddad commit 85195eb

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
 

‎README.md

+42
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,44 @@
11
# tomcat-docker
22
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).

0 commit comments

Comments
 (0)