SlideShare a Scribd company logo
1 of 35
Download to read offline
Docker in Practice
Usecases for Developers
Agenda
What is Docker
Docker for development
◦ Runtime
◦ Middleware
Docker in CI/CD
◦ Build environments
Docker in production
◦ Docker Swarm
◦ AWS ECS
◦ Kubernetes
Microservices
What is Docker?
Docker History
1979: chroot
2007: control groups (Google)
2008: LXC Linux container manager
2013: Docker (dotCloud -> Docker Inc.)
2014: Kubernetes (Google) and ECS (Amazon)
2016: Docker Swarm
2016: Docker native on Windows
december 2017: Amazon goes Kubernetes?
Wat is Docker?
Docker Images
Layers of libraries, utilities and a main application
Reuse shared layers
Does not include kernel
Can include Full OS like RedHat EL, Ubuntu, …
Or dedicated OS like Alpine Linux
Minimal linux distribution (130MB)
Limited libc, limited shell tools
Supports Java only since 8u133
Dockerfile
Recipe for Docker image
FROM <image>
COPY <src> <dest>
RUN <command>
EXPOSE <port>
ENTRYPOINT <command interpreter, default: ‘/bin/sh -c’>
CMD <command passed to ENTRYPOINT>
Docker Registry
Similar to Maven repository for docker images
DockerHub is the default repository
Alternative registry in docker name
docker pull nexusd.hi10.cloud/openjdk:8-jdk-alpine
Push to registry
docker login nexusd.hi10.cloud
docker tag a2a00e606b82 nexusd.hi10.cloud/openjdk:8-jdk-alpine
docker push nexusd.hi10.cloud/openjdk:8-jdk-alpine
Docker Registry implementations
Docker Hub (only for open source)
Official ‘registry’ image (Free, Docker based, no GUI)
Docker Enterprise (Commercial)
Nexus Repository Manager (Free or Commercial)
Artifactory (Commercial only)
Amazon ECR
Workshop
https://github.com/greyfairer/sout-chuck-norris
Docker Container
Docker image ready to run
Base image
Writable layer
Mapped storage
Mapped ports
Environment variables
Virtual Network segment
Docker Layers
Docker Storage
- Anonymous volumes
- When no mapping is
specified
- Created by docker
engine when container
is created
- Named volumes
- Created before
container
- Can be shared
between containers
- Local directory mapping
- Share data between
host and containers
Docker for Windows
Windows <= 8 or Windows 10 Home:
VirtualBox
Windows 10 Professional:
Native Docker on MS Hyper-V with Linux Kernel
Also supports a ‘Windows Kernel’ for e.g. Microsoft Server 2016
Docker for
Development
Run development middleware in
Docker
Run MongoDB, PostgresQL, ActiveMQ as docker images.
No need to worry about different OS, different versions, local settings, …
Create one image with all settings that are correct for your application
Also run dependencies as docker images
Maybe mocked versions of it, using Wiremock or Hoverfly
Docker-compose
Command-line tool to manage docker projects.
Reads YAML file to run multiple docker containers
Docker command line parameters converted to yaml
Gives internal DNS service names to containers
Demo
DockStation
https://github.com/greyfairer/example-voting-app
Docker in CI/CD
Docker in a CI/CD pipeline
Docker images can be used to package any process, so can be used for
- Build Tools (gradle/maven/go/npm/...)
- Automated tests (JMeter/…)
- Mocked dependencies (Hoverfly/Wiremock/…)
Deliverables also as Docker image instead of war
- Same runtime libraries in DEV/TEST/ACC/PROD
Fully supported in Jenkins
Basis for Amazon CodeBuild
Docker multi-stage build
FROM node:latest AS storefront
WORKDIR /usr/src/atsea/app/react-app
COPY react-app .
RUN npm install
RUN npm run build
FROM maven:latest AS appserver
WORKDIR /usr/src/atsea
COPY pom.xml .
RUN mvn -B -f pom.xml -s /usr/share/maven/ref/settings-docker.xml dependency:resolve
COPY . .
RUN mvn -B -s /usr/share/maven/ref/settings-docker.xml package -DskipTests
FROM java:8-jdk-alpine
RUN adduser -Dh /home/gordon gordon
WORKDIR /static
COPY --from=storefront /usr/src/atsea/app/react-app/build/ .
WORKDIR /app
COPY --from=appserver /usr/src/atsea/target/AtSea-0.0.1-SNAPSHOT.jar .
ENTRYPOINT ["java", "-jar", "/app/AtSea-0.0.1-SNAPSHOT.jar"]
CMD ["--spring.profiles.active=postgres"]
Compile your app during Docker build
Avoid sources + build tools in final image
-> Multiple FROM
New since 17.05
Docker in Production
Risks
Security?
All containers running in PROD should verified
Avoid containers running as root
https://hub.docker.com/r/projectatomic/dockerfile-lint/
Storage Critical applications?
MongoDB ok for standalone, not for a cluster
ElasticSearch does not support instances on Docker
Docker Orchestration
Docker standalone
Install default linux with docker engine
Run docker images with individual port mapping
Use DNS + Load Balancer port mapping to name services.
Contra:
Not High Available
Single point of failure
Not easy to scale
Docker Swarm
Uses same format as docker-compose
Adds ‘deploy’ properties
Distribute load across different nodes
Detect new nodes
Routes traffic to correct instance
Make sure volumes can be mounted on all nodes
Special Docker for AWS bundle
AutoScalingGroup for worker and manager nodes
Application Load Balancer for traffic routing
Elastic Block Storage for shared volumes
Demo
Amazon AWS ECS / ECR
ECR: Elastic Container Registry
Free docker registry with IAM authentication
ECS: Elastic Container Services
‘Task definition’ similar to docker-compose project
AWS ECS will handle distribution over availability zones, VPC etc.
AWS ECS will auto-scale on demand (based on CloudWatch alarms)
Kubernetes
Container orchestrator from Google, rewrite of internal cluster management system
First deployment option for Google Cloud Platform
Now, they also support simple VM’s
Kubernetes manager for free on Google Cloud Platform
Maybe also on AWS after next week
Existed before Docker Swarm
Docker Swarm functionalities built as docker images
Kubernetes Components
Kubernetes Pods
Pod:
● Set of Containers
● Always on the same node
● Have their own IP address
● Can share volumes
● Always scaled together
OpenShift
Kubernetes with developer tools added
Built-in Docker Registry
Image Build Scheduler
User Mgmt
Self-hosted or cloud solution (openshift.com)
Cloud solution free for small project (1 GB total RAM)
Demo
Conclusion
Use docker for projects without microservices? Nope.
Use docker for Development? Sure!
Use docker for CI/CD? Sure!
Use docker for production? Only if you are careful.
- Docker Swarm: easier to use, not a long record of stability.
- Kubernetes: very complicated to use, known to be stable if configured correctly.
- AWS ECS: Somewhere in the middle.

More Related Content

What's hot

Docker Compose by Aanand Prasad
Docker Compose by Aanand Prasad Docker Compose by Aanand Prasad
Docker Compose by Aanand Prasad
Docker, Inc.
 
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Virtual Meetup Docker + Arm: Building Multi-arch Apps with BuildxVirtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Docker, Inc.
 

What's hot (20)

Docker container a-brief_introduction_2016-01-30
Docker container a-brief_introduction_2016-01-30Docker container a-brief_introduction_2016-01-30
Docker container a-brief_introduction_2016-01-30
 
Docker intro
Docker introDocker intro
Docker intro
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Introduction to docker and docker compose
Introduction to docker and docker composeIntroduction to docker and docker compose
Introduction to docker and docker compose
 
Docker 101 Workshop slides (JavaOne 2017)
Docker 101 Workshop slides (JavaOne 2017)Docker 101 Workshop slides (JavaOne 2017)
Docker 101 Workshop slides (JavaOne 2017)
 
Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
 
Docker Compose by Aanand Prasad
Docker Compose by Aanand Prasad Docker Compose by Aanand Prasad
Docker Compose by Aanand Prasad
 
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Virtual Meetup Docker + Arm: Building Multi-arch Apps with BuildxVirtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
 
Virtual Container - Docker
Virtual Container - Docker Virtual Container - Docker
Virtual Container - Docker
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
presentation on Docker
presentation on Dockerpresentation on Docker
presentation on Docker
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker Compose
 
Adventures in docker compose
Adventures in docker composeAdventures in docker compose
Adventures in docker compose
 
Docker Container Introduction
Docker Container IntroductionDocker Container Introduction
Docker Container Introduction
 
Containers and docker
Containers and dockerContainers and docker
Containers and docker
 
Containerization and Docker
Containerization and DockerContainerization and Docker
Containerization and Docker
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Docker
DockerDocker
Docker
 
Introduction to container based virtualization with docker
Introduction to container based virtualization with dockerIntroduction to container based virtualization with docker
Introduction to container based virtualization with docker
 
Docker and stuff
Docker and stuffDocker and stuff
Docker and stuff
 

Similar to Docker in practice

Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Carlos Sanchez
 
Docker - The Linux Container
Docker - The Linux ContainerDocker - The Linux Container
Docker - The Linux Container
Balaji Rajan
 

Similar to Docker in practice (20)

Docker slides
Docker slidesDocker slides
Docker slides
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET Developers
 
Accelerate your development with Docker
Accelerate your development with DockerAccelerate your development with Docker
Accelerate your development with Docker
 
Accelerate your software development with Docker
Accelerate your software development with DockerAccelerate your software development with Docker
Accelerate your software development with Docker
 
Docker
DockerDocker
Docker
 
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
 
Docker for developers z java
Docker for developers z javaDocker for developers z java
Docker for developers z java
 
Docker - fundamental
Docker  - fundamentalDocker  - fundamental
Docker - fundamental
 
Docker In Brief
Docker In BriefDocker In Brief
Docker In Brief
 
Docker.pptx
Docker.pptxDocker.pptx
Docker.pptx
 
Docker basics
Docker basicsDocker basics
Docker basics
 
Docker - The Linux Container
Docker - The Linux ContainerDocker - The Linux Container
Docker - The Linux Container
 
Docker 1.9 Workshop
Docker 1.9 WorkshopDocker 1.9 Workshop
Docker 1.9 Workshop
 
Introduction to Dockers and containers
Introduction to Dockers and containers Introduction to Dockers and containers
Introduction to Dockers and containers
 
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
 
Up and running with docker
Up and running with dockerUp and running with docker
Up and running with docker
 
Docker for Developers
Docker for DevelopersDocker for Developers
Docker for Developers
 
Introduction to docker and oci
Introduction to docker and ociIntroduction to docker and oci
Introduction to docker and oci
 
Introduction To Docker
Introduction To  DockerIntroduction To  Docker
Introduction To Docker
 
containers and virtualization tools ( Docker )
containers and virtualization tools ( Docker )containers and virtualization tools ( Docker )
containers and virtualization tools ( Docker )
 

More from Geert Pante

Version Management in Maven
Version Management in MavenVersion Management in Maven
Version Management in Maven
Geert Pante
 

More from Geert Pante (11)

OAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring BootOAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring Boot
 
Kafka Introduction.pptx
Kafka Introduction.pptxKafka Introduction.pptx
Kafka Introduction.pptx
 
Kubernetes and Amazon ECS
Kubernetes and Amazon ECSKubernetes and Amazon ECS
Kubernetes and Amazon ECS
 
Spring JMS and ActiveMQ
Spring JMS and ActiveMQSpring JMS and ActiveMQ
Spring JMS and ActiveMQ
 
Log management with ELK
Log management with ELKLog management with ELK
Log management with ELK
 
Java EE 6
Java EE 6Java EE 6
Java EE 6
 
Spring 4 en spring data
Spring 4 en spring dataSpring 4 en spring data
Spring 4 en spring data
 
Spring and SOA (2006)
Spring and SOA (2006)Spring and SOA (2006)
Spring and SOA (2006)
 
Maven plugins, properties en profiles: Advanced concepts in Maven
Maven plugins, properties en profiles: Advanced concepts in MavenMaven plugins, properties en profiles: Advanced concepts in Maven
Maven plugins, properties en profiles: Advanced concepts in Maven
 
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISThe glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
 
Version Management in Maven
Version Management in MavenVersion Management in Maven
Version Management in Maven
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Docker in practice

  • 2. Agenda What is Docker Docker for development ◦ Runtime ◦ Middleware Docker in CI/CD ◦ Build environments Docker in production ◦ Docker Swarm ◦ AWS ECS ◦ Kubernetes
  • 5. Docker History 1979: chroot 2007: control groups (Google) 2008: LXC Linux container manager 2013: Docker (dotCloud -> Docker Inc.) 2014: Kubernetes (Google) and ECS (Amazon) 2016: Docker Swarm 2016: Docker native on Windows december 2017: Amazon goes Kubernetes?
  • 7. Docker Images Layers of libraries, utilities and a main application Reuse shared layers Does not include kernel Can include Full OS like RedHat EL, Ubuntu, … Or dedicated OS like Alpine Linux Minimal linux distribution (130MB) Limited libc, limited shell tools Supports Java only since 8u133
  • 8. Dockerfile Recipe for Docker image FROM <image> COPY <src> <dest> RUN <command> EXPOSE <port> ENTRYPOINT <command interpreter, default: ‘/bin/sh -c’> CMD <command passed to ENTRYPOINT>
  • 9. Docker Registry Similar to Maven repository for docker images DockerHub is the default repository Alternative registry in docker name docker pull nexusd.hi10.cloud/openjdk:8-jdk-alpine Push to registry docker login nexusd.hi10.cloud docker tag a2a00e606b82 nexusd.hi10.cloud/openjdk:8-jdk-alpine docker push nexusd.hi10.cloud/openjdk:8-jdk-alpine
  • 10. Docker Registry implementations Docker Hub (only for open source) Official ‘registry’ image (Free, Docker based, no GUI) Docker Enterprise (Commercial) Nexus Repository Manager (Free or Commercial) Artifactory (Commercial only) Amazon ECR
  • 12. Docker Container Docker image ready to run Base image Writable layer Mapped storage Mapped ports Environment variables Virtual Network segment
  • 14. Docker Storage - Anonymous volumes - When no mapping is specified - Created by docker engine when container is created - Named volumes - Created before container - Can be shared between containers - Local directory mapping - Share data between host and containers
  • 15. Docker for Windows Windows <= 8 or Windows 10 Home: VirtualBox Windows 10 Professional: Native Docker on MS Hyper-V with Linux Kernel Also supports a ‘Windows Kernel’ for e.g. Microsoft Server 2016
  • 17. Run development middleware in Docker Run MongoDB, PostgresQL, ActiveMQ as docker images. No need to worry about different OS, different versions, local settings, … Create one image with all settings that are correct for your application Also run dependencies as docker images Maybe mocked versions of it, using Wiremock or Hoverfly
  • 18. Docker-compose Command-line tool to manage docker projects. Reads YAML file to run multiple docker containers Docker command line parameters converted to yaml Gives internal DNS service names to containers
  • 21. Docker in a CI/CD pipeline Docker images can be used to package any process, so can be used for - Build Tools (gradle/maven/go/npm/...) - Automated tests (JMeter/…) - Mocked dependencies (Hoverfly/Wiremock/…) Deliverables also as Docker image instead of war - Same runtime libraries in DEV/TEST/ACC/PROD Fully supported in Jenkins Basis for Amazon CodeBuild
  • 22. Docker multi-stage build FROM node:latest AS storefront WORKDIR /usr/src/atsea/app/react-app COPY react-app . RUN npm install RUN npm run build FROM maven:latest AS appserver WORKDIR /usr/src/atsea COPY pom.xml . RUN mvn -B -f pom.xml -s /usr/share/maven/ref/settings-docker.xml dependency:resolve COPY . . RUN mvn -B -s /usr/share/maven/ref/settings-docker.xml package -DskipTests FROM java:8-jdk-alpine RUN adduser -Dh /home/gordon gordon WORKDIR /static COPY --from=storefront /usr/src/atsea/app/react-app/build/ . WORKDIR /app COPY --from=appserver /usr/src/atsea/target/AtSea-0.0.1-SNAPSHOT.jar . ENTRYPOINT ["java", "-jar", "/app/AtSea-0.0.1-SNAPSHOT.jar"] CMD ["--spring.profiles.active=postgres"] Compile your app during Docker build Avoid sources + build tools in final image -> Multiple FROM New since 17.05
  • 24. Risks Security? All containers running in PROD should verified Avoid containers running as root https://hub.docker.com/r/projectatomic/dockerfile-lint/ Storage Critical applications? MongoDB ok for standalone, not for a cluster ElasticSearch does not support instances on Docker
  • 26. Docker standalone Install default linux with docker engine Run docker images with individual port mapping Use DNS + Load Balancer port mapping to name services. Contra: Not High Available Single point of failure Not easy to scale
  • 27. Docker Swarm Uses same format as docker-compose Adds ‘deploy’ properties Distribute load across different nodes Detect new nodes Routes traffic to correct instance Make sure volumes can be mounted on all nodes Special Docker for AWS bundle AutoScalingGroup for worker and manager nodes Application Load Balancer for traffic routing Elastic Block Storage for shared volumes
  • 28. Demo
  • 29. Amazon AWS ECS / ECR ECR: Elastic Container Registry Free docker registry with IAM authentication ECS: Elastic Container Services ‘Task definition’ similar to docker-compose project AWS ECS will handle distribution over availability zones, VPC etc. AWS ECS will auto-scale on demand (based on CloudWatch alarms)
  • 30. Kubernetes Container orchestrator from Google, rewrite of internal cluster management system First deployment option for Google Cloud Platform Now, they also support simple VM’s Kubernetes manager for free on Google Cloud Platform Maybe also on AWS after next week Existed before Docker Swarm Docker Swarm functionalities built as docker images
  • 32. Kubernetes Pods Pod: ● Set of Containers ● Always on the same node ● Have their own IP address ● Can share volumes ● Always scaled together
  • 33. OpenShift Kubernetes with developer tools added Built-in Docker Registry Image Build Scheduler User Mgmt Self-hosted or cloud solution (openshift.com) Cloud solution free for small project (1 GB total RAM)
  • 34. Demo
  • 35. Conclusion Use docker for projects without microservices? Nope. Use docker for Development? Sure! Use docker for CI/CD? Sure! Use docker for production? Only if you are careful. - Docker Swarm: easier to use, not a long record of stability. - Kubernetes: very complicated to use, known to be stable if configured correctly. - AWS ECS: Somewhere in the middle.