Ryan Walls
@ryanwalls
Director of Software Engineering
3DSIM
Container
Image
Engine
Hub
Uses open source specification: runc
https://github.com/opencontainers/runc
A container is a self contained execution environment that shares the kernel of the host system and which is (optionally) isolated from other containers in the system.
VM
Docker container
Large
Small
Consume significant CPU and memory
Basically zero memory and CPU overhead
Not easily portable between VM environments
Run in any linux environment
Hardware centric
Application centric
An image is the source of a docker container.
Imperfect analogy:
MyClass.java -> MyClass.class -> running instance of MyClass running in JVM
Dockerfile -> docker image -> running docker container in docker enginer
Manages containers
Start/Stop
Status
Linking
Networking
Storage
Client-server application with these major components:
A server
A REST API
A command line interface (CLI) client
Store and browse ready-made docker images
Ryan
Ryan
Let's demo a little Docker first
Let's see what it can do... then let's talk
Instant CI server
docker run -i -t -d --name neo4j --cap-add=SYS_RESOURCE \
-p 7474:7474 tpires/neo4jTry out neo4j
docker run --name myjenkins -p 8080:8080 -v /var/jenkins_home jenkinsPlay around with nginx
docker run -p 7070:80 -v \
/path/to/some/sample-static-html:/usr/share/nginx/html:ro -d nginxHow about mongo?
docker run --name my-mongo -d mongohttps://github.com/wsargent/docker-cheat-sheet
You can create a docker image by just running commands against a base image.
docker pull learn/tutorial
docker run learn/tutorial apt-get install -y ping
docker ps -l
docker commit <id from previous step> learn/ping
docker run learn/ping ping google.com
Instead of running commands and saving, can create a Dockerfile that specifies all the commands to build an image.
FROM maven:3.3-jdk-8-onbuild-alpine
RUN mvn test
EXPOSE 8080
CMD ["java", "-jar", "target/docker-for-java-developers-0.1.0.jar"]Build the Dockerfile into an image and tag the image
docker build -t="myname/mytomcatapp:v1" .
Create a container by running the image
docker run -t -i myname/mytomcatapp:v1
Maven made it easy. Official maven image with "onbuild" option
My steps: Find gradle image on Docker hub, read README, use if tagged and described clearly
Avoid downloading dependencies on build: https://github.com/grammarly/rocker
Hot reload spring boot: https://github.com/mpetersen/spring-boot-docker
Minimize docker image size by building jar outside image: https://github.com/Transmode/gradle-docker
"Without continuous integration, we are nothing."
-- Anonymous
https://clusterhq.com/assets/pdfs/state-of-container-usage-june-2016.pdf
Best answer early 2015...