12
Docker Introduction Tomasz Kopczynski Sparkbit

Docker Introduction

Embed Size (px)

Citation preview

Docker IntroductionTomasz Kopczynski

Sparkbit

Classic Deployments

Several environmentsDev

Test

QA

Production

Common problems:Environments not equal to each other (OS, hardware, software versions)

Resources not utilized

Different installation procedures for each environment

www.sparkbit.pl

Docker Overview

• Lightweight containers• Share OS with host (only user space is separate)

• Can be started in seconds

• One container = one application• One system can be built with many containers

• Stateless containers

• Storage containers

• Can be wired together by using docker-compose

www.sparkbit.pl

Docker Architecture

• Docker container is an application with all of its dependencies

• Compared to traditional VM:• No Hypervisor

• No Guest OS

• Containers are isolated

www.sparkbit.pl

Docker Dictionary

• Image – read only snapshot used to build a container

• Container – runtime environment built using an image

• Dockerfile – recipe on how to create an image

• Registry – public or private service for storing images

• DockerHub https://hub.docker.com/ - official public registry, like GitHub for docker images

www.sparkbit.pl

Dockerfile

• Sample app: https://github.com/tkopczynski/spring-boot-docker

• Application should be run by a single command

• Application should run on linux

• Dockerfile:FROM java:8 # Define base image

ADD target/spring-boot-docker.jar spring-boot-docker.jar # Copy application into the image

CMD java –jar /spring-boot-docker.jar # Execute application

www.sparkbit.pl

Predefined Images

• DockerHub offers predefined images with many well-known applications

• docker run -–name mysql –e MYSQL_ROOT_PASSWORD=root –d –p 3306:3306 mysql• mysql –u root –p –H 127.0.0.1 –P 3306

• docker run –-name solr –d –p 8983:8983 –t solr• http://localhost:8983

• And many, many more...

www.sparkbit.pl

Docker Use Cases

• Integration with continuous delivery process • Automatically building images and pushing them to the registry

• Standardized environments • Application doesn’t require anything outside of the container so it is always

executed in the same environment

• Microservices architecture• Manage all microservices as docker images regardless of their technologies

and dependencies

• Scaling• It is possible to automatically spin up new containers during traffic volume

peaks

www.sparkbit.pl

Docker in Continuous Delivery

• After commiting to version control, CI server builds an image with the new version of the application

• Container based on that image is tested

• If tests pass, it is deployed to test, QA and production environments with the same installation procedure

www.sparkbit.pl

Docker in Continuous Delivery

www.sparkbit.pl

Docker in The Cloud

• Some of the providers:• Amazon EC2 Container Service

• Google Container Engine (based on Kubernetes)

• Tutum

• Docker VM Extension in Azure

www.sparkbit.pl

Summary

• Docker is a technology aimed at simplifying DevOps tasks

• Build once, ship and run anywhere principle

• Lightweight containers

• Easily integrated with continuous delivery process and cloud infrastructure

www.sparkbit.pl