34
Building Reusable Development Environments with Docker Harold Dost Raastech, Inc. CC BY 3.0 US, Harold A. Dost III 1

Building Reusable Development Environments with Docker

Embed Size (px)

Citation preview

Building Reusable Development Environments with Docker

Harold DostRaastech, Inc.

CC BY 3.0 US, Harold A. Dost III 1

About Me

Harold Dost (@hdost)7+ years of Oracle Middleware experienceOCE (SOA Foundation Practitioner)Oracle ACE AssociateFrom Michiganblog.raastech.com

CC BY 3.0 US, Harold A. Dost III 2

About Raastech

» Founded in 2009

» Washington DC area

» Specializes in Oracle Fusion Middleware

» Oracle Platinum Partner

» Oracle SOA Specialized – 1 in 1,500 worldwide

» Oracle Platinum Partner – 1 in 3,000 worldwide

CC BY 3.0 US, Harold A. Dost III 3

Docker

CC BY 3.0 US, Harold A. Dost III 4

The Docker Ecosystem

CC BY 3.0 US, Harold A. Dost III 5

Tools

» Docker Machine

» Docker Engine

» Docker Compose

» Docker Registry

CC BY 3.0 US, Harold A. Dost III 6

Docker Machine» This aids in creating docker hosts

» The target of these can be:

» Cloud Providers

» AWS

» Digital Ocean

» Google Cloud Platform

» Microsoft Azure and Hyper-VCC BY 3.0 US, Harold A. Dost III 7

Docker Machine cont.» Other VM Targets

» OpenStack

» Oracle VirtualBox

» VMware Fusion®

» vCloud® Air™

» vSphere®

CC BY 3.0 US, Harold A. Dost III 8

Docker MachineCreates a dummy machine

docker-machine create --driver virtualbox default

CC BY 3.0 US, Harold A. Dost III 9

Docker Engine

» Basis of Eco-system

» Mediate between containers and host

CC BY 3.0 US, Harold A. Dost III 10

Benefits

» Lightweight

» Walled off from other process

» Repeatable

CC BY 3.0 US, Harold A. Dost III 11

Limitations» Linux Kernel Based OS (Ubuntu, CentOS, Arch, Etc.)

» Minimum of Kernel 3.10

CC BY 3.0 US, Harold A. Dost III 12

How does Docker work?» Control Groups: Limit Resources of Process Groups

» Kernel Namespaces: Isolates resources

CC BY 3.0 US, Harold A. Dost III 13

Definitions» Images

» VM

» Docker

» Container

CC BY 3.0 US, Harold A. Dost III 14

Difference between Containers and VMs 2

2 Image Source: http://www.docker.com/what-docker

CC BY 3.0 US, Harold A. Dost III 15

Dockerfile 1

FROM java:8RUN apt-get updateRUN apt-get install -y maven nodejsEXPOSE 9000WORKDIR /appCOPY app /appRUN chown -R appuser /appUSER appuserENTRYPOINT mvn spring-boot:run

1 For more information about the Dockerfile format check here.

CC BY 3.0 US, Harold A. Dost III 16

Using Docker Engine» 39 Different commands

» Only covering some of the most used

CC BY 3.0 US, Harold A. Dost III 17

Commands: Retrievepull - Pull an image or a repository from a registry

CC BY 3.0 US, Harold A. Dost III 18

Commands: Create and Deletecreate - Create a new containerrm - Remove one or more containersrmi - Remove one or more images

CC BY 3.0 US, Harold A. Dost III 19

Commands: Start and Stopstart - Start 1+ stopped containersstop - Stop a running containerexec - Run command in running containerrun - Run command in new containerkill - Kill a running containerrestart - Restart a running container

CC BY 3.0 US, Harold A. Dost III 20

Commands: Organizerename - Rename a containertag - Tag an image into a repositorycommit - Create a new image from a container's changes

CC BY 3.0 US, Harold A. Dost III 21

Commands: Etc.cp - Copy files to and from containersport - List port mappingsps - List containersattach - Attach to a running container

CC BY 3.0 US, Harold A. Dost III 22

Docker Compose» Create Multi-container Applications

» Example:

» Java App

» Database

CC BY 3.0 US, Harold A. Dost III 23

Docker Compose» Uses decriptor file compose.yml

» Brings up an application

CC BY 3.0 US, Harold A. Dost III 24

Docker Compose Commandsbuild - Build or rebuild serviceskill - Kill containersup - Create and start containersmigrate-to-labels - Recreate containers to add labelsversion - Show the Docker-Compose version information

CC BY 3.0 US, Harold A. Dost III 25

The docker-compose.yml 3

web: build: . links: - db ports: - "8000:8000"db: image: postgres

3 For more information about file arguments check here.

CC BY 3.0 US, Harold A. Dost III 26

MAVEN Plugins» https://github.com/spotify/docker-maven-plugin

» https://github.com/rhuss/docker-maven-plugin

» https://github.com/wouterd/docker-maven-plugin

CC BY 3.0 US, Harold A. Dost III 27

Real world Demo

CC BY 3.0 US, Harold A. Dost III 28

Using Docker Machine

CC BY 3.0 US, Harold A. Dost III 29

Using Docker Engine

CC BY 3.0 US, Harold A. Dost III 30

Running Composed Docker Containers

CC BY 3.0 US, Harold A. Dost III 31

Perform Tests

CC BY 3.0 US, Harold A. Dost III 32

Questions?

CC BY 3.0 US, Harold A. Dost III 33

Contact» Harold Dost

» @hdost

» [email protected]

CC BY 3.0 US, Harold A. Dost III 34