what is this "docker"

73
1 WHAT IS THIS "DOCKER" ? Jean-Marc Meessen

Upload: jean-marc-meessen

Post on 17-Jan-2017

94 views

Category:

Software


5 download

TRANSCRIPT

Page 1: What is this  "docker"

1

WHAT IS THIS "DOCKER" ?Jean-Marc Meessen

Page 2: What is this  "docker"
Page 3: What is this  "docker"

3

I    had    a dream !

Page 4: What is this  "docker"

2

3

My own copy of the database

… that I can break at will

My own iso-prod test environment

… that I can break at will

Easily share my con�guration with colleagues.

DEVOPS !

Page 5: What is this  "docker"

45

...And it became true !

Page 6: What is this  "docker"

5

6

HELLO !Jean-Marc MEESSEN

Brussels, Belgium

"Brol Engineer" @ Worldline

Senior ESB Java Developer

Development Infrastructure Expert

Mentor

Starting in January at Cloudbees

Page 7: What is this  "docker"

7

0:00 / 0:32

Page 8: What is this  "docker"

8

AND YOU ?Developers ?

Ops ?

Security ?

Managers ?

Page 9: What is this  "docker"

9

YOU AND DOCKER ?Never heard about it ?

Some "Proof of Concept" ?

Use it every day ?

In Production ?

Page 10: What is this  "docker"

1011

TODAY’S TALKWhat are "containers" ?

How to start ?

Docker for the Java Dev

Page 11: What is this  "docker"

12

What are "containers" ?

Page 12: What is this  "docker"

12

Page 13: What is this  "docker"

13

Page 14: What is this  "docker"

14

Page 15: What is this  "docker"

1516

DOCKER CONTAINERSis not a virtualization technique,

rather an isolation technology.

Page 16: What is this  "docker"

DOCKER CONTAINERS ARE :cgroups (control groups)

limits CPU, memory, IOs, etc

NameSpaces

isolates and virtualizes system resources

(process, mounts, networking)

Page 17: What is this  "docker"

17

Page 18: What is this  "docker"

18

APPLICATIONS PACKAGED WITH SYSTEMDEPENDENCIES

new packaging paradigm

one application works on Ubuntu with Python 2

second application works on Centos 7.2 with Python 3

Page 19: What is this  "docker"

19

WHAT DOCKER SOLVESEscape the dependencies hell

Fast iterative Infrastructure improvement

Container "loader" & Container "shipper"

(no more "it worked in Dev, now it’s OPS problem")

easy onboarding of Devs.

"Own test environment"

Page 20: What is this  "docker"

2021

How to start ?

Page 21: What is this  "docker"

21

22

NEED A CONTAINER ENABLED "KERNEL"

Page 22: What is this  "docker"

AND FOR WINDOWS OR MAC OS X ?Install a virtual machine (ex VirtualBox)

Ready made bundles:

Docker Toolbox

New, better integrated, clients

Using (corporate) proxies: advanced topic

Page 23: What is this  "docker"

2324

How does it work ?

Page 24: What is this  "docker"

24

25

LET ME SHOW YOU … .

Page 25: What is this  "docker"

HOW DO YOU GET IMAGES ?Note: an image is immutable

you get them from

DockerHub

Corporate Registry

Or build it yourself

Page 26: What is this  "docker"

2627

BUILDING A DOCKER IMAGEDescribed in a Docker�le

Page 27: What is this  "docker"

FROM ubuntu MAINTAINER Kimbro Staken

RUN apt-get install -y software-properties-common python RUN add-apt-repository ppa:chris-lea/node.js RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ precise universe" >> /etc/apt/sources.listRUN apt-get update RUN apt-get install -y nodejs #RUN apt-get install -y nodejs=0.6.12~dfsg1-1ubuntu1 RUN mkdir /var/www

ADD app.js /var/www/app.js

CMD ["/usr/bin/node", "/var/www/app.js"]

Page 28: What is this  "docker"

28

DESCRIBE A COMPLETE INFRASTRUCTUREComplex systems

Fuse ESB server

MQ series servers

Oracle database

Use "docker-compose"

Page 29: What is this  "docker"

28

29

DOCKER-COMPOSEone place to de�ne

your components

how to (docker) build them

what container should start �rst

networks (who can talk to whom)

(data) volumes

Security restrictions

Etc.

Page 30: What is this  "docker"

30

"BUILD, SHIP AND RUN"

Page 31: What is this  "docker"

31

HOW TO LEARN ?Many tutorials available on-line

Developer

Beginner Linux Containers

Beginner Windows Containers

Intermediate (both Linux and Windows)

Operations

Beginner

Intermediate

https://training.docker.com/category/self-paced-online

Page 32: What is this  "docker"

3233

HOW TO LEARN ?Docker playground

http://play-with-docker.com/

Page 33: What is this  "docker"

34

Where is Dockerheading ?

Page 34: What is this  "docker"

34

DOCKER INC.Docker has been surprised by this techno "�are"

Very, very lively Open Source community

"Batteries included"

Standardization (RunC, etc.)

Page 35: What is this  "docker"

35

WELL GROUNDED APPROACHComing from the web hosting world

Page 36: What is this  "docker"

3637

STATUSWas good for development and integration

Start to be usable for Real Life Run

Since December 2015

Page 37: What is this  "docker"

STATUSStart to offer enterprise level solutions

"Docker Datacenter"

Trusted Registry (Image scanning, sig/auth)

Docker Universal Control Plane

Docker Cloud

Page 38: What is this  "docker"

383940

Docker for Java builders

Page 39: What is this  "docker"

40

INTEGRATION TESTS

Page 40: What is this  "docker"

4142

MAVEN INTEGRATIONusing fabric8io/docker-maven-plugin

Page 41: What is this  "docker"

MAVEN SEQUENCEpre-integration-test

execute Docker "build" and "start" goals

execute FlyWay migration

integration-test

execute Failsafe "verify" goal

integration test make extensive use of DBunit

post-integration-test

execute Docker "stop" goal

Page 42: What is this  "docker"

43

MAVEN INTEGRATIONadditional options

(networking, volumes, docker-compose)

�ts nicely in Jenkins

especially V2 and pipeline

(but this is an other story)

Page 43: What is this  "docker"

44

BASE IMAGESseveral base images are available, choose what is bestsuited

openjdk (jdk and jre)

openjdk:alpine

maven

Oracle JDK/JRE is not available from the shelf anymore.Need to build it yourself

Page 44: What is this  "docker"

4546

DEPLOYMENT MODELapp-server

embedded (self contained JAR)

Page 45: What is this  "docker"

47

INSTALLATION MODES/TEST MODESadd the JAR in the right directory

execute the app installation script at image build time

execute the app installation script at container run

Page 46: What is this  "docker"

SINGLE PURPOSE JVMthinks it is alone in the world

JVM defaults based on the machine characteristics

watch out

several JVMs (in Docker) are running on the samemachine

Page 47: What is this  "docker"

48

JVM CONFIGURATIONas on a physical host you need to speci�y/limit thememory/cpu requirement of your JVM

Docker offer the same tools. use them

orchestrator like mesos or kubernetes can help you forthis

beware of Docker exec in Production

Page 48: What is this  "docker"

49

DOCKER IN PRODUCTIONmy point of view of Docker in Production

you need to have a very good understanding of what youdo

still in the early phase

Docker works very well for state less application

State full (with databases, etc) still in infancy. Recentannouncement very promising

Page 49: What is this  "docker"

50

Is Docker secure inProduction ?

Page 50: What is this  "docker"

5152

This is, in general, the reaction…

Page 51: What is this  "docker"

5152

Page 52: What is this  "docker"

53

THE SITUATION WITH DOCKER

Page 53: What is this  "docker"

54

WHAT IS HE LOOKING FOR?

Page 54: What is this  "docker"

55

WHAT IS HE LOOKING FOR?(user) Data

Access other systems

Privilege elevation

Page 55: What is this  "docker"

56

WHAT ARE THE DANGERS WITH DOCKER?Kernel exploits

Denial of service attack

Container breakout

Poisoned images

Compromising Secrets

Page 56: What is this  "docker"

57

IS DOCKER "SECURE" ?A lot of expectations, of illusions

"Silver bullet"

Competition positioning (VM, Con�guration Mgt)

Enviousness

Page 57: What is this  "docker"

5859

"CONTAINER DO NOT CONTAIN !"Wrong perception by the "public"

Tremendous progress in 3 years

but usable…

Page 58: What is this  "docker"

60

EQUIPPED WITH SECURITY TOOLS

Page 59: What is this  "docker"

61

IN PARTICULARCap drop

User namespace

selinux / apparmor

Page 60: What is this  "docker"

CAPABILITY DROPoptions to the "Docker run"

goes beyond the root/non-root dichotomy

example: container with NTP

docker run --cap-drop ALL --cap-add SYS_TIME ntpd

Page 61: What is this  "docker"

6263

SELINUX / APPARMORpro�les are called at each "Docker run"

Allow to go much further in the granularity

this program (ex ping) has no access to the network

Page 62: What is this  "docker"

#include <tunables/global>

profile docker-default flags=(attach_disconnected,mediate_deleted) {

#include <abstractions/base>

network, capability, file, umount,

deny @{PROC}/{*,**^[0-9*],sys/kernel/shm*} wkx, deny @{PROC}/sysrq-trigger rwklx,

deny mount,

deny /sys/[^f]*/** wklx, deny /sys/f[^s]*/** wklx,

Page 63: What is this  "docker"

6465

"CLEAN" CONTAINERS?

Page 64: What is this  "docker"

64

66

Malicious contents

Contains vulnerabilities or bugged applications

Page 65: What is this  "docker"

67

TRUSTED REGISTRYSystematic use of TLS

Re-enforcement of the layers integrity

Upgraded with version 1.10

Page 66: What is this  "docker"

NOTARYSystem of image signature and its validation

Validation of the author and content non alteration

Protection Against Image Forgery

Protection Against Replay Attacks

Protection Against Key Compromise

Clever usage of physical key storage

Page 67: What is this  "docker"

68

NAUTILUS(now called "Docker Security Scanning")

Docker image scanner

vulnerabilities (CVE check)

Licence validation

Image Optimisation

Simpli�ed functional tests

Page 68: What is this  "docker"

69

RECOMMENDATIONS

Page 69: What is this  "docker"

70

RECOMMENDATIONSKeep your host/images up-to-date

"Bulkheading"

Seperate disk partition for Docker

Don’t run other (non-Docker) applications on the samehost

Container in a VM ?

Limit inter-container communications

log/audit trails

Access control

Page 70: What is this  "docker"

71

RECOMMENDATIONSDo not use "priviliged" if it is not necessary

Applicative users in the containers

Where are my images coming from ? are they up-to-date ?

Access rights on the �les

Page 71: What is this  "docker"

7273

CONCLUSIONS"Is Docker 'secure' ?"

No more or less then the door of an apartment

Security is everyone’s business : DevOps + SecOps

Page 72: What is this  "docker"

74

THANK YOU !

Page 73: What is this  "docker"

CONTACT INFO

Twitter: @jm_meessen

[email protected]