You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-24Lines changed: 33 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,7 @@ Simple java project demos how to build a war file to be deployed on a Tomcat ser
6
6
7
7
The build script uses `mvn package` to produce a demo.war file and then bundles it with a Docker image that runs Tomcat. Usage:
8
8
9
-
```sh
10
-
bin/build
11
-
```
9
+
bin/build
12
10
13
11
## What happened
14
12
@@ -17,25 +15,38 @@ bin/build
17
15
18
16
Here's an example of some things to check after running the build script:
19
17
20
-
```
21
-
$ ls pkg/demo.war
22
-
pkg/demo.war
23
-
$ docker images
24
-
REPOSITORY TAG IMAGE ID CREATED SIZE
25
-
demo-java latest 88092dfb7325 6 minutes ago 591MB
26
-
tomcat 8.5 a92c139758db 2 weeks ago 558MB
27
-
$
28
-
```
18
+
$ ls pkg/demo.war
19
+
pkg/demo.war
20
+
$ docker images
21
+
REPOSITORY TAG IMAGE ID CREATED SIZE
22
+
demo-java latest 88092dfb7325 6 minutes ago 591MB
23
+
tomcat 8.5 a92c139758db 2 weeks ago 558MB
24
+
$
29
25
30
26
## Run
31
27
32
28
To run and test that Tomcat is serving the the war file:
33
29
34
-
```
35
-
docker run --rm -p 8080:8080 demo-java
36
-
```
37
-
38
-
Then you can hit the the [HOSTNAME]:8080/demo/Hello and to verify that Tomcat is servering the demo.war file. You should see an html page that says "Hello World"
30
+
docker run --rm -p 8080:8080 -d demo-java
31
+
docker exec -ti $(docker ps -ql) bash
32
+
curl localhost:8080/demo/Hello
33
+
exit
34
+
docker stop $(docker ps -ql)
35
+
36
+
Then you can hit the the [HOSTNAME]:8080/demo/Hello and to verify that Tomcat is servering the demo.war file. You should see an html page that says "Hello World". The output should look similar:
0 commit comments