31
Introduction to Docker April 2015, Javier Cortejoso 1

Introduction to docker. Stratio

Embed Size (px)

Citation preview

Introduction to Docker

April 2015, Javier Cortejoso

Foto emotiva

relacionada con lo que

vamos a contar

1

Contact

What is Docker?1 32 First steps Docker ecosystem

ÍNDICE

Javier [email protected]@jcortejoso

2

What is Docker?

3

Technology for manage software containers

1.1.- Software containers

★ Operating-system-level virtualization○ Kernel shared between containers and the host

★ Isolation of each container○ File system○ Network○ Processes○ Users○ Hardware resources

Introduction to Docker

1.- What is Docker?

4

Hardware virtualization VS Software virtualization

Introduction to Docker

1.- What is Docker?

5

Copy-on-write: Layer filesystem

Introduction to Docker

1.- What is Docker?

★ AUFS★ Device Mapper★ BRTFS★ OverlayFS

6

Introduction to Docker

1.- What is Docker?

Copy-on-write: Layer filesystem

7

Introduction to Docker

1.- What is Docker?

Copy-on-write: Layer filesystem

8

Different benefits:

✓ As QA engineer○ Fast development and deployment of test

environment○ More realistic environments

✓ As client○ Container as epic outcome of development

process○ Easier to maintain○ Tangible result

Main idea: The same container for every stage and every user.

Introduction to Docker

1.- What is Docker?

✓ As developer○ Isolated environments for developing○ Easy sharing environments○ Easy deployments of external

dependencies○ Development environments more realistic○ Fast and easy deployment

✓ As devops○ Fast and easy deployment○ No more interdependency problems○ No more compatibility problems○ No matters host’s operating system○ Ease Continuous Integration

9

Using Docker

10

● Docker makes easier to create, distribute and run containers.

● Image: Snapshot of an app with all its dependencies.

● Container: An instance of an image.

● Docker implements a control version (git inspired) to manage versions and distribution of the

images.

2.- Using Docker

Introduction to Docker11

DockerHub: Public Docker image registry

Introduction to Docker

2.- Using Docker

12

● Installing Docker

○ Linux Kernel > 3.8

○ Boot2Docker (Mac and Windows)

● Docker is composed by two main parts:

○ Docker daemon

○ Docker CLI

● Basic Workflow :

○ Building an image: docker build / docker commit

○ Running a container: docker run

○ Sharing an image: docker push / docker pull

Introduction to Docker

2.- Using Docker

13

Demo: Running your first containers

Introduction to Docker

2.- Using Docker

14

● Creating new images. Two ways:

○ Interactively: You can commit a running container: docker commit

○ Imperatively: Using a Dockerfile: Easy to audit, verify, rebuild, upgrade, mantain...

■ Starting from an existing image (FROM ubuntu)

■ Se ejecutan comándos bash (RUN apt-get update && apt-get install vim)

■ Se añaden ficheros (ADD or COPY)

■ Se configura la imágen (EXPOSE; VOLUME; ENTRYPOINT; CMD…)

Introduction to Docker

2.- Using Docker

15

$ docker run --help

Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Run a command in a new container

-c, --cpu-shares=0 CPU shares (relative weight)

--cpuset="" CPUs in which to allow execution (0-3, 0,1)

-d, --detach=false Detached mode: run the container in the background and print the new container ID

-e, --env=[] Set environment variables

-h, --hostname="" Container host name

-i, --interactive=false Keep STDIN open even if not attached

--link=[] Add link to another container in the form of <name|id>:alias

-m, --memory="" Memory limit (format: <number><optional unit>, where unit = b, k, m or g)

--name="" Assign a name to the container

-P, --publish-all=false Publish all exposed ports to random ports on the host interfaces

-p, --publish=[] Publish a container's port to the host. format: ip:hostPort:containerPort | ip::containerPort |

hostPort:containerPort | containerPort (use 'docker port' to see the actual mapping)

--privileged=false Give extended privileges to this container

--rm=false Automatically remove the container when it exits (incompatible with -d)

-t, --tty=false Allocate a pseudo-TTY

-v, --volume=[] Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container)

--volumes-from=[] Mount volumes from the specified container(s)

Introduction to Docker

2.- Using Docker

16

Introduction to Docker

2.- Using Docker

17

Docker ecosystem

18

● Orchestrators

○ Fig / docker-compose

○ Mesos

○ Kubernetes

● Operating Systems distributed and container oriented:

○ CoreOS

○ Project Atomic (RHEL, CentOS, Fedora)

○ OSv

○ VMWare Photon

● Clustering Docker

○ docker-swarm

○ Weave

● Data containers management

○ ClusterHQ - Fleet

3.- Docker ecosystem

● Automatic Deployment

○ docker-machine

○ Chef/Puppet/Ansible

● Web Interfaces

○ Shipyard

○ DockerUI

● Monitoring tool

○ cAdvisor

● Cloud services

○ AWS Beanstalk

○ AWS EC2Container

○ Tutum

○ Google Cloud Container Engine

Introduction to Docker19

Recommended Book

One last thing

Questions?

20

We are hiring!!

One last another thing

★ Metodologías ágiles tipo XP y Scrum.★ Arquitecturas J2EE (Struts, Spring, Hibernate)★ Recién Titulados★ Web semántica★ Big Data★ Aplicaciones móviles

www.paradig.ma www.stratio.com

21

1.- ¿Qué es docker?

Cuestionario

a) Docker es un sistema de virtualización a nivel de sistema operativob) Docker es un sistema de gestión de contenedores de softwarec) Todas las anterioresd) Ninguna de las anteriores

22

1.- ¿Qué es docker?

Cuestionario

a) Docker es un sistema de virtualización a nivel de sistema operativob) Docker es un sistema de gestión de contenedores de softwarec) Todas las anterioresd) Ninguna de las anteriores

23

2.- ¿Qué tecnología permite a Docker limitar los recursos de hardware de un contenedor?

Cuestionario

a) AuFSb) nameservicesc) KVMd) cgroups

24

2.- ¿Qué tecnología permite a Docker limitar los recursos de hardware de un contenedor?

Cuestionario

a) AuFSb) nameservicesc) KVMd) cgroups

25

3.- ¿Cómo se puede abrir una sesión de shell en cualquier contenedor en ejecución?

Cuestionario

a) Conectando a través de una conexión sshb) Utilizando el comando docker runc) Utilizando el comando docker execd) Utilizando el comando docker login

26

3.- ¿Cómo se puede abrir una sesión de shell en cualquier contenedor en ejecución?

Cuestionario

a) Conectando a través de una conexión sshb) Utilizando el comando docker runc) Utilizando el comando docker execd) Utilizando el comando docker login

27

4.- ¿Qué comando de docker permite crear un contenedor?

Cuestionario

a) docker commitb) docker buildc) docker rund) docker start

28

4.- ¿Qué comando de docker permite crear un contenedor?

Cuestionario

a) docker commitb) docker buildc) docker rund) docker start

29

5.- ¿Que afirmación de las siguientes es correcta?

Cuestionario

a) Docker es una tecnología que sustituye a los sistemas de virtualización completa tradicionales (ej.: Virtualbox, VMWare)b) Con docker es posible virtualizar arquitecturas de 32 bits en sistemas de 64 bitsc) Todas de las anterioresd) Ninguna de las anteriores

30

5.- ¿Que afirmación de las siguientes es correcta?

Cuestionario

a) Docker es una tecnología que sustituye a los sistemas de virtualización completa tradicionales (ej.: Virtualbox, VMWare)b) Con docker es posible virtualizar arquitecturas de 32 bits en sistemas de 64 bitsc) Todas de las anterioresd) Ninguna de las anteriores

31