Simple Ways to Start Using Docker
Container Basics● isolation● packaging
Host Kernel & OS
Uncontained Programs
Packaged Tool
Interaction mode:
1. one-off execution
Examples:
● mvn● nodejs● tcpdump● aws-cli● inspec
Problem: Many tools are complicated to install, configure, maintain, or conflict with other tools
Solution: Package a single tool for use as a direct replacement of a locally-installed binary
Usage: development, operations, training
tool
cfg work
# the general form
alias api-cli='docker run --rm -it \
-e "API_KEY=${API_KEY}" \ # specific host env config
-v "$(pwd):/work" \ # share host work dir
org/api-cli:1.0.0' # specific version
# usage
$ api-cli list-resources
aws-cliimage: qualimente/aws-cli:1.11.28
● created a Docker image with the AWS cli (python), entrypoint ‘aws’● created shell alias ‘aws’ that runs the docker image● provide credentials via AWS_* env vars
result: my AWS tooling now codified and available everywhere to anyone
tcpdumpimage: corfr/tcpdump
● image with tcpdump installed and configured as entrypoint● nice default CMD options for recording all traffic to rotating files
show all traffic crossing the default docker bridge interface
docker run --rm -it --net=host corfr/tcpdump -i docker0
result: can inspect & debug network communications on containers and host
Packaged Environment
Problem: Technical computing environments rely on many tools that are difficult to get working-together
Solution: Package a complete, tested environment to replace a collection of locally-installed binaries and configs
Usage: development, operations, training, production
Alternative to: Vagrant
Interaction mode:
1. one-off execution2. long-lived shell
Examples:
● software development ● infrastructure dev & mgmt● data analysis● security analysis● technical training
tool A
work
sh tool B
cfg
Networking for Web Developers (Udacity)image: skuenzli/udacity-networking:2017-01-01
● Docker image includes tools required to complete course
result: trivial to distribute & [re-]create curated training environment
infrastructure managementimage: https://github.com/qualimente/docker-infra-quickstart/tree/aws-single-region-swarm/Dockerfile
● Docker image includes packer, terraform, entrypoint ‘bash’● provide credentials via AWS_* env vars● can build and promote a set of tools through CI pipeline together
result: infra management env now codified and available everywhere to anyone
Data ScienceBioContainers (https://biocontainers.pro/)
“an open source and community-driven framework which provides system-agnostic executable environments for bioinformatics software.”
● central registry ready-to-use containers https://biocontainers.pro/registry● specify how to create and deploy a BioContainers container/image● provide a complete infrastructure to create, share and request bioinformatics
software images
Packaged Infra Service
Problem: Difficult to develop and deploy cross-cutting infra services; susceptible to resource usage problems
Solution: Deploy a complete, tested application to replace a collection of locally-installed binaries and configs
Usage: test, production
Interaction mode:
1. long-lived service
Examples:
● logging: logstash, fluentd● monitoring: collectd, datadog
service
cfg work
logstashimage: logstash:2.3.4-1
● using ‘official’ logstash Docker image● logstash config provided via volume and cli● resource limits & restart policy!
result: can develop, test, and deploy log-shipping as a distinct, ısolated component
Jenkins 2app: CDeasy
● uses jenkinsci/jenkins:2.35● define plugins in external-mounted plugins.txt● dsl-based job pipelines
result: Jenkins server and job configs now codified and portable
ResourcesWorkshop: Fundamentals of Docker
Feb 9, 2017
Discount: MEETUP01
https://www.picatic.com/qm-docker-engineers-2017-02?code=MEETUP01
Simple Ways to Start Using Dockerhttps://github.com/qualimente/start-using-docker-examples
Udacity Networking for Web Devshttps://www.udacity.com/course/networking-for-web-developers--ud256
@skuenzli
www.qualimente.com