In-Depth Introduction to Docker Neil Peterson Content Developer Microsoft
Agenda Concepts and Terms Running Workload in Containers (Docker Engine) Container Images More Advanced Workload (Docker Compose / Intro to Orchestration)
Concepts and Terms
Containers Introduction What: Virtualization Technology (similar goal as a VM but different guts). Host applications, processes, etc. Shared kernel architecture* Slick ‘image’ system Why: Fast Start Hyper Density Portable Improved dev / test / deploy experience? Potential to change how application are written and datacenters operate.
Docker What: Organization / OSS Project at the forefront of Container management technology. What has Docker done Simplified many aspects of container management Introduced a container image format Developed orchestration and clustering tools
Docker Tech Docker Engine – Docker CLI and REST API. Container Image – template for container instances. Dockerfile – Utility for automation container image creation. Docker Compose – Utility for automation container deployment (multiple containers). Docker Hub – Public registry for Docker images. Docker Swarm – cluster of Docker hosts. Docker Trusted Registry – Private registry for container images. Docker Cloud – centralized provision of cloud based container hosts. Docker Universal Control Plane – centralized management of container hosts and applications. Docker Swarm Mode – Docker 1.12 implementation of Swarm (no longer a separate service).* Docker Service – Docker 1.12 application modeling and deployment system.* Docker For Windows – Docker in a box for Windows. Docker on Windows – native dockerd.exe and docker.exe on Windows Server and Windows 10. Docker For Mac OS X – Docker in a box for Mac OS X.
Demo – Hello World ++ #ITDevConnections
Running Workload Docker Engine and Images
Docker Engine Docker ‘Server’ (dockerd.exe) Docker CLI (docker.exe) Current Version 1.12* - big release Available for Linux and Windows Operations Start / stop / remove container instances Pull / create / remove container images Manage container networks Manager container data volumes
Container Images Containers are created from images Shared between containers Immutable - should not be modified Easy to create Easy to move .via Docker registry
Container Images Container Host Application 1 Application 2 Prerequisites VSRD Prerequisites .NET Prerequisites .NET Prerequisites .NET Base Image Base OS Image Base Image Base Image
From App to Container Develop application (potentially in a container).. Create container Install application Capture into container image
Creating Container Images Manual – docker capture command Dockerfile – automated solution FROM tutum/apache-php ENV connectionString <storage connection string> ENV azurequeue <queue name> RUN apt-get update && apt-get install git -y RUN rm /app/* && mkdir /tmp-app && \ git clone https://github.com/neilpeterson/container-stock-app.git /tmp-app && \ cp -rf /tmp-app/php-stock-front/* /app && \ rm -rf /tmp-app CMD /run.sh
Image Portability Stored and Retrieved in Image Repositories Hub.docker.com Docker Private Registry Others
Demo – Docker and Container Images #ITDevConnections
More Advanced Workload Container Schedulers
Multi-Container Example Get Tweets Container Azure Queue Process Tweets Container Process Process 16 32 2
Docker Compose Single host multi container automation Performs Docker operations in bulk Create service in Docker Swarm version: '2' services: db: image: cholzberger/easymysql environment: user: root password: Password1 right: WRITE url: https://../nepetersform.sql ports: - "3306:3306" app: image: neilpeterson/nepetersfront - 80:80 links: - db:mysql
Container Scheduling / Orchestration Clustering Automation Load balancing Service Discovery Declarative App Modeling Self Heal
Demo – Docker Compose #ITDevConnections