Revision To Docker (Topics Covered So far)
- Refer to Docker Earlier classroom notes
Practical Revision
-
Create a Docker Image for Game of Life
- Install JAVA
- Install Tomcat
- Download gameoflife from here into webapps folder of tomcat
- Start tomcat => (http://<ip>:8080/gameoflife)
- Possible Solution-1
- Start with Ubuntu or centos as base image
- Install JAVA
- Install tomcat
- Find the location of webapps
- download the war file
- Start application
FROM ubuntu:18.04 RUN apt-get update && apt-get install openjdk-8-jdk tomcat8 -y ADD https://referenceappkhaja.s3-us-west-2.amazonaws.com/gameoflife.war /var/lib/tomcat8/webapps/gameoflife.war EXPOSE 8080
- Possible Solution -2
- Start with Tomcat as base image
- Copy the war file
- start tomcat
- Dockerfile
FROM tomcat:8 LABEL author="khaja" ADD https://referenceappkhaja.s3-us-west-2.amazonaws.com/gameoflife.war /usr/local/tomcat/webapps/gameoflife.war EXPOSE 8080 CMD ["catalina.sh", "run"]
-
Slim Images for Linux applications
- Popularly alpine image is used
- Explore alpine image and try to build gameoflife and spc in alpine