SlideShare uma empresa Scribd logo
1 de 15
Docker
AKA “the last Vagrantfile you’ll ever need”*
* Disclaimer: probably not the last Vagrantfile you’ll ever need
What is Docker?
 http://docker.io/
 “Docker is an open-source project to easily create
lightweight, portable, self-sufficient containers from any
application.”
 Based on LXC (linux containers)
 From dotCloud
 Written in Go
…but what is it really?
 Dockerfile to define a starting point (eg. “Centos”) and a
set of instructions to prepare your environment and run
your application
 Image(s) containing all the defined environment and
your app
 Containers with running processes
 All self contained and isolated from the host
 Public registry of other people’s images
Why would I use it?
 Dev/prod/staging consistency
 Ability to streamline CI/CD
Performance
 Each container is simply a process, no other overheads
(simply isolated in the kernel).
 Run 10-100 containers on your laptop, each one self-
contained
 CPU == native, Memory == slightly higher, Network ==
_slightly_ slower
 Copy on write filesystem (AUFS or BTRFS)
Structure
 Encourages micro-services approach
 Every separate daemon should be it’s own container
 Discourages talking to localhost or making naive
assumptions about all services being locally accessible
 Has a “linking” system for exposing other container IP
and port details via environment variables
 Also encourages viewing services (containers) as
immutable
 Docker encourages a full CI/CD pipeline
Installation
 Trivial on modern linux (apt-get or yum install lxc-
docker)
 Near-trivial on OS X (install boot2docker, or dvm)
 Latest AWS images now support docker by default (as
does EBS)
 Various vagrant images available for vbox, vmware, etc
Example Dockerfile
FROM centos
MAINTAINER Kevin Littlejohn <kevin@littlejohn.id.au>
RUN echo 'NETWORKING=yes' > /etc/sysconfig/network
# Install Postgresql
RUN rpm -i http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm
RUN yum install -y postgresql93-devel postgresql93 postgresql93-server postgresql93-contrib
ENV PATH /usr/pgsql-9.3/bin:$PATH
RUN service postgresql-9.3 initdb en_AU.UTF-8
ADD pg_hba.conf /var/lib/pgsql/9.3/data/pg_hba.conf
RUN service postgresql-9.3 start && chkconfig postgresql-9.3 on && su postgres -c "createuser –s postgres"
USER postgres
EXPOSE 5432
CMD ["/usr/pgsql-9.3/bin/postgres", "-D", "/var/lib/pgsql/9.3/data", "-i", "-h", "0.0.0.0"]
12 Months of Docker
 Contributions from more than 400 developers;
 More than 1.4 million downloads;
 More than 10,000 Dockerized applications available in
Docker’s public index; and
 Accelerating community engagement, including more
than 77 Docker Meetup groups in 30 countries.
Add-ons
 Drone
 Shipyard
 Registry
 CoreOS
 Fig
 Maestro
 Continuously !
Integrations
 Packer
 Vagrant
 Jenkins (Docker build step and Docker plugin)
 Docker (DinD)
 Google AppEngine
 OpenStack
Systems Using Docker
 Travis-CI
 Blockade
 CoreOS
 Quay.io
 Orchard
 OpenShift
Other nice features
 Trusted images on index.docker.io
 Logs of exited containers
 Caching of images for repeat builds
 Docker daemon and REST API
Tips for Use
 Heavy use of Environment variables
 Look into fig, maestro, or coreos/fleet
 Never refer to localhost
 AUFS vs BTRFS

Mais conteúdo relacionado

Mais procurados

CoreOS introduction - Johann Romefort
CoreOS introduction - Johann RomefortCoreOS introduction - Johann Romefort
CoreOS introduction - Johann Romefort
Stylight
 

Mais procurados (20)

LXC
LXCLXC
LXC
 
Launching containers with fleet
Launching containers with fleetLaunching containers with fleet
Launching containers with fleet
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
CoreOS Intro
CoreOS IntroCoreOS Intro
CoreOS Intro
 
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
 
CoreOS introduction - Johann Romefort
CoreOS introduction - Johann RomefortCoreOS introduction - Johann Romefort
CoreOS introduction - Johann Romefort
 
Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1
 
Docker and stuff
Docker and stuffDocker and stuff
Docker and stuff
 
Backend Master | 3.4.2 Deploy - Docker Introduction
Backend Master | 3.4.2 Deploy - Docker IntroductionBackend Master | 3.4.2 Deploy - Docker Introduction
Backend Master | 3.4.2 Deploy - Docker Introduction
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Fedora Atomic Host
Fedora Atomic HostFedora Atomic Host
Fedora Atomic Host
 
Docker by-demo
Docker by-demoDocker by-demo
Docker by-demo
 
Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4
 
Docker by demo
Docker by demoDocker by demo
Docker by demo
 
Academy PRO: Docker. Lecture 3
Academy PRO: Docker. Lecture 3Academy PRO: Docker. Lecture 3
Academy PRO: Docker. Lecture 3
 
CoreOSによるDockerコンテナのクラスタリング
CoreOSによるDockerコンテナのクラスタリングCoreOSによるDockerコンテナのクラスタリング
CoreOSによるDockerコンテナのクラスタリング
 
Introduction to Project atomic (CentOS Dojo Bangalore)
Introduction to Project atomic (CentOS Dojo Bangalore)Introduction to Project atomic (CentOS Dojo Bangalore)
Introduction to Project atomic (CentOS Dojo Bangalore)
 
Docker Insight
Docker InsightDocker Insight
Docker Insight
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
 
Docker Workshop
Docker WorkshopDocker Workshop
Docker Workshop
 

Semelhante a Introduction to Docker

Docker - The Linux Container
Docker - The Linux ContainerDocker - The Linux Container
Docker - The Linux Container
Balaji Rajan
 

Semelhante a Introduction to Docker (20)

Agile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: Introduction
 
Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
Introducing Docker
Introducing DockerIntroducing Docker
Introducing Docker
 
Docker dDessi november 2015
Docker dDessi november 2015Docker dDessi november 2015
Docker dDessi november 2015
 
Docker - The Linux Container
Docker - The Linux ContainerDocker - The Linux Container
Docker - The Linux Container
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET Developers
 
Introduction to Docker
Introduction  to DockerIntroduction  to Docker
Introduction to Docker
 
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme PetazzoniWorkshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
 
Introduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" EditionIntroduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" Edition
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
 
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachJDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung
 
Luciano Fiandesio - Docker 101 | Codemotion Milan 2015
Luciano Fiandesio - Docker 101 | Codemotion Milan 2015Luciano Fiandesio - Docker 101 | Codemotion Milan 2015
Luciano Fiandesio - Docker 101 | Codemotion Milan 2015
 
Docker
DockerDocker
Docker
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇
 
Docker and containers - Presentation Slides by Priyadarshini Anand
Docker and containers - Presentation Slides by Priyadarshini AnandDocker and containers - Presentation Slides by Priyadarshini Anand
Docker and containers - Presentation Slides by Priyadarshini Anand
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for Testing
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 

Último

一比一原版犹他大学毕业证如何办理
一比一原版犹他大学毕业证如何办理一比一原版犹他大学毕业证如何办理
一比一原版犹他大学毕业证如何办理
F
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
JOHNBEBONYAP1
 
一比一原版贝德福特大学毕业证学位证书
一比一原版贝德福特大学毕业证学位证书一比一原版贝德福特大学毕业证学位证书
一比一原版贝德福特大学毕业证学位证书
F
 
一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理
F
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Monica Sydney
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Monica Sydney
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
gajnagarg
 

Último (20)

Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
一比一原版犹他大学毕业证如何办理
一比一原版犹他大学毕业证如何办理一比一原版犹他大学毕业证如何办理
一比一原版犹他大学毕业证如何办理
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
Research Assignment - NIST SP800 [172 A] - Presentation.pptx
Research Assignment - NIST SP800 [172 A] - Presentation.pptxResearch Assignment - NIST SP800 [172 A] - Presentation.pptx
Research Assignment - NIST SP800 [172 A] - Presentation.pptx
 
一比一原版贝德福特大学毕业证学位证书
一比一原版贝德福特大学毕业证学位证书一比一原版贝德福特大学毕业证学位证书
一比一原版贝德福特大学毕业证学位证书
 
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime BalliaBallia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
 
一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理
 
PIC Microcontroller Structure & Assembly Language.ppsx
PIC Microcontroller Structure & Assembly Language.ppsxPIC Microcontroller Structure & Assembly Language.ppsx
PIC Microcontroller Structure & Assembly Language.ppsx
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girls
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
Call girls Service Canacona - 8250092165 Our call girls are sure to provide y...
Call girls Service Canacona - 8250092165 Our call girls are sure to provide y...Call girls Service Canacona - 8250092165 Our call girls are sure to provide y...
Call girls Service Canacona - 8250092165 Our call girls are sure to provide y...
 
Down bad crying at the gym t shirtsDown bad crying at the gym t shirts
Down bad crying at the gym t shirtsDown bad crying at the gym t shirtsDown bad crying at the gym t shirtsDown bad crying at the gym t shirts
Down bad crying at the gym t shirtsDown bad crying at the gym t shirts
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
South Bopal [ (Call Girls) in Ahmedabad ₹7.5k Pick Up & Drop With Cash Paymen...
South Bopal [ (Call Girls) in Ahmedabad ₹7.5k Pick Up & Drop With Cash Paymen...South Bopal [ (Call Girls) in Ahmedabad ₹7.5k Pick Up & Drop With Cash Paymen...
South Bopal [ (Call Girls) in Ahmedabad ₹7.5k Pick Up & Drop With Cash Paymen...
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
💚 Call Girls Bahraich 9332606886 High Profile Call Girls You Can Get The S...
💚 Call Girls Bahraich   9332606886  High Profile Call Girls You Can Get The S...💚 Call Girls Bahraich   9332606886  High Profile Call Girls You Can Get The S...
💚 Call Girls Bahraich 9332606886 High Profile Call Girls You Can Get The S...
 
Sensual Call Girls in Tarn Taran Sahib { 9332606886 } VVIP NISHA Call Girls N...
Sensual Call Girls in Tarn Taran Sahib { 9332606886 } VVIP NISHA Call Girls N...Sensual Call Girls in Tarn Taran Sahib { 9332606886 } VVIP NISHA Call Girls N...
Sensual Call Girls in Tarn Taran Sahib { 9332606886 } VVIP NISHA Call Girls N...
 

Introduction to Docker

  • 1. Docker AKA “the last Vagrantfile you’ll ever need”* * Disclaimer: probably not the last Vagrantfile you’ll ever need
  • 2. What is Docker?  http://docker.io/  “Docker is an open-source project to easily create lightweight, portable, self-sufficient containers from any application.”  Based on LXC (linux containers)  From dotCloud  Written in Go
  • 3. …but what is it really?  Dockerfile to define a starting point (eg. “Centos”) and a set of instructions to prepare your environment and run your application  Image(s) containing all the defined environment and your app  Containers with running processes  All self contained and isolated from the host  Public registry of other people’s images
  • 4. Why would I use it?  Dev/prod/staging consistency  Ability to streamline CI/CD
  • 5. Performance  Each container is simply a process, no other overheads (simply isolated in the kernel).  Run 10-100 containers on your laptop, each one self- contained  CPU == native, Memory == slightly higher, Network == _slightly_ slower  Copy on write filesystem (AUFS or BTRFS)
  • 6. Structure  Encourages micro-services approach  Every separate daemon should be it’s own container  Discourages talking to localhost or making naive assumptions about all services being locally accessible  Has a “linking” system for exposing other container IP and port details via environment variables  Also encourages viewing services (containers) as immutable
  • 7.  Docker encourages a full CI/CD pipeline
  • 8. Installation  Trivial on modern linux (apt-get or yum install lxc- docker)  Near-trivial on OS X (install boot2docker, or dvm)  Latest AWS images now support docker by default (as does EBS)  Various vagrant images available for vbox, vmware, etc
  • 9. Example Dockerfile FROM centos MAINTAINER Kevin Littlejohn <kevin@littlejohn.id.au> RUN echo 'NETWORKING=yes' > /etc/sysconfig/network # Install Postgresql RUN rpm -i http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm RUN yum install -y postgresql93-devel postgresql93 postgresql93-server postgresql93-contrib ENV PATH /usr/pgsql-9.3/bin:$PATH RUN service postgresql-9.3 initdb en_AU.UTF-8 ADD pg_hba.conf /var/lib/pgsql/9.3/data/pg_hba.conf RUN service postgresql-9.3 start && chkconfig postgresql-9.3 on && su postgres -c "createuser –s postgres" USER postgres EXPOSE 5432 CMD ["/usr/pgsql-9.3/bin/postgres", "-D", "/var/lib/pgsql/9.3/data", "-i", "-h", "0.0.0.0"]
  • 10. 12 Months of Docker  Contributions from more than 400 developers;  More than 1.4 million downloads;  More than 10,000 Dockerized applications available in Docker’s public index; and  Accelerating community engagement, including more than 77 Docker Meetup groups in 30 countries.
  • 11. Add-ons  Drone  Shipyard  Registry  CoreOS  Fig  Maestro  Continuously !
  • 12. Integrations  Packer  Vagrant  Jenkins (Docker build step and Docker plugin)  Docker (DinD)  Google AppEngine  OpenStack
  • 13. Systems Using Docker  Travis-CI  Blockade  CoreOS  Quay.io  Orchard  OpenShift
  • 14. Other nice features  Trusted images on index.docker.io  Logs of exited containers  Caching of images for repeat builds  Docker daemon and REST API
  • 15. Tips for Use  Heavy use of Environment variables  Look into fig, maestro, or coreos/fleet  Never refer to localhost  AUFS vs BTRFS

Notas do Editor

  1. Stress _containers_ - pre-1960 shipping many specialized methods.
  2. Image == AMI == class; Container == Instance == object
  3. No more library versioning issues No more worrying if CI is up to date with Prod, or Dev is the same as both No more caring what distro people like/use Oh, and no more rbenv/rvm/chruby, if you’re so inclined
  4. Can run supervisord in a container, but best not Passenger’s docker images
  5. Once you’re generating images, you want to use them for production - this is easiest done with a complete end to end system - jenkins has some support for using docker commands in build instructions, and building things in docker by default Rebuild on prod approach has issues: - time - size - availability of third-party packages (npm failures) - dependency management Talk about stupid hand-holding re: not being able to list host volumes in Dockerfile and not being able to specify certain things in Dockerfile so they’re more portable, but less useful…
  6. Mention OS X is virtualbox under the hood
  7. This would sit at the top of your project, or perhaps the top of your rails app Defines everything the app / service needs to run Builds the same everywhere, more or less. Note, also possible to build and commit manually, but not great
  8. Drone – jenkins replacement aimed at auto-building within docker containers Shipyard – tool for managing your docker registry Registry – cacheing and serving images, nice for central private images CoreOS – alternative to ubuntu for FROM on Dockerfile, has etcd installed by default, very lightweight. Fig – wrapper for Docker to specify dependencies in YAML format Maestro – similar to fig but slightly more complex
  9. Packer uses it’s own json based format for defining server, loses some features of Dockerfile (checkpointing, onbuild, cmd, entrypoint, user) Vagrant allows for “config.vm.provision "docker”” to install base docker requirements Jenkins has two plugins, to build everything inside a container, and to support docker commands inside build steps. Still investigating. DinD allows for, eg. Running Jenkins in a container and building containers in that. Loses AUFS advantages.
  10. Quay.io – private registries, index.docker.io also does this now Orchard – pure awesome sauce (“orchard docker run”) OpenShift – docker under the hood