mini-training: docker

20
Docker Build, Ship and Run any app, anywhere

Upload: betclic-everest-group-tech-team

Post on 15-Jul-2015

917 views

Category:

Software


0 download

TRANSCRIPT

Docker

Build, Ship and Run any app, anywhere

What is Docker?

Docker is an open platform for developers and sysadmins to build, ship,

and run distributed applications. Consisting of Docker Engine, a portable,

lightweight runtime and packaging tool, and Docker Hub, a cloud service

for sharing applications and automating workflows […]

Solomon Hykes, Docker’s Founder & CTO

What is container?

Container are to virtual machines as threads are to processes. Or

you can think of them as chroot on steroids.

Will Sargent

• More than a sandbox, less than a VM

• Deployable and runnable artifact

• Lightweight Linux environment

Back in time

Server

Host OS

App

Host OS Host OS

Hypervisor Docker

Bin

Server Server

App

App App

V os V os

Bin Bin

App App

Bin Bin

Why using container?

• We are not only shipping code but conf, environment and

code

• Containers are lightweight, fast, isolated and reproducible

environments

• Docker provides a simple way to write, version, build,

deploy and run environments

#> Let’s give a try

#> Run container

#> docker images

#> docker run -t -i ubuntu /bin/bash

#> uname -r

#> docker images

#> docker run -t -i centos /bin/bash

#> uname -r

#> docker images

#> Run container

#> docker pull nginx

#> docker run --name nginx_inst1 -d nginx

#> docker ps

#> docker stop nginx_inst1

#> docker ps

#> docker ps -a

#> docker start nginx_inst1

#> docker ps

#> Container & Host - Network

#> docker run --name nginx_network -d -p 8080:80 nginx

#> curl http://127.0.0.1:8080

#> docker inspect nginx_network | grep IPAddress

#> iptables -t nat -L

#> Container & Host - Filesystem

#> mkdir /docker_nginx_fs

#> echo "Hello World!" > /docker_nginx_fs/index2.html

#> docker run --name nginx_fs -d -p 8081:80 -v

/docker_nginx_fs:/usr/share/nginx/html nginx

#> curl http://127.0.0.1:8081/index2.html

#> Dockerfile

FROM ubuntu:14.04

RUN \

sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \

apt-get update && apt-get install -y mono-complete

ADD ./publish/ /publish

EXPOSE 8123

CMD ["mono", "/publish/HelloWorld.exe"]

#> Build container

#> git clone https://github.com/MiKaDoO/nancyfx-ubuntu-

docker.git

#> docker build -t mickael/hello-nancy

#> sudo docker run -p 8082:8123 -d mickael/hello-nancy

#> curl http://127.0.0.1:8082

#> Your own PAAS

Dokuu is a mini-Heroku powered by Docker written in less than 100

lines of Bash

$ cd node-js-sample

$ git remote add dokku [email protected]:node-js-app

$ git push dokku master

Counting objects: 296, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (254/254), done.

Writing objects: 100% (296/296), 193.59 KiB, done.

Total 296 (delta 25), reused 276 (delta 13)

-----> Building node-js-app ...

Node.js app detected

-----> Resolving engine versions ...

blah blah blah ...

-----> Application deployed:

http://node-js-app.dokku.me

One container ok. But how to

scale?

• Kubernetes by Google

• Apache Mesos

• Marathon

• Docker tools

• Compose, Swarm,

Machine, Hub

How to start?

• Custom server

• Dedian, Ubuntu, Fedora…

• Cloud platform

• Azure, Digital Ocean, App Engine, Aws…

• Your machine

• Boot2Docker

How to start?

• Docker documentation

• DockerCon videos

• Docker Paris meetup

• Pluralsight course

• Twitter university

Thank you

Any question?

Find out more• On https://techblog.betclicgroup.com/

About Us• Betclic Everest Group, one of the world leaders in online

gaming, has a unique portfolio comprising variouscomplementary international brands: Betclic, EverestPoker/Casino, Bet-at-home, Expekt, Imperial Casino, Monte-Carlo Casino…

• Through our brands, Betclic Everest Group places expertise,technological know-how and security at the heart of ourstrategy to deliver an on-line gaming offer attuned to thepassion of our players. We want our brands to be easy to usefor every gamer around the world. We’re building ourcompany to make that happen.

• Active in 100 countries with more than 12 million customersworldwide, the Group is committed to promoting secure andresponsible gaming and is a member of several internationalprofessional associations including the EGBA (EuropeanGaming and Betting Association) and the ESSA (EuropeanSports Security Association).

We want our Sports betting, Poker, Horse racing andCasino & Games brands to be easy to use for everygamer around the world. Code with us to make thathappen.

Look at all the challenges we offer HERE

Check our Employer Page

Follow us on LinkedIn

WE’RE HIRING !