3 hours to docker fundamentals - jumpstart your docker knowledge
Upload: flux7-award-winning-it-consultancy-focused-on-cloud-containers-cicd-and-configuration-managemen
Post on 15-Apr-2017
714 views
TRANSCRIPT
![Page 1: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/1.jpg)
3 hours to Docker fundamentals: Jumpstart your Docker knowledge
Presented by Aater Suleman
Jay Patel Oct 3, 2014
![Page 2: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/2.jpg)
Today’s Presenters:Aater Suleman Co-founder & CEO Flux7
Faculty, University of Texas at Austin
Flux7: Cloud and DevOps SolutionsCloud and Devops for Web teams
Enterprise DevOps management
AWS Certified Team
Clients:Partners:
![Page 3: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/3.jpg)
Today’s Presenters:Jay Patel Cloud Engineer at Flux7
MS, University of Texas at Austin
Flux7: Cloud and DevOps SolutionsCloud and Devops for Web teams
Enterprise DevOps management
AWS Certified Team
Clients:Partners:
![Page 4: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/4.jpg)
Why Learn Docker?
Fastest growing IT Technology I have seen
in my career
50K+ downloads in less than 30 days of public
introduction
Over 100 Fortune 500s are toying with Docker
already
Docker is impacting the way we code, the way we test, and the way we deliver
![Page 5: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/5.jpg)
Docker is Attracting Investors!
![Page 6: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/6.jpg)
Today’s Agenda
Basic concepts and Docker terminology
Docker Commands
Must know Docker features
Docker in real world
(implemented by
Flux7)
Docker Hands-on Tutorial
![Page 7: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/7.jpg)
Today’s Agenda
Basic concepts and Docker terminology
Docker Commands
Must know Docker features
Docker in real world
(implemented by
Flux7)
Docker Hands-on Tutorial
![Page 8: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/8.jpg)
Lightweight Portable Cross Cloud Infrastructure
Docker’s attraction lies in its
![Page 9: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/9.jpg)
But, Why Docker?
![Page 10: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/10.jpg)
Sounds familiar?
Ineffective code pipeline management
Inconsistency across environments
Mismatches in dev and prod environments
Resource provisioning takes ages
Increasing bills
![Page 11: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/11.jpg)
Build Once, Configure Once & Run Anywhere
Docker in Docker terms...
![Page 12: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/12.jpg)
Docker Components & Elements
Docker Client is the user interface that allows communication between the user
and the Docker daemon
Docker Daemon sits on the host machine answering requests for services
Docker Index is a centralized registry allowing backup of Docker container
images with public and private access permissions
![Page 13: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/13.jpg)
Docker Components & Elements
Docker Containers are the actual containers running the applications and includes the operating system, user added files, and meta-data
Docker Images are all inclusive images that help launch Docker containers
DockerFile is a file containing instructions that help automate image creation
Layer: Each file system that is stacked when Docker mounts rootfs
![Page 14: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/14.jpg)
Today’s Agenda
Basic concepts and Docker terminology
Docker Commands
Must know Docker features
Docker in real world
(implemented by
Flux7)
Docker Hands-on Tutorial
![Page 15: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/15.jpg)
Installing Docker
Let’s discuss how to install Docker in Amazon Linux AMI
Install Docker using a single command:
sudo rpm install docker
![Page 16: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/16.jpg)
Basic Commands
docker pull Pull a pre-built image from the public repos
docker run Run the container in one of 3 modes: Background, Foreground, Interactive
docker logs View the logs of the running job
docker commit Save the container state as an image
docker images Obtain a list of all images
![Page 17: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/17.jpg)
More Docker Commands
docker diff List of changes in files and directories (one of the powerful commands Docker provides)
docker build Build docker images from Dockerfiles
docker inspect Low-level information about containers and images
docker attach Interact with running containers
docker kill Kill the main process of the container
![Page 18: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/18.jpg)
Today’s Agenda
Basic concepts and Docker terminology
Docker Commands
Must know Docker features
Docker in real world
(implemented by
Flux7)
Docker Hands-on Tutorial
![Page 19: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/19.jpg)
DockerFile
Automates Image creation process
Set of instructions to create an image
General DockerFile commands’ syntax:
INSTRUCTION argument
![Page 20: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/20.jpg)
DockerFile Commands
MAINTAINER <author name> Set an author field for the image
RUN <command> Execute a command in a shell or exec form
ADD <src> <destination> Copy files from one location to another
CMD["executable","param1","param2"] Provides defaults for an executing container
EXPOSE <port>; Port on which container listens to
![Page 21: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/21.jpg)
DockerFile Commands
ENTRYPOINT [‘executable’,
‘param1’,’param2’]
Configure a container as an executable
WORKDIR /path/to/workdir Set Working Directory
ENV <key> <value> Set environment variables
USER <uid> Set UID for use when running an image
VOLUME [‘/data’] Enable access to a directory from a working container
![Page 22: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/22.jpg)
Docker Hub
Centralized Management of
User Accounts
Image Checksums
Public and Private Docker Repositories
![Page 23: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/23.jpg)
Today’s Agenda
Basic concepts and Docker terminology
Docker Commands
Must know Docker features
Docker in real world
(implemented by
Flux7)
Docker Hands-on Tutorial
![Page 24: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/24.jpg)
Docker Hands-on
![Page 25: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/25.jpg)
Installation
Install VMWare from USB stick
Install the Linux image from USB stick
Install Docker
![Page 26: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/26.jpg)
The BusyBox Test
Pull busybox container
Run ls inside of Docker
![Page 27: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/27.jpg)
Docker run
Run with only the main process
Run interactively
Run in daemon mode
![Page 28: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/28.jpg)
Docker diff
![Page 29: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/29.jpg)
Docker commit
![Page 30: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/30.jpg)
Docker create
Using Dockerfile
Tips on Dockerfile
![Page 31: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/31.jpg)
DockerHub
Create a new repo
![Page 32: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/32.jpg)
Docker push
Pushing a container to Dockerhub
![Page 33: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/33.jpg)
Volumes
Create container with 2 volumes
Mount Data volumes into application container
![Page 34: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/34.jpg)
Port Forwarding
Auto-map all exposed ports to host
Binding a port to a host interface
![Page 35: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/35.jpg)
DockerFile
# sshd## VERSION 0.0.1
FROM ubuntuMAINTAINER Thatcher R. Peskens "[email protected]"
# make sure the package repository is up to dateRUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.listRUN apt-get update
RUN apt-get install -y openssh-serverRUN mkdir /var/run/sshd RUN echo 'root:screencast' |chpasswd
EXPOSE 22CMD /usr/sbin/sshd -D
Dockerfile to set up an sshd service in a container
![Page 36: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/36.jpg)
Today’s Agenda
Basic concepts and Docker terminology
Docker Commands
Must know Docker features
Docker in real world
(implemented by
Flux7)
Docker Hands-on Tutorial
![Page 37: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/37.jpg)
Docker in Real-World
Simplifying Configuration
Developer Productivity
Multi-Tenancy
Server Consolidation
App Isolation
Code Pipeline Management
Debugging Capabilities
Rapid Deployment
![Page 38: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/38.jpg)
Australia’s 5th largest solar panel installer
Application: Solar Panel Monitoring
Case Study 1: Quick and Easy Multi-tenancy using Docker
![Page 39: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/39.jpg)
Business Problem
Low customer engagement ⇒ limited upsell opportunities
Unhappy customers stuck by large electricity bills
Low collection rates on leased units
![Page 40: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/40.jpg)
Measure power output at solar panels Store data
Create reports
Status Indicator
Monitoring
Customer 1 Customer 2
Customer n
Controlling
![Page 41: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/41.jpg)
Customer 2Customer 1
Measure power output at solar panels
Customer n
Status Indicator
Monitoring
Store dataCreate reports
Controlling
![Page 42: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/42.jpg)
Status Indicator
Monitoring
Store dataCreate reports
Customer 2Customer 1
Measure power output at solar panels
Customer n
Controlling
![Page 43: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/43.jpg)
Multi-tenancy
Scenario:
![Page 44: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/44.jpg)
The Dev Solution: Add Tenant ID in Code and Database
![Page 45: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/45.jpg)
Tedious Error prone Code
changes
Downsides
![Page 46: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/46.jpg)
The Ops Solution:
New set of servers per tenant
![Page 47: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/47.jpg)
Low Utilization High Cost
Downsides
High Maintenance
![Page 48: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/48.jpg)
Page load time
Why not Leaner Servers?
> 5 seconds
![Page 49: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/49.jpg)
The DevOps Solution:
New Docker containers for every tenant
![Page 50: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/50.jpg)
Inexpensive
Up to 30 tenants per large AWS
instance
Page loads under 1 second
Benefits
Fast
Implemented in under 2 weeks with NO code changes
![Page 51: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/51.jpg)
DevOps
Take Aways
Dev or Ops alone >
![Page 52: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/52.jpg)
Case Study 2: Improved Developer Workflow using Docker
Application: National & International Automotive Listing
![Page 53: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/53.jpg)
Auto.com’s “Big Plan” for Cloud
Push-Button deployment of infrastructure:
Inclusive of everything from
Security
App and Database servers
Load Balancing
SOA
Queues
Data Processing
![Page 54: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/54.jpg)
Local Dev Environment That Matches Prod
The “Holy Grail” of dev environment management
Now possible in all its complexity due to Docker.
![Page 55: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/55.jpg)
Why Developer Workflow?
![Page 56: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/56.jpg)
Web Developer Workflow
Developer Local Test QA Production
Least expensive but most executed
Most expensive but least executed
![Page 57: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/57.jpg)
Development Environment
Developer Local Test QA Production
Least expensive but most executed
Most expensive but least executed
95-99% of developer time is spent in
the development environment
![Page 58: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/58.jpg)
Developer environment must be ...
Quick Production-like Repeatable
![Page 59: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/59.jpg)
Production-like
Each tier runs same OS & software versions
Tiers are isolated from each other as in production
Tiers are isolated from the developers device
[A client] never realized they needed to run gem install bundle on a tier until we put the two services on different servers.
![Page 60: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/60.jpg)
Production-like
Our URL: http://xxxx.xxxxxx.xxx is not loading in IE and Safari but is in
Chrome/Firefox. This is only in AWS QA and not in AWS DEV or PROD. We are
wondering if there is something in the infra that is causing this behavior.
-Thx
![Page 61: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/61.jpg)
Quick
Waiting Frustration Distraction
“When I fire a local QA run in a mature project, it takes 8 mins. I check cricinfo.com and facebook while it runs”
Developer at a Fortune 100 company
![Page 62: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/62.jpg)
Repeatable
Here is a Bash script to run on
your device
Follow these docs and ask away if any questions
Here is a Vagrant file
Install software PHP and MySQL on your device
Prone to human errors Prone to 3rd party changes
![Page 63: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/63.jpg)
Repeatable
Here is a Bash script to run on
your device
Follow these docs and ask away if any questions
Here is a Vagrant file
Install software PHP and MySQL on your device
Prone to human errors Prone to 3rd party changes
[A client] supported MySQL Percona v5.53x. Vendors updated the version to 5.54 and broke our software.
![Page 64: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/64.jpg)
Our Solution
Developer Local Test QA Production
![Page 65: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/65.jpg)
One Docker container for each application tier
Run a VM with folder sync and port forwarding
Installs Docker Downloads containers (if not available)
Used to bootstrap Docker containers in dev and AWS instances in prod
![Page 66: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/66.jpg)
AppWeb
DB
LogStashMem
$
HTTP
SSH
Virtualbox VM
App Code and Logs
Laptop
devenv.sh for interacting with
the setup
Docker Containers
Redis
![Page 67: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/67.jpg)
Result: We no longer hear ...
“works on my machine but not on yours”
“I have been helping the [new hire]
setup her environment all day”
“IT guys must do something differently in staging”
“I can’t try it because IT has not
updated the dev environment”
![Page 68: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/68.jpg)
Who sees the benefit?
Backend Developers
● Homogenous environment● Quick feedback● Agile: break it fearlessly
Front-end HTML Devs
● Quick visual feedback with populated data
● Avoid installations
Ops
Only one standardized dev environment to support
Management
● Less conflict● Faster time to market● Happier engineers● Easier hiring
![Page 69: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/69.jpg)
Why we used Docker?
Minimal Performance
Overhead
Fast Boot and Shutdown
Smaller files sizes and ability to diff
containers
Container will run in the
Cloud
![Page 70: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/70.jpg)
Variation: Today
Developer Local Test QA Production
![Page 71: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/71.jpg)
Variation
Developer Local Test QA Production
Use Docker alone with boot2docker and Dockerfiles
Requires docker in entire workflow including prod
Docker will release version 1.0 soon
![Page 72: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/72.jpg)
These Scripts Make a Working System
bootstrap_container
bootstrap_containers
build_base_image
build_from_scratch
clean_for_docker
copy_etc_hosts
create_etc_hosts
create_etc_hosts_for
deploy_app
help
plumb_container
plumb_containers
prep_vm
provision_container
push_etc_hosts
restart_container
restart_unicorn
retry_thrice
rm_containers
run_container
run_container_raw
run_containers
setup_ssh_keys
stop_container
stop_containers
![Page 73: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/73.jpg)
A Full Production Database on a Laptop?
Multi-GB Production database won’t run
on a laptop
Strategically sampled data set
The Solution
Rule: Development uses fresh production data
![Page 74: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/74.jpg)
SQS Runs In Cloud … Not A Laptop
Production uses Amazon SQS
Rule #2: No AWS Dependencies in Dev
Modified app to use RabbitMQ
Rule #1: Environment is Identical in Dev to Prod
The Solution
![Page 75: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/75.jpg)
Service Addressing In Dev
Production uses static IP addresses
dev uses /etc/hosts,
prod uses Route53
Rule: Service addressing transparent between Dev and
Prod for developers
The Solution
![Page 76: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/76.jpg)
Automation Benefits
Innovation: Easier to Innovate when cost of being wrong is low
Continuity: Organizational ownership of operations knowledge - very valuable for business continuity.
Faster Iteration: High fidelity and confidence in Dev and QA means means faster iteration of product
Talent: Willingness to experiment with advanced technology like docker attracts talented contributors to our team
![Page 77: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/77.jpg)
Application: e-invoicing, ERP, Dynamic Discounting, AP automation, Workflow, supplier self service, Treasury Strategy, vendor portal,
supply chain finance, e-invoicing network, and Oracle based solutions
Case Study 3: QA using Docker
![Page 78: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/78.jpg)
Problems
QA jobs take long
Tests need to run in parallel, but conflict with each other
Run different instances of test in different Docker container
![Page 79: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/79.jpg)
Setup
Jenkins runs QA jobs
Jenkins slaves are Docker hosts
Dockerfile is used to create a generic image
![Page 80: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/80.jpg)
Process
Jenkins checks out latest code from Git
Jenkins starts a new container on one of
the slaves
A container is built using Dockerfile
Jenkins workspace is attached to
container as volume
Code is compiled and tests are run
Test results are put in the Jenkins
workspace
Jenkins copies results back as
Artifacts
![Page 81: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/81.jpg)
Application: 3D Printing
Case Study 4: Efficient and Easy Code Deployment using Docker
![Page 82: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/82.jpg)
Problems
Deploy code conveniently to production from laptop
![Page 83: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/83.jpg)
Setup
Use Dockerhub as code delivery mechanism
A staging environment, and a Production environment in AWS
![Page 84: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/84.jpg)
Process
Build containers in Staging, test, and
push to DockerHub
Push triggers a pull of containers on instances
Containers are killed and new containers are
started
![Page 85: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/85.jpg)
Other Docker Projects Flux7 has impacted
Djed Studios
Trucking Office
![Page 86: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/86.jpg)
Docker Austin Meetup is participating in the Global Docker
Hackday
![Page 87: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/87.jpg)
Thank You!
Twitter: @Flux7Labs
Blog: blog.flux7.com
![Page 88: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/88.jpg)
BACKUP
![Page 89: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/89.jpg)
Demo
How to start the environment?
How to stop the environment?
How to edit code and refresh in the
browser?
![Page 90: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/90.jpg)
Docker on EB
10 Step Deployment Process
![Page 91: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/91.jpg)
Elastic BeanStalk
AWS Elastic BeanStalk
✓ PaaS
✓ Application deployment and scaling
Supports: PHP, Node.js, Ruby, Python, Java, .NET, and now Docker!
![Page 92: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/92.jpg)
EB Working in 3 steps
Choose Software stack
✓ Provisioning env✓ Deploying Code ✓ Load Balancing✓ Autoscaling ✓ Health Monitoring
URL to access the application
![Page 93: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/93.jpg)
Pre-Docker
Limited stack options
Forced to choose predefined versions
Limited AMI customization
![Page 94: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/94.jpg)
Post-Docker
Docker provides flexibility
Ability to choose any stack (Go, C++???)
![Page 95: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/95.jpg)
3 Methods
Create a Dockerfile and
upload it to EB.Create a Dockerrun.aws.
json file to deploy an
existing Docker image.
Create a zip file with
Dockerfile, Dockerrun.
aws.json, and any
application file, then
upload to EB.
1 3 2
![Page 96: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/96.jpg)
3 Methods
Create a Dockerfile and
upload it to EB.Create a Dockerrun.aws.
json file to deploy an
existing Docker image.
Create a zip file with
Dockerfile, Dockerrun.
aws.json, and any
application file, then
upload to EB.
1 3 2
![Page 97: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/97.jpg)
no ADD commands in Dockerfile AND first exposed PORT is what I need AND base image is public
How to Choose your method?
Image is in a repo and no changes are needed, use Dockerrun.aws.json
Zip Dockerfile, Dockerrun.aws.json, and other files and upload
Use dockerfileUse Dockerrun.aws.json
Default
![Page 98: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/98.jpg)
Deploy a pre-baked Container to AWS EB
Step 1: Create S3 bucket
![Page 99: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/99.jpg)
Step 2: Commit Docker image
Create and commit a Docker image with all required packages
![Page 100: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/100.jpg)
Step 3: Create Docker Auth Config File
Login to Docker repo
For each login, a .dockerconfg file will be created
Upload this file to S3
EB gains access to Docker repo through S3
![Page 101: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/101.jpg)
Step 4: Create Dockerrun.aws.json
Configuration file to deploy a container in EB: {"AWSEBDockerrunVersion" : "1", "Authentication": { "Bucket": "flux7.com", "Key": "dockercfg"}, "Ports": [ { "ContainerPort": "80" }]}
![Page 102: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/102.jpg)
Step 5: Create Dockerfile
Sample Dockerfile
# VERSION 0.0.1
FROM flux7/wp-site # This is the location of our docker container.
RUN apt-get install supervisor
RUN mkdir -p /var/log/supervisor
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
EXPOSE 80
CMD supervisord -c /etc/supervisor/conf.d/supervisord.conf
![Page 103: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/103.jpg)
Step 7: Create IAM role
Create IAM Role
Set user access policy with S3 bucket access
![Page 104: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/104.jpg)
Step 8: Compress the files into a ZIP
Note: Do not copy into directory and ZIP
![Page 105: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/105.jpg)
Step 9: Create EB environment
Create a new application
Set appropriate configuration details and environment tags
Choose the appropriate VPC and VPC security group
Review configuration and launch the environment
![Page 106: 3 hours to Docker fundamentals - Jumpstart your Docker Knowledge](https://reader033.vdocuments.mx/reader033/viewer/2022051503/587a9d571a28ab09758b639d/html5/thumbnails/106.jpg)
Step 10: Update Docker Containers
To deploy new code to EB
Create a new Docker image
Push to Docker repo