-
Notifications
You must be signed in to change notification settings - Fork 44
NOTE20180329
Somkiat Puisungnoen edited this page Jul 26, 2019
·
1 revision
- Why docker ?
- Software development changes
- Container vs. VM
- Container vs. Process
- Docker
- Build => Image
- Ship => Registry
- Run => Container
- Hello world with Docker
- docker image
- docker container
Hello.java
public class Hello {
public static void main(String[] args) {
System.out.println("Hello Docker from Java");
}
}
How to run ?
$docker container run --rm -v $(pwd):/test -w /test openjdk:10-jdk-slim javac Hello.java
$docker container run --rm -v $(pwd):/test -w /test openjdk:10-jdk-slim java Hello
- Write Dockerfile
- Build image from Dockerfile
- Basic of Networking
- Basic of Volume
- Workshop with Java Web application (Apache Maven + Apache Tomcat + Mysql)
$docker image pull maven:3.5.3-jdk-8-alpine
$docker container run --rm -w /src -v $(pwd):/src maven:3.5.3-jdk-8-alpine mvn clean package
// Create container volume with busybox to keep all dependencies/libraries
$docker container run --name m2 -v /root/.m2 busybox
// Create container to build WAR file
$docker container run --rm -w /src -v $(pwd):/src --volumes-from m2 maven:3.5.3-jdk-8-alpine mvn clean package
$docker image build -t maven_build -f Dockerfile_build .
$docker container run --rm -v $(pwd)/m2:/root/.m2 maven_build:latest
- Working with MySQL + Initial data
- Working with Docker compose
- Working with Docker swarm
- Working with Registry