Containerization using docker

Preview:

Citation preview

Containerization using DockerVinod Doshi-- Sr. Manager QA & DevOps, Synerzip Softech India Pvt Ltd.-- Email : vinodkdoshi@gmail.com, vinod.doshi@synerzip.com-- Twitter handle : https://twitter.com/vinodkdoshi-- Linkedin profile : https://in.linkedin.com/in/vinoddoshi

Sumit Ramteke-- Senior Full Stack Developer, Synerzip Softech India Pvt Ltd.-- Email : sumitvramteke@gmail.com,sumit.ramteke@synerzip.com-- Linkedin profile : https://www.linkedin.com/in/sumitramteke

Agenda

● VM’s , IAAS , PAAS and DevOps● Containers vs Virtual Machines● Container architecture and Micro Services● Docker features and Docker ecosystem● CI using Docker● Docker security considerations● Container Orchestration

Virtualization

IAAS and PAAS

CODE REVIEWSAPPLICATION SERVERS CODE COVERAGE

DEPLOYMENT

MONITORING BUILD TOOLS

CLOUD

SOURCE CODE

WEB SERVERS

CONTINUOUS INTEGRATION

LOGGING

RDBMS

NOSQL

ARTIFACTORYCONFIGURATION

MANAGEMENT

CACHING

VIRTUALIZATION

ISSUE MANAGEMENT

CONTAINERIZATION

Containers vs VM’s

Containers

● Run in user space● Have an isolated user space● OS architecture is shared ● Only parts created are bins/libs● Lightweight compared to VM’s

Docker

● Open source project ● Linux namespaces & control groups● Union File System ● Lightweight and fast● Usability● Easy to Modularize apps● Easy to scale apps● Dockerhub as central repository

Micro services

Why Micro Services

● Service oriented architecture● Loosely coupled, Tightly aligned● High Developer productivity● Regressions easy to find, correct● Releases have zero overhead● Rapid iteration using real consumer metrics● Very less overhead in doing a new release● Continuous Delivery

Containerization Technologies

● CoreOS, Rocket● Docker● Redhat containers● AWS PAAS● GCE PAAS● AWS Lambda

Docker setup

● Ubuntu○ Installation using apt-get○ 1.12 aws images on beta signup

● Windows○ Docker Toolbox○ Docker 1.12

● Mac○ Docker Toolbox○ Docker 1.12

Dockerhub

● Dockerhub● Public repository● Private repository● Official images● User submitted images● Private docker infrastructure

Docker images

● What is a docker image● Creating a container from an image● Listing images● Removing images● Removing images● Searching docker images

Docker containers

● Docker hello world● Launching container as daemon● Listing containers● Logging into container● Docker start, stop● Docker pause, unpause● Docker inspect● Deleting container

Docker resource allocation

● -m, --memory=""● --memory-swap=""● --cpuset-cpus=""● -c, --cpu-shares

Docker layers

● List of read-only layers ● Layers have file system differences● New Container adds thin, writable layer

Building images

● Modifying containers● Creating an image● Registering an image

Docker file

● Structure of Docker file● Example Docker file● Building image using a Docker file● Docker file instructions

○ From, Maintainer, Copy○ Add, Env, User, Workdir○ Volume, Expose, Run○ Cmd, Entrypoint, Onbuild

Docker Networking

● Container ip address● Port mapping● Binding to specific ip address● Auto-generating host port

Linking containers

● --link option● Exporting variables● Enabling networking

Sharing data

● Containers are temporal● Data volumes● Sharing host data● Data only containers● Data volumes from other containers

Docker compose

● Multi container application● Installing Docker compose● Structure of compose file● Define logical application● Docker-compose.yml file● Docker-compose command● Launching multi-container app

Debugging containerized applications

● exec● ps● top● stats● logs● Inspect

CI and deployment using Jenkins

● Using Jenkins for CI● Docker plugins● ssh build and deployment

Securing Docker containers

● VM vs Docker containers● Resource Isolation● Cgroups● Non root user● A trusted repository of software● Filesystems need to be read-only● Copy on write● Security-Enhanced Linux

Orchestration

● Running containers on a cluster● High availability● Load balancing and Auto scaling● Mesos, Marathon (Apache project)● Docker Swarm (native Docker v 1.12 )● GCE Kubernetes PAAS (Google project)● AWS ECS PAAS ● AWS containers on Beanstalk PAAS

Amazon EC2 Container Service (ECS)

Manage and Deploy Docker containers at Scale

ECS: Awesome Features

● Docker Compatibility

● Managed Clusters

● Task Definitions

● Programmatic Control

● Scheduling

● Container Deployments

● Local Development

● Monitoring

● Logging

● Repository Support

ECS: Example

Docker Swarm: A Native Cluster

App Architecture

Swarm Cluster Architecture

Final Result

Mesos, Marathon

● Apache project● https://mesosphere.github.io/marathon/● http://mesos.apache.org ● Container orchestration platform

Mesos Master, Mesos Slave, Zookeeper

Mesos, Marathon cluster Demo

● Setup on a VM● Mesos Master dashboard● Marathon dashboard● Launching a hello world job● HA, Auto scaling

Thank YouVinod Doshi

● Email:vinodkdoshi@gmail.com ● Twitter:@vinodkdoshi● Linkedin:https://in.linkedin.

com/in/vinoddoshi

Sumit Ramteke● Email:sumitvramteke@gmail.com ● Linkedin:https://www.linkedin.

com/in/sumitramteke

Recommended