Docker Workshop

Post on 13-Apr-2017

98 views 0 download

transcript

Docker Workshop

A.Rafiee@techpartner.solutionsAhmad Rafiee

Linux Containers

An operating system–level virtualization method for running multiple isolated Linux systems (containers) on a single control host.

Linux Kernel Features used by Linux Containers

• Namespaces• (mnt, pid, net, ipc, uts/hostname, user ids)

• cgroups• (cpu, memory, disk, i/o - resource management)

• AppArmor, SELinux• (security/access control)

• seccomp• (computation isolation)

• chroot• (file system isolation)

What is Docker?

Linux Containers: Docker• A platform for managing Linux Containers• Began as an open-source implementation of the deployment

engine which powers dot Cloud• Started in March, 2013• Provided an easy to use API and powerful• container image management features• Attracted the community very fast• Go programming language

What is Docker?

• Platform to help code, test and deploy applications• Open platform for developers and sysadmins to build,

ship, and run distributed applications.• Light weight containers• Available on most Linux distros• Platform to help code, test and deploy applications

Why Docker?• Ship More Software Faster• Minimal overhead/resource usage• Run thousands of containers• Easy to run your whole production stack locally• Simply share your application with others• Faster delivery of your applications• Deploying and scaling more easily• Fully Automated, Easy To Deploy, Quickly Scale• Run more apps on one host machine• Application portability

Time to Provision:

•Bare metal: 8 to 24 Hours•Cloud VM: 5 to 10 Minutes•Container: 5 to 15 Seconds

Containers vs. VMs

Virtual Machines Containers

Docker Architecture

Docker Architecture

Docker Workflows

Docker Workflows

Docker Installation• Native installation for Linux• Docker Toolbox for Mac and Windows• https://www.docker.com/toolbox• All-in-one Docker installation• Docker Engine• Docker Machine• Docker Compose• Kitematic• Docker Swarm

Docker components

• The Docker Engine• The Docker Client• Docker Image• Docker Registry• Docker Containers

The Docker Engine

• Docker host, the computer running the Docker Engine.• The daemon managing Docker images and containers.• using namespaces and cgroups• It runs on the (Linux-based) Host

The Docker Client

The Docker client, in the form of the docker binary, is the primary user interface to Docker. It accepts commands from the user and communicates back and forth with a Docker daemon.

Images• Read only template used to create containers• Build by you or other docker users• Stored in the docker hub or you local registry• Every image starts from base image

Containers• Isolated application platform• Containers everything needed to run you application• Based on one or more images• Docker containers launched from Docker image• When Docker container runs, it adds a read-write layer on top

of the image

Image vs Container• Docker Image is a class• Docker Container is a instance of class

Docker Tools:• Docker Compose: create and manage multi-container

architectures• Kitematic: Simple application for managing Docker

containers on Mac and Windows• Docker Swarm: orchestrating tool to provision and schedule

containers• Docker Machine: provision hosts and install Docker on them• Virtual Box: Virtualization software to run Docker host for

Mac and Windows

Dockerfile

•  Dockerfile is instructions to build Docker image• How to run commands• Add files or directories• Create environment variables• What process to run when launching container

• Result from building Dockerfile is Docker image

Docker Orchestration• Problems with standalone Docker Running a server cluster on

a set of Docker containers, on a single Docker host is vulnerable to single point of failure!

Docker Swarm

• Native Clustering System• Clustering (management) for Docker.• Manage multiple Docker daemons.• Distribute workloads.

Docker Compose• Tool for defining and running multi-container• applications with Docker in a single file• Fast, isolated development environments using Docker.• Quick and easy to start.