SlideShare a Scribd company logo
1 of 35
Download to read offline
Docker Paris meetup #1 – 10/02/2013
Victor Vieux, dotCloud Inc.
@vieux
Outline
•  Intro to Docker
•  Installing Docker
•  Basic commands
•  Demo: Simple deployment
•  Questions
Quick survey
•  How many people have heard of Docker
before this Meetup ?
•  How many people have tried Docker ?
•  How many people are using Docker in
production ?
Introduction to Docker
Origins of Docker
•  Docker is a rewrite of similar code that
currently powers the dotCloud PaaS
•  Original version written in Python (like
dotCloud PaaS), now written in Go
•  It’s a young project (~6 months), but with a
huge community.
Docker Timeline
•  January 2013 Docker started as an internal project
inside of dotCloud
•  March 21, 2013 Solomon gives Docker lightning
talk a PyCon US
•  March 27, 2013 Docker 0.1 released to Public
•  September 4, 2013 Docker merged into Openstack
for the Havana release
•  September 19, 2013 Partnership with Red Hat
around OpenShift
•  September 27, 2013 Docker 0.6.3 released
In the first 6 months
•  6000+ Github stars
•  150+ Contributors
•  50,000+ docker index pull
•  100’s of projects built on top of Docker
– UIs (DockerUI, Shipyard, Dockland…)
– Open Source PaaS (DEIS, Flynn, Dokku…)
– Continuous Deployment (Strider…)
•  1700’s Dockerized applications on Github
What is Docker ?
“Docker is an open-source engine to
easily create lightweight, portable,
self-sufficient containers from any
application. The same container that
a developer builds and test on a
laptop can run at scale, in production,
on VMs, OpenStack cluster, public
clouds and more.”
How does Docker work ?
•  LinuX Containers (LXC)
•  Control Groups & Namespaces
•  AUFS
•  Client – Server with an HTTP API
LinuX Containers (LCX)
•  Let’s your run a Linux system within another
Linux system
•  A container is a group of processes on a
Linux box, put together is an isolated
environment
•  From the inside, it looks like a VM
•  From the outside, it looks like normal
processes
•  “chroot on steroids”
Why Containers?
•  Speed: Boots in seconds
•  Footprint: 100-1000 containers on one
machine. Small disk requirements
Containers vs. VMs
Control Groups & Namespaces
Linux kernel feature to limit, account and
isolate resource usage, such as:
– CPU
– Memory
– Disk I/O
AUFS
	
  
•  File system that implements union mount.
	
  
	
  
	
  
•  Supports Copy On Write (COW):
	
  
	
  
	
  
# mount –t aufs –o br=/files1:/files2 none /files
	
  
	
  
	
  
# mount –t aufs –o br=/tmp=rw:/bin=ro none /files
	
  
	
  
Installing Docker
Requirements
•  Linux Kernel 3.8 or above
•  AUFS
•  LXC
•  64-bit
Installations
•  Ubuntu Linux
•  Binaries
•  Using Vagrant
More on: http://docs.docker.io/en/latest/installation
Installation: Ubuntu Linux
•  AUFS support
$> sudo apt-get update
$> sudo apt-get intall linux-image-extra-`uname –r`
•  Add Docker repository
$> sudo sh –c “curl https://get.docker.io/gpg | apt-key add -”
$> sudo sh –c “echo deb http://get.docker.io/ubuntu docker 
main > /etc/apt/sources.list.d/docker.list”
•  Install
$> sudo apt-get update
$> sudo apt-get install lxc-docker
Installation: Binaries
•  Get the docker binary
$> wget –output-document=docker https://get.docker.io/builds/
Linux/x86_64/docker-latest
$> chmod +x docker
•  Run the docker daemon
$> sudo ./docker –d &
•  Use your own system startup script
	
  
Installation: Vagrant
•  Clone the Docker repository
$> git clone https://github.com/dotcloud/docker.git
•  Startup the vagrant image
$> vagrant up
	
  
•  SSH into the image
$> vagrant ssh
•  Docker client works on Mac
Basic	
  commands	
  
Classic: hello world
•  Get one base image (ubuntu, centos, busybox,…)
$> docker pull ubuntu
•  List images on your system
$> docker images
	
  
	
  
•  Print hello world
$> docker run ubuntu:12.10 echo “hello world”
	
  
Detached mode
•  Run	
  in	
  Docker	
  using	
  the	
  detach	
  flag	
  (-­‐d)	
  
$> docker run –d ubuntu sh –c “while true; do echo hello
world; sleep 1; done”
•  Get	
  container’s	
  id	
  
$> docker ps
•  A:ach	
  to	
  the	
  container	
  
$> docker attach <container_id>
	
  
•  Stop/Start/Restart	
  the	
  container	
  
$> docker stop <container_id>
	
  
Containers vs Images
•  Remove a file from an image
$> docker run busybox rm /etc/passwd
•  The file is still there ??
$> docker run busybox cat /etc/passwd
•  Commit the newly created to an image
$> docker ps –n=2 #get the container’s id
$> docker commit <id> vieux/broken-busybox
	
  
•  The file is gone
$> docker run vieux/broken-busybox cat /etc/passwd
Public Index & Network
•  Pull an apache image from the public index
$> docker search apache
$> docker pull creack/apache2
•  Run the image and check the ports
$> docker run –d creack/apache2
$> docker ps
•  Expose public ports
$> docker run –d –p 8888:80 –p 4444:443 creack/apache2
$> docker ps
	
  
Creating your 1st app: the interactive way
•  Using docker in interactive mode
$> docker run –i –t ubuntu bash
root@82c63ee50c3d:/#
root@82c63ee50c3d:/# apt-get update
[…]
root@82c63ee50c3d:/# apt-get install memcached
[…]
root@82c63ee50c3d:/# exit
•  Commit the image
$> docker commit `docker ps –q –l` vieux/memcached
•  Start the image
$> docker run –d –p 11211 –u daemon vieux/memcached memcached
Creating your 1st app: the boring way
•  Multiple run / commit
$> docker run ubuntu apt-get update
$> $ID=(docker commit `docker ps –q –l`)
$> docker run $ID apt-get install memcached
$> docker commit `docker ps –q –l vieux/memcached
•  Define default configuration at commit
$> docker commit –run=‘{“Entrypoint”: [“memcached”]}’ […]
•  Start the image
$> docker run –d –p 11211 –u daemon vieux/memcached
Creating your 1st app: the scripted way
•  Write a Dockerfile
# Memcached
FROM ubuntu
MAINTAINER Victor Vieux <victor@dotcloud.com>
RUN apt-get update
RUN apt-get install –y memcached
ENTRYPOINT [“memcached”]
USER daemon
EXPOSE 11211
•  Buid the image
$> docker build –t=vieux/memcached .
•  Start the image
$> docker run –d vieux/memcached memcached
Volumes and bind mounts
•  Put your persistent data in a volume
$> $ID=(docker run –d –v /var/lib/mysql vieux/mysql)
•  So you can re use it in another container
$> docker run –d –volumes-from=$ID vieux/mysql
	
  
•  Bind mounts
$> docker run –d –v /home/vv:/home <image>
•  Supports read only / read write
$> docker run –d –v host/path:container/path:rw <image>
Other commands
•  docker cp #copy a file from container to host
•  docker diff #print container changes
•  docker top #display running processes inside a container
•  docker rm/rmi #delete container/image
•  docker wait #wait until container stop and print exit code
More on: http://docs.docker.io/en/latest/commandline/cli
Demo:
Simple deployment
Local development
•  App running in prod
http://ks3100989.kimsufi.com:8080/
•  Build local
	
  $> docker build –t=gcm .
•  Test local
$> docker run –p 49200:8080 gcm
	
  http://localhost:49200
•  Change some files
•  Rebuild & test
$> docker build –t=gcm .
$> docker run –p 49200:8080 gcm
Push to prod
•  Tag image in order to push it
$> docker tag gcm ks3100989.kimsufi.com:5000/gcm
•  Push image to local registry
$> docker push ks3100989.kimsufi.com:5000/gcm
•  On production server, download image
$> docker pull ks3100989.kimsufi.com:5000/gcm
•  Restart the container
$> docker stop <container_id>
$> docker run –d –p 8080:8080 <image>
Questions ?
Thank you!
@vieux

More Related Content

What's hot

Docker workshop
Docker workshopDocker workshop
Docker workshop
Evans Ye
 

What's hot (19)

Running Django on Docker: a workflow and code
Running Django on Docker: a workflow and codeRunning Django on Docker: a workflow and code
Running Django on Docker: a workflow and code
 
Docker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken CochraneDocker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken Cochrane
 
Docker & JVM: A Perfect Match
Docker & JVM: A Perfect MatchDocker & JVM: A Perfect Match
Docker & JVM: A Perfect Match
 
2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com2015 DockerCon Using Docker in production at bity.com
2015 DockerCon Using Docker in production at bity.com
 
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05
 
Hands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbiesHands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbies
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
 
Docker Workshop
Docker WorkshopDocker Workshop
Docker Workshop
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
 
Docker
DockerDocker
Docker
 
Docker DANS workshop
Docker DANS workshopDocker DANS workshop
Docker DANS workshop
 
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: Introduction
 
Docker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesDocker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutes
 
CoreOS Overview
CoreOS OverviewCoreOS Overview
CoreOS Overview
 
Django via Docker
Django via DockerDjango via Docker
Django via Docker
 
Docker workshop
Docker workshopDocker workshop
Docker workshop
 
Docker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12XDocker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12X
 
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
Puppet Camp Chicago 2014: Docker and Puppet: 1+1=3 (Intermediate)
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 

Viewers also liked

Docker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in Production
Docker, Inc.
 
Intro to Docker October 2013
Intro to Docker October 2013Intro to Docker October 2013
Intro to Docker October 2013
Docker, Inc.
 
DockerCon14 Contributing to Docker by Tianon
DockerCon14 Contributing to Docker by TianonDockerCon14 Contributing to Docker by Tianon
DockerCon14 Contributing to Docker by Tianon
Docker, Inc.
 
Trust and Image Provenance by Derek McGowan
Trust and Image Provenance by Derek McGowanTrust and Image Provenance by Derek McGowan
Trust and Image Provenance by Derek McGowan
Docker, Inc.
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
Docker, Inc.
 
Introduction to Docker I Docker Workshop @ Twitter
Introduction to Docker I Docker Workshop @ TwitterIntroduction to Docker I Docker Workshop @ Twitter
Introduction to Docker I Docker Workshop @ Twitter
Docker, Inc.
 
DockerCon14 Automated Chef Cookbook Testing
DockerCon14 Automated Chef Cookbook TestingDockerCon14 Automated Chef Cookbook Testing
DockerCon14 Automated Chef Cookbook Testing
Docker, Inc.
 
Dockerizing Stashboard
Dockerizing StashboardDockerizing Stashboard
Dockerizing Stashboard
Docker, Inc.
 

Viewers also liked (20)

Cost Control Across Cloud, On-Premise and VM Computers by Mark Lavi, Calm.io
Cost Control Across Cloud, On-Premise and VM Computers by Mark Lavi, Calm.ioCost Control Across Cloud, On-Premise and VM Computers by Mark Lavi, Calm.io
Cost Control Across Cloud, On-Premise and VM Computers by Mark Lavi, Calm.io
 
Docker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in Production
 
Mobycraft:Docker in 8-bit (Meetup at Docker HQ 4/7)
Mobycraft:Docker in 8-bit (Meetup at Docker HQ 4/7)Mobycraft:Docker in 8-bit (Meetup at Docker HQ 4/7)
Mobycraft:Docker in 8-bit (Meetup at Docker HQ 4/7)
 
Docker Links
Docker LinksDocker Links
Docker Links
 
Intro to Docker October 2013
Intro to Docker October 2013Intro to Docker October 2013
Intro to Docker October 2013
 
DockerCon 16 - Moby's Cool Hack Session
DockerCon 16 - Moby's Cool Hack SessionDockerCon 16 - Moby's Cool Hack Session
DockerCon 16 - Moby's Cool Hack Session
 
Making it Easier to Contribute to Open Source Projects Using Docker Container...
Making it Easier to Contribute to Open Source Projects Using Docker Container...Making it Easier to Contribute to Open Source Projects Using Docker Container...
Making it Easier to Contribute to Open Source Projects Using Docker Container...
 
Tyrion Cannister Neural Styles by Dora Korpar and Siphan Bou
Tyrion Cannister Neural Styles by Dora Korpar and Siphan BouTyrion Cannister Neural Styles by Dora Korpar and Siphan Bou
Tyrion Cannister Neural Styles by Dora Korpar and Siphan Bou
 
DockerCon SF 2015: MomOps in DevOps w/ Mukta Aphale
DockerCon SF 2015: MomOps in DevOps w/ Mukta AphaleDockerCon SF 2015: MomOps in DevOps w/ Mukta Aphale
DockerCon SF 2015: MomOps in DevOps w/ Mukta Aphale
 
DockerCon14 Contributing to Docker by Tianon
DockerCon14 Contributing to Docker by TianonDockerCon14 Contributing to Docker by Tianon
DockerCon14 Contributing to Docker by Tianon
 
Trust and Image Provenance by Derek McGowan
Trust and Image Provenance by Derek McGowanTrust and Image Provenance by Derek McGowan
Trust and Image Provenance by Derek McGowan
 
20 mins to Faking the DevOps Unicorn by Matt williams, Datadog
20 mins to Faking the DevOps Unicorn by Matt williams, Datadog20 mins to Faking the DevOps Unicorn by Matt williams, Datadog
20 mins to Faking the DevOps Unicorn by Matt williams, Datadog
 
Developer Week
Developer WeekDeveloper Week
Developer Week
 
DockerCon SF 2015: Education for a digital world
DockerCon SF 2015: Education for a digital worldDockerCon SF 2015: Education for a digital world
DockerCon SF 2015: Education for a digital world
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
 
DockerCon EU 2015: Monitoring and Managing Dynamic Docker Environments
DockerCon EU 2015: Monitoring and Managing Dynamic Docker EnvironmentsDockerCon EU 2015: Monitoring and Managing Dynamic Docker Environments
DockerCon EU 2015: Monitoring and Managing Dynamic Docker Environments
 
Introduction to Docker I Docker Workshop @ Twitter
Introduction to Docker I Docker Workshop @ TwitterIntroduction to Docker I Docker Workshop @ Twitter
Introduction to Docker I Docker Workshop @ Twitter
 
DockerCon14 Automated Chef Cookbook Testing
DockerCon14 Automated Chef Cookbook TestingDockerCon14 Automated Chef Cookbook Testing
DockerCon14 Automated Chef Cookbook Testing
 
Dockerizing Stashboard
Dockerizing StashboardDockerizing Stashboard
Dockerizing Stashboard
 
Docker, Innovation Accelerator
Docker, Innovation AcceleratorDocker, Innovation Accelerator
Docker, Innovation Accelerator
 

Similar to Victor Vieux at Docker Paris Meetup #1

1 docker first_linux_container_hands_on
1 docker first_linux_container_hands_on 1 docker first_linux_container_hands_on
1 docker first_linux_container_hands_on
FEG
 
Dockers Containers in action Slide 0 to hero
Dockers Containers in action Slide  0 to heroDockers Containers in action Slide  0 to hero
Dockers Containers in action Slide 0 to hero
TayyabAslam24
 

Similar to Victor Vieux at Docker Paris Meetup #1 (20)

Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Tech talk on docker with demo
Tech talk on docker with demoTech talk on docker with demo
Tech talk on docker with demo
 
Docker 2014
Docker 2014Docker 2014
Docker 2014
 
1 docker first_linux_container_hands_on
1 docker first_linux_container_hands_on 1 docker first_linux_container_hands_on
1 docker first_linux_container_hands_on
 
Docker, but what it is?
Docker, but what it is?Docker, but what it is?
Docker, but what it is?
 
Docker from A to Z, including Swarm and OCCS
Docker from A to Z, including Swarm and OCCSDocker from A to Z, including Swarm and OCCS
Docker from A to Z, including Swarm and OCCS
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
 
Django and Docker
Django and DockerDjango and Docker
Django and Docker
 
Introduction To Docker
Introduction To DockerIntroduction To Docker
Introduction To Docker
 
Docker presentation
Docker presentationDocker presentation
Docker presentation
 
Docker From Scratch
Docker From ScratchDocker From Scratch
Docker From Scratch
 
Docker
DockerDocker
Docker
 
Docker for the new Era: Introducing Docker,its components and tools
Docker for the new Era: Introducing Docker,its components and toolsDocker for the new Era: Introducing Docker,its components and tools
Docker for the new Era: Introducing Docker,its components and tools
 
Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
 
Docker and the Container Ecosystem
Docker and the Container EcosystemDocker and the Container Ecosystem
Docker and the Container Ecosystem
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
 
Using Docker with OpenStack - Hands On!
 Using Docker with OpenStack - Hands On! Using Docker with OpenStack - Hands On!
Using Docker with OpenStack - Hands On!
 
Dockers Containers in action Slide 0 to hero
Dockers Containers in action Slide  0 to heroDockers Containers in action Slide  0 to hero
Dockers Containers in action Slide 0 to hero
 
Docker 101
Docker 101Docker 101
Docker 101
 

More from Docker, Inc.

Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
Docker, Inc.
 
Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
Docker, Inc.
 

More from Docker, Inc. (20)

Containerize Your Game Server for the Best Multiplayer Experience
Containerize Your Game Server for the Best Multiplayer Experience Containerize Your Game Server for the Best Multiplayer Experience
Containerize Your Game Server for the Best Multiplayer Experience
 
How to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker BuildHow to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker Build
 
Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
 
Securing Your Containerized Applications with NGINX
Securing Your Containerized Applications with NGINXSecuring Your Containerized Applications with NGINX
Securing Your Containerized Applications with NGINX
 
How To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeHow To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and Compose
 
Hands-on Helm
Hands-on Helm Hands-on Helm
Hands-on Helm
 
Distributed Deep Learning with Docker at Salesforce
Distributed Deep Learning with Docker at SalesforceDistributed Deep Learning with Docker at Salesforce
Distributed Deep Learning with Docker at Salesforce
 
The First 10M Pulls: Building The Official Curl Image for Docker Hub
The First 10M Pulls: Building The Official Curl Image for Docker HubThe First 10M Pulls: Building The Official Curl Image for Docker Hub
The First 10M Pulls: Building The Official Curl Image for Docker Hub
 
Monitoring in a Microservices World
Monitoring in a Microservices WorldMonitoring in a Microservices World
Monitoring in a Microservices World
 
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
 
Predicting Space Weather with Docker
Predicting Space Weather with DockerPredicting Space Weather with Docker
Predicting Space Weather with Docker
 
Become a Docker Power User With Microsoft Visual Studio Code
Become a Docker Power User With Microsoft Visual Studio CodeBecome a Docker Power User With Microsoft Visual Studio Code
Become a Docker Power User With Microsoft Visual Studio Code
 
How to Use Mirroring and Caching to Optimize your Container Registry
How to Use Mirroring and Caching to Optimize your Container RegistryHow to Use Mirroring and Caching to Optimize your Container Registry
How to Use Mirroring and Caching to Optimize your Container Registry
 
Monolithic to Microservices + Docker = SDLC on Steroids!
Monolithic to Microservices + Docker = SDLC on Steroids!Monolithic to Microservices + Docker = SDLC on Steroids!
Monolithic to Microservices + Docker = SDLC on Steroids!
 
Kubernetes at Datadog Scale
Kubernetes at Datadog ScaleKubernetes at Datadog Scale
Kubernetes at Datadog Scale
 
Labels, Labels, Labels
Labels, Labels, Labels Labels, Labels, Labels
Labels, Labels, Labels
 
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment ModelUsing Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
 
Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
 
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
 
Developing with Docker for the Arm Architecture
Developing with Docker for the Arm ArchitectureDeveloping with Docker for the Arm Architecture
Developing with Docker for the Arm Architecture
 

Victor Vieux at Docker Paris Meetup #1

  • 1. Docker Paris meetup #1 – 10/02/2013 Victor Vieux, dotCloud Inc. @vieux
  • 2. Outline •  Intro to Docker •  Installing Docker •  Basic commands •  Demo: Simple deployment •  Questions
  • 3. Quick survey •  How many people have heard of Docker before this Meetup ? •  How many people have tried Docker ? •  How many people are using Docker in production ?
  • 5. Origins of Docker •  Docker is a rewrite of similar code that currently powers the dotCloud PaaS •  Original version written in Python (like dotCloud PaaS), now written in Go •  It’s a young project (~6 months), but with a huge community.
  • 6. Docker Timeline •  January 2013 Docker started as an internal project inside of dotCloud •  March 21, 2013 Solomon gives Docker lightning talk a PyCon US •  March 27, 2013 Docker 0.1 released to Public •  September 4, 2013 Docker merged into Openstack for the Havana release •  September 19, 2013 Partnership with Red Hat around OpenShift •  September 27, 2013 Docker 0.6.3 released
  • 7. In the first 6 months •  6000+ Github stars •  150+ Contributors •  50,000+ docker index pull •  100’s of projects built on top of Docker – UIs (DockerUI, Shipyard, Dockland…) – Open Source PaaS (DEIS, Flynn, Dokku…) – Continuous Deployment (Strider…) •  1700’s Dockerized applications on Github
  • 8. What is Docker ? “Docker is an open-source engine to easily create lightweight, portable, self-sufficient containers from any application. The same container that a developer builds and test on a laptop can run at scale, in production, on VMs, OpenStack cluster, public clouds and more.”
  • 9. How does Docker work ? •  LinuX Containers (LXC) •  Control Groups & Namespaces •  AUFS •  Client – Server with an HTTP API
  • 10. LinuX Containers (LCX) •  Let’s your run a Linux system within another Linux system •  A container is a group of processes on a Linux box, put together is an isolated environment •  From the inside, it looks like a VM •  From the outside, it looks like normal processes •  “chroot on steroids”
  • 11. Why Containers? •  Speed: Boots in seconds •  Footprint: 100-1000 containers on one machine. Small disk requirements
  • 13. Control Groups & Namespaces Linux kernel feature to limit, account and isolate resource usage, such as: – CPU – Memory – Disk I/O
  • 14. AUFS   •  File system that implements union mount.       •  Supports Copy On Write (COW):       # mount –t aufs –o br=/files1:/files2 none /files       # mount –t aufs –o br=/tmp=rw:/bin=ro none /files    
  • 16. Requirements •  Linux Kernel 3.8 or above •  AUFS •  LXC •  64-bit
  • 17. Installations •  Ubuntu Linux •  Binaries •  Using Vagrant More on: http://docs.docker.io/en/latest/installation
  • 18. Installation: Ubuntu Linux •  AUFS support $> sudo apt-get update $> sudo apt-get intall linux-image-extra-`uname –r` •  Add Docker repository $> sudo sh –c “curl https://get.docker.io/gpg | apt-key add -” $> sudo sh –c “echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list” •  Install $> sudo apt-get update $> sudo apt-get install lxc-docker
  • 19. Installation: Binaries •  Get the docker binary $> wget –output-document=docker https://get.docker.io/builds/ Linux/x86_64/docker-latest $> chmod +x docker •  Run the docker daemon $> sudo ./docker –d & •  Use your own system startup script  
  • 20. Installation: Vagrant •  Clone the Docker repository $> git clone https://github.com/dotcloud/docker.git •  Startup the vagrant image $> vagrant up   •  SSH into the image $> vagrant ssh •  Docker client works on Mac
  • 22. Classic: hello world •  Get one base image (ubuntu, centos, busybox,…) $> docker pull ubuntu •  List images on your system $> docker images     •  Print hello world $> docker run ubuntu:12.10 echo “hello world”  
  • 23. Detached mode •  Run  in  Docker  using  the  detach  flag  (-­‐d)   $> docker run –d ubuntu sh –c “while true; do echo hello world; sleep 1; done” •  Get  container’s  id   $> docker ps •  A:ach  to  the  container   $> docker attach <container_id>   •  Stop/Start/Restart  the  container   $> docker stop <container_id>  
  • 24. Containers vs Images •  Remove a file from an image $> docker run busybox rm /etc/passwd •  The file is still there ?? $> docker run busybox cat /etc/passwd •  Commit the newly created to an image $> docker ps –n=2 #get the container’s id $> docker commit <id> vieux/broken-busybox   •  The file is gone $> docker run vieux/broken-busybox cat /etc/passwd
  • 25. Public Index & Network •  Pull an apache image from the public index $> docker search apache $> docker pull creack/apache2 •  Run the image and check the ports $> docker run –d creack/apache2 $> docker ps •  Expose public ports $> docker run –d –p 8888:80 –p 4444:443 creack/apache2 $> docker ps  
  • 26. Creating your 1st app: the interactive way •  Using docker in interactive mode $> docker run –i –t ubuntu bash root@82c63ee50c3d:/# root@82c63ee50c3d:/# apt-get update […] root@82c63ee50c3d:/# apt-get install memcached […] root@82c63ee50c3d:/# exit •  Commit the image $> docker commit `docker ps –q –l` vieux/memcached •  Start the image $> docker run –d –p 11211 –u daemon vieux/memcached memcached
  • 27. Creating your 1st app: the boring way •  Multiple run / commit $> docker run ubuntu apt-get update $> $ID=(docker commit `docker ps –q –l`) $> docker run $ID apt-get install memcached $> docker commit `docker ps –q –l vieux/memcached •  Define default configuration at commit $> docker commit –run=‘{“Entrypoint”: [“memcached”]}’ […] •  Start the image $> docker run –d –p 11211 –u daemon vieux/memcached
  • 28. Creating your 1st app: the scripted way •  Write a Dockerfile # Memcached FROM ubuntu MAINTAINER Victor Vieux <victor@dotcloud.com> RUN apt-get update RUN apt-get install –y memcached ENTRYPOINT [“memcached”] USER daemon EXPOSE 11211 •  Buid the image $> docker build –t=vieux/memcached . •  Start the image $> docker run –d vieux/memcached memcached
  • 29. Volumes and bind mounts •  Put your persistent data in a volume $> $ID=(docker run –d –v /var/lib/mysql vieux/mysql) •  So you can re use it in another container $> docker run –d –volumes-from=$ID vieux/mysql   •  Bind mounts $> docker run –d –v /home/vv:/home <image> •  Supports read only / read write $> docker run –d –v host/path:container/path:rw <image>
  • 30. Other commands •  docker cp #copy a file from container to host •  docker diff #print container changes •  docker top #display running processes inside a container •  docker rm/rmi #delete container/image •  docker wait #wait until container stop and print exit code More on: http://docs.docker.io/en/latest/commandline/cli
  • 32. Local development •  App running in prod http://ks3100989.kimsufi.com:8080/ •  Build local  $> docker build –t=gcm . •  Test local $> docker run –p 49200:8080 gcm  http://localhost:49200 •  Change some files •  Rebuild & test $> docker build –t=gcm . $> docker run –p 49200:8080 gcm
  • 33. Push to prod •  Tag image in order to push it $> docker tag gcm ks3100989.kimsufi.com:5000/gcm •  Push image to local registry $> docker push ks3100989.kimsufi.com:5000/gcm •  On production server, download image $> docker pull ks3100989.kimsufi.com:5000/gcm •  Restart the container $> docker stop <container_id> $> docker run –d –p 8080:8080 <image>