SlideShare a Scribd company logo
1 of 15
@
Dockerfile Basics
Docker workshop #2 at @Twitter, beginners class
#dockerworkshop
Docker version 0.6.5

By Julien Barbier

@julienbarbier42
42h

Dockerfiles
• Dockerfiles = image representations
• Simple syntax for building images
• Automate and script the images creation
42h

FROM
• Sets the base image for subsequent instructions
• Usage: FROM <image>
• Example: FROM ubuntu
• Needs to be the first instruction of every Dockerfile

• TIP: find images with the command: docker search
42h

RUN
• Executes any commands on the current image and commit the
results
• Usage: RUN <command>
• Example: RUN apt-get install –y memcached
FROM ubuntu
RUN apt-get install -y memcached
is equivalent to:
$ docker run ubuntu apt-get install -y memcached
$ docker commit XXX
42h

docker build
Creates an image from a Dockerfile
• From the current directory
• From stdin
• From GitHub

$ docker build .

$ docker build - < Dockerfile
$ docker build github.com/creack/docker-firefox

TIP: Use –t to tag your image
42h

Example: Memcached
FROM ubuntu
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main
universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y memcached

• Dockerfile: https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/slide_6/Dockerfile
$ docker build –t memcached_d1 .
• Test it
$ docker run -i -t memcached_d1 /bin/bash
root@1f452c9442fb:/# memcached -u daemon -vvv
42h

#Commenting
• #
• Dockerfile: https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/slide_7/Dockerfile

# Memcached
#
# VERSION 1.0
# use the ubuntu base image provided by Docker
FROM ubuntu
# make sure the package repository is up to date
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
# install memcached
RUN apt-get install -y memcached
42h

MAINTAINER
• specify name / contact of the person maintaining the Dockerfile
• Example: MAINTAINER Julien, julien@docker.com
• Dockerfile: https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/slide_8/Dockerfile
# Memcached
#
# VERSION

1.0

# use the ubuntu base image provided by Docker

FROM ubuntu
MAINTAINER Julien, julien@docker.com
# make sure the package repository is up to date
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
# install memcached
RUN apt-get install -y memcached
42h

ENTRYPOINT 1/2
• Triggers a command as soon as the container starts
• Example: ENTRYPOINT echo “Whale You Be My Container?”
• Dockerfile: https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/slide_9/Dockerfile
# Whale you be my container?
#
# VERSION
0.42
# use the base image provided by Docker
FROM base
MAINTAINER Moby Dock victor.coisne@docker.com
# say hello when the container is launched
ENTRYPOINT echo "Whale you be my container"
42h

ENTRYPOINT 2/2
• Run containers as executables! :)
$ cat /etc/passwd | docker run -i wc

• Dockerfile: https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/slide_10/Dockerfile
# This is wc
#
# VERSION 0.42
# use the base image provided by Docker
FROM base
MAINTAINER Roberto roberto@docker.com
# count lines with wc
ENTRYPOINT ["wc", "-l"]
42h

USER
• Sets the username to use when running the image
• Example: USER daemon
42h

EXPOSE
• Sets ports to be exposed to other containers when running the
image (cf lightning talk by Michael Crosby @crosbymichael)
• Example: EXPOSE 80
Exercice: create a perfect Memcached
Dockerfile
Answer https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/memcached/Dockerfile
$ docker build -t memcached .
$ docker run –p 11211 memcached
#BOOM
• Try it (update port number, $ docker ps)
Python https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/memcached/test.py
Ruby https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/memcached/test.rb
PHP https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/memcached/test.php

42h
42h

Quizz: Online Dockerfile Tutorials
Test your skills here:

http://www.docker.io/learn/dockerfile/
42h

Thank you!

www.docker.io

More Related Content

What's hot

Docker workshop
Docker workshopDocker workshop
Docker workshopEvans Ye
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Bill Maxwell
 
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12dotCloud
 
Docker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopJirayut Nimsaeng
 
Dockerizing your applications - Docker workshop @Twitter
Dockerizing your applications - Docker workshop @TwitterDockerizing your applications - Docker workshop @Twitter
Dockerizing your applications - Docker workshop @TwitterdotCloud
 
OpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQOpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQdotCloud
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and dockerDuckDuckGo
 
Shipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with DockerShipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with DockerJérôme Petazzoni
 
Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Nicolas Poggi
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshopRuncy Oommen
 
Locally it worked! virtualizing docker
Locally it worked! virtualizing dockerLocally it worked! virtualizing docker
Locally it worked! virtualizing dockerSascha Brinkmann
 
Automating Docker Containers with Puppet 2014 10-13
Automating Docker Containers with Puppet 2014 10-13Automating Docker Containers with Puppet 2014 10-13
Automating Docker Containers with Puppet 2014 10-13kylog
 
Learn docker in 90 minutes
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutesLarry Cai
 
Amazon Web Services and Docker
Amazon Web Services and DockerAmazon Web Services and Docker
Amazon Web Services and DockerPaolo latella
 
Docker Basic Presentation
Docker Basic PresentationDocker Basic Presentation
Docker Basic PresentationAman Chhabra
 

What's hot (17)

Docker workshop
Docker workshopDocker workshop
Docker workshop
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
 
Docker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery Workshop
 
Dockerizing your applications - Docker workshop @Twitter
Dockerizing your applications - Docker workshop @TwitterDockerizing your applications - Docker workshop @Twitter
Dockerizing your applications - Docker workshop @Twitter
 
OpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQOpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQ
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and docker
 
Shipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with DockerShipping Applications to Production in Containers with Docker
Shipping Applications to Production in Containers with Docker
 
Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
 
Locally it worked! virtualizing docker
Locally it worked! virtualizing dockerLocally it worked! virtualizing docker
Locally it worked! virtualizing docker
 
Automating Docker Containers with Puppet 2014 10-13
Automating Docker Containers with Puppet 2014 10-13Automating Docker Containers with Puppet 2014 10-13
Automating Docker Containers with Puppet 2014 10-13
 
Learn docker in 90 minutes
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutes
 
Amazon Web Services and Docker
Amazon Web Services and DockerAmazon Web Services and Docker
Amazon Web Services and Docker
 
Docker Basic Presentation
Docker Basic PresentationDocker Basic Presentation
Docker Basic Presentation
 
Docker by Example - Quiz
Docker by Example - QuizDocker by Example - Quiz
Docker by Example - Quiz
 

Viewers also liked

Docker and Sitecore : Sci-Fi or match made in heaven?
Docker and Sitecore : Sci-Fi or match made in heaven?Docker and Sitecore : Sci-Fi or match made in heaven?
Docker and Sitecore : Sci-Fi or match made in heaven?Saber Karmous
 
Docker - Automatisches Deployment für Linux-Instanzen
Docker - Automatisches Deployment für Linux-Instanzen Docker - Automatisches Deployment für Linux-Instanzen
Docker - Automatisches Deployment für Linux-Instanzen B1 Systems GmbH
 
Docker use dockerfile
Docker use dockerfileDocker use dockerfile
Docker use dockerfilecawamata
 
Vagrant, Puppet, Docker für Entwickler und Architekten
Vagrant, Puppet, Docker für Entwickler und ArchitektenVagrant, Puppet, Docker für Entwickler und Architekten
Vagrant, Puppet, Docker für Entwickler und ArchitektenOPITZ CONSULTING Deutschland
 
Docker, how to use it. Organize a meeting with IBM products
Docker, how to use it. Organize a meeting with IBM productsDocker, how to use it. Organize a meeting with IBM products
Docker, how to use it. Organize a meeting with IBM productsAndrea Fontana
 
Talk on PHP Day Uruguay about Docker
Talk on PHP Day Uruguay about DockerTalk on PHP Day Uruguay about Docker
Talk on PHP Day Uruguay about DockerWellington Silva
 
Docker compose selenium-grid_tottoruby_25
Docker compose selenium-grid_tottoruby_25Docker compose selenium-grid_tottoruby_25
Docker compose selenium-grid_tottoruby_25Masayuki Hokimoto
 
Docker - Containervirtualisierung leichtgemacht
Docker - Containervirtualisierung leichtgemachtDocker - Containervirtualisierung leichtgemacht
Docker - Containervirtualisierung leichtgemachtB1 Systems GmbH
 
Docker from basics to orchestration (PHPConfBr2015)
Docker from basics to orchestration (PHPConfBr2015)Docker from basics to orchestration (PHPConfBr2015)
Docker from basics to orchestration (PHPConfBr2015)Wellington Silva
 
docker installation and basics
docker installation and basicsdocker installation and basics
docker installation and basicsWalid Ashraf
 
Red Hat Certified engineer course
  Red Hat Certified engineer course   Red Hat Certified engineer course
Red Hat Certified engineer course Ali Abdo
 
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth RushgroveThe Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth RushgroveDocker, Inc.
 
component based softwrae engineering Cbse
component based softwrae engineering Cbsecomponent based softwrae engineering Cbse
component based softwrae engineering CbseSravs Dals
 
Docker for Developers - PNWPHP 2016 Workshop
Docker for Developers - PNWPHP 2016 WorkshopDocker for Developers - PNWPHP 2016 Workshop
Docker for Developers - PNWPHP 2016 WorkshopChris Tankersley
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshopthemystic_ca
 
Docker & PHP - Practical use case
Docker & PHP - Practical use caseDocker & PHP - Practical use case
Docker & PHP - Practical use caserjsmelo
 

Viewers also liked (20)

Docker and Sitecore : Sci-Fi or match made in heaven?
Docker and Sitecore : Sci-Fi or match made in heaven?Docker and Sitecore : Sci-Fi or match made in heaven?
Docker and Sitecore : Sci-Fi or match made in heaven?
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
 
Docker - Automatisches Deployment für Linux-Instanzen
Docker - Automatisches Deployment für Linux-Instanzen Docker - Automatisches Deployment für Linux-Instanzen
Docker - Automatisches Deployment für Linux-Instanzen
 
Docker use dockerfile
Docker use dockerfileDocker use dockerfile
Docker use dockerfile
 
Vagrant, Puppet, Docker für Entwickler und Architekten
Vagrant, Puppet, Docker für Entwickler und ArchitektenVagrant, Puppet, Docker für Entwickler und Architekten
Vagrant, Puppet, Docker für Entwickler und Architekten
 
Docker, how to use it. Organize a meeting with IBM products
Docker, how to use it. Organize a meeting with IBM productsDocker, how to use it. Organize a meeting with IBM products
Docker, how to use it. Organize a meeting with IBM products
 
Talk on PHP Day Uruguay about Docker
Talk on PHP Day Uruguay about DockerTalk on PHP Day Uruguay about Docker
Talk on PHP Day Uruguay about Docker
 
Docker compose selenium-grid_tottoruby_25
Docker compose selenium-grid_tottoruby_25Docker compose selenium-grid_tottoruby_25
Docker compose selenium-grid_tottoruby_25
 
Docker - Containervirtualisierung leichtgemacht
Docker - Containervirtualisierung leichtgemachtDocker - Containervirtualisierung leichtgemacht
Docker - Containervirtualisierung leichtgemacht
 
Docker from basics to orchestration (PHPConfBr2015)
Docker from basics to orchestration (PHPConfBr2015)Docker from basics to orchestration (PHPConfBr2015)
Docker from basics to orchestration (PHPConfBr2015)
 
docker installation and basics
docker installation and basicsdocker installation and basics
docker installation and basics
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Red Hat Certified engineer course
  Red Hat Certified engineer course   Red Hat Certified engineer course
Red Hat Certified engineer course
 
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth RushgroveThe Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
 
component based softwrae engineering Cbse
component based softwrae engineering Cbsecomponent based softwrae engineering Cbse
component based softwrae engineering Cbse
 
Docker for Developers - PNWPHP 2016 Workshop
Docker for Developers - PNWPHP 2016 WorkshopDocker for Developers - PNWPHP 2016 Workshop
Docker for Developers - PNWPHP 2016 Workshop
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Docker & PHP - Practical use case
Docker & PHP - Practical use caseDocker & PHP - Practical use case
Docker & PHP - Practical use case
 
Especialidade de inclusão 5
Especialidade de inclusão 5Especialidade de inclusão 5
Especialidade de inclusão 5
 

Similar to Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05

Dockerfile at Guidewire
Dockerfile at GuidewireDockerfile at Guidewire
Dockerfile at GuidewireDocker, Inc.
 
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 ContainerGuido Schmutz
 
Docker introduction
Docker introductionDocker introduction
Docker introductioncawamata
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerKuan Yen Heng
 
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 CochranedotCloud
 
Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose
Containers #101 : Docker ONBUILD triggers and Introduction to Docker ComposeContainers #101 : Docker ONBUILD triggers and Introduction to Docker Compose
Containers #101 : Docker ONBUILD triggers and Introduction to Docker ComposeRaziel Tabib (Join our team)
 
dockerizing web application
dockerizing web applicationdockerizing web application
dockerizing web applicationWalid Ashraf
 
Hooking Docker With Selenium
Hooking Docker With SeleniumHooking Docker With Selenium
Hooking Docker With SeleniumSujith Vakathanam
 
Docker on azure
Docker on azureDocker on azure
Docker on azureAnuraj P
 
Victor Vieux at Docker Paris Meetup #1
Victor Vieux at Docker Paris Meetup #1Victor Vieux at Docker Paris Meetup #1
Victor Vieux at Docker Paris Meetup #1Docker, Inc.
 
Docker presentation | Paris Docker Meetup
Docker presentation | Paris Docker MeetupDocker presentation | Paris Docker Meetup
Docker presentation | Paris Docker MeetupdotCloud
 
Docker in Action
Docker in ActionDocker in Action
Docker in ActionAlper Kanat
 
Virtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesVirtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesabhishek chawla
 
Docker - Getting Started
Docker - Getting StartedDocker - Getting Started
Docker - Getting StartedGaurav Gahlot
 
Containers #101 Meetup: Building a micro-service using Node.js and Docker - P...
Containers #101 Meetup: Building a micro-service using Node.js and Docker - P...Containers #101 Meetup: Building a micro-service using Node.js and Docker - P...
Containers #101 Meetup: Building a micro-service using Node.js and Docker - P...Codefresh
 

Similar to Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05 (20)

Dockerfile at Guidewire
Dockerfile at GuidewireDockerfile at Guidewire
Dockerfile at Guidewire
 
Docker, LinuX Container
Docker, LinuX ContainerDocker, LinuX Container
Docker, LinuX Container
 
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
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Django and Docker
Django and DockerDjango and Docker
Django and Docker
 
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
 
Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose
Containers #101 : Docker ONBUILD triggers and Introduction to Docker ComposeContainers #101 : Docker ONBUILD triggers and Introduction to Docker Compose
Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose
 
Introduction To Docker
Introduction To DockerIntroduction To Docker
Introduction To Docker
 
dockerizing web application
dockerizing web applicationdockerizing web application
dockerizing web application
 
Docker
DockerDocker
Docker
 
Hooking Docker With Selenium
Hooking Docker With SeleniumHooking Docker With Selenium
Hooking Docker With Selenium
 
Docker on azure
Docker on azureDocker on azure
Docker on azure
 
Victor Vieux at Docker Paris Meetup #1
Victor Vieux at Docker Paris Meetup #1Victor Vieux at Docker Paris Meetup #1
Victor Vieux at Docker Paris Meetup #1
 
Docker presentation | Paris Docker Meetup
Docker presentation | Paris Docker MeetupDocker presentation | Paris Docker Meetup
Docker presentation | Paris Docker Meetup
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
 
A Hands-on Introduction to Docker
A Hands-on Introduction to DockerA Hands-on Introduction to Docker
A Hands-on Introduction to Docker
 
Virtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesVirtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management services
 
Docker - Getting Started
Docker - Getting StartedDocker - Getting Started
Docker - Getting Started
 
Containers #101 Meetup: Building a micro-service using Node.js and Docker - P...
Containers #101 Meetup: Building a micro-service using Node.js and Docker - P...Containers #101 Meetup: Building a micro-service using Node.js and Docker - P...
Containers #101 Meetup: Building a micro-service using Node.js and Docker - P...
 

More from dotCloud

Immutable infrastructure with Docker and EC2
Immutable infrastructure with Docker and EC2Immutable infrastructure with Docker and EC2
Immutable infrastructure with Docker and EC2dotCloud
 
Docker at Spotify - Dockercon14
Docker at Spotify - Dockercon14Docker at Spotify - Dockercon14
Docker at Spotify - Dockercon14dotCloud
 
John Engates Keynote at Dockercon 14
John Engates Keynote at Dockercon 14John Engates Keynote at Dockercon 14
John Engates Keynote at Dockercon 14dotCloud
 
Building a smarter application Stack by Tomas Doran from Yelp
Building a smarter application Stack by Tomas Doran from YelpBuilding a smarter application Stack by Tomas Doran from Yelp
Building a smarter application Stack by Tomas Doran from YelpdotCloud
 
DockerCon Keynote Ben Golub
DockerCon Keynote Ben GolubDockerCon Keynote Ben Golub
DockerCon Keynote Ben GolubdotCloud
 
Are VM Passé?
Are VM Passé? Are VM Passé?
Are VM Passé? dotCloud
 
Docker in pratice -chenyifei
Docker in pratice -chenyifeiDocker in pratice -chenyifei
Docker in pratice -chenyifeidotCloud
 
Wot2013云计算架构师峰会 -陈轶飞2
Wot2013云计算架构师峰会 -陈轶飞2Wot2013云计算架构师峰会 -陈轶飞2
Wot2013云计算架构师峰会 -陈轶飞2dotCloud
 
Docker introduction
Docker introductionDocker introduction
Docker introductiondotCloud
 
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...Deploying containers and managing them on multiple Docker hosts, Docker Meetu...
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...dotCloud
 
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to Docker and all things containers, Docker Meetup at RelateIQIntroduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to Docker and all things containers, Docker Meetup at RelateIQdotCloud
 
Dockerizing stashboard - Docker meetup at Twilio
Dockerizing stashboard - Docker meetup at TwilioDockerizing stashboard - Docker meetup at Twilio
Dockerizing stashboard - Docker meetup at TwiliodotCloud
 
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013dotCloud
 
Introduction to Docker - Docker workshop @Twitter
Introduction to Docker - Docker workshop @TwitterIntroduction to Docker - Docker workshop @Twitter
Introduction to Docker - Docker workshop @TwitterdotCloud
 
Docker worshop @Twitter - How to use your own private registry
Docker worshop @Twitter - How to use your own private registryDocker worshop @Twitter - How to use your own private registry
Docker worshop @Twitter - How to use your own private registrydotCloud
 
Docker links | Docker workshop #2 at Twitter
Docker links | Docker workshop #2 at TwitterDocker links | Docker workshop #2 at Twitter
Docker links | Docker workshop #2 at TwitterdotCloud
 
Intro Docker october 2013
Intro Docker october 2013Intro Docker october 2013
Intro Docker october 2013dotCloud
 
[Open stack] heat + docker
[Open stack] heat + docker[Open stack] heat + docker
[Open stack] heat + dockerdotCloud
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPressdotCloud
 
Building images from dockerfiles
Building images from dockerfilesBuilding images from dockerfiles
Building images from dockerfilesdotCloud
 

More from dotCloud (20)

Immutable infrastructure with Docker and EC2
Immutable infrastructure with Docker and EC2Immutable infrastructure with Docker and EC2
Immutable infrastructure with Docker and EC2
 
Docker at Spotify - Dockercon14
Docker at Spotify - Dockercon14Docker at Spotify - Dockercon14
Docker at Spotify - Dockercon14
 
John Engates Keynote at Dockercon 14
John Engates Keynote at Dockercon 14John Engates Keynote at Dockercon 14
John Engates Keynote at Dockercon 14
 
Building a smarter application Stack by Tomas Doran from Yelp
Building a smarter application Stack by Tomas Doran from YelpBuilding a smarter application Stack by Tomas Doran from Yelp
Building a smarter application Stack by Tomas Doran from Yelp
 
DockerCon Keynote Ben Golub
DockerCon Keynote Ben GolubDockerCon Keynote Ben Golub
DockerCon Keynote Ben Golub
 
Are VM Passé?
Are VM Passé? Are VM Passé?
Are VM Passé?
 
Docker in pratice -chenyifei
Docker in pratice -chenyifeiDocker in pratice -chenyifei
Docker in pratice -chenyifei
 
Wot2013云计算架构师峰会 -陈轶飞2
Wot2013云计算架构师峰会 -陈轶飞2Wot2013云计算架构师峰会 -陈轶飞2
Wot2013云计算架构师峰会 -陈轶飞2
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...Deploying containers and managing them on multiple Docker hosts, Docker Meetu...
Deploying containers and managing them on multiple Docker hosts, Docker Meetu...
 
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to Docker and all things containers, Docker Meetup at RelateIQIntroduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
 
Dockerizing stashboard - Docker meetup at Twilio
Dockerizing stashboard - Docker meetup at TwilioDockerizing stashboard - Docker meetup at Twilio
Dockerizing stashboard - Docker meetup at Twilio
 
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
 
Introduction to Docker - Docker workshop @Twitter
Introduction to Docker - Docker workshop @TwitterIntroduction to Docker - Docker workshop @Twitter
Introduction to Docker - Docker workshop @Twitter
 
Docker worshop @Twitter - How to use your own private registry
Docker worshop @Twitter - How to use your own private registryDocker worshop @Twitter - How to use your own private registry
Docker worshop @Twitter - How to use your own private registry
 
Docker links | Docker workshop #2 at Twitter
Docker links | Docker workshop #2 at TwitterDocker links | Docker workshop #2 at Twitter
Docker links | Docker workshop #2 at Twitter
 
Intro Docker october 2013
Intro Docker october 2013Intro Docker october 2013
Intro Docker october 2013
 
[Open stack] heat + docker
[Open stack] heat + docker[Open stack] heat + docker
[Open stack] heat + docker
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
 
Building images from dockerfiles
Building images from dockerfilesBuilding images from dockerfiles
Building images from dockerfiles
 

Recently uploaded

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 

Recently uploaded (20)

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 

Dockerfile Basics | Docker workshop #2 at twitter, 2013-11-05

  • 1. @ Dockerfile Basics Docker workshop #2 at @Twitter, beginners class #dockerworkshop Docker version 0.6.5 By Julien Barbier @julienbarbier42
  • 2. 42h Dockerfiles • Dockerfiles = image representations • Simple syntax for building images • Automate and script the images creation
  • 3. 42h FROM • Sets the base image for subsequent instructions • Usage: FROM <image> • Example: FROM ubuntu • Needs to be the first instruction of every Dockerfile • TIP: find images with the command: docker search
  • 4. 42h RUN • Executes any commands on the current image and commit the results • Usage: RUN <command> • Example: RUN apt-get install –y memcached FROM ubuntu RUN apt-get install -y memcached is equivalent to: $ docker run ubuntu apt-get install -y memcached $ docker commit XXX
  • 5. 42h docker build Creates an image from a Dockerfile • From the current directory • From stdin • From GitHub $ docker build . $ docker build - < Dockerfile $ docker build github.com/creack/docker-firefox TIP: Use –t to tag your image
  • 6. 42h Example: Memcached FROM ubuntu RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list RUN apt-get update RUN apt-get install -y memcached • Dockerfile: https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/slide_6/Dockerfile $ docker build –t memcached_d1 . • Test it $ docker run -i -t memcached_d1 /bin/bash root@1f452c9442fb:/# memcached -u daemon -vvv
  • 7. 42h #Commenting • # • Dockerfile: https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/slide_7/Dockerfile # Memcached # # VERSION 1.0 # use the ubuntu base image provided by Docker FROM ubuntu # make sure the package repository is up to date RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list RUN apt-get update # install memcached RUN apt-get install -y memcached
  • 8. 42h MAINTAINER • specify name / contact of the person maintaining the Dockerfile • Example: MAINTAINER Julien, julien@docker.com • Dockerfile: https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/slide_8/Dockerfile # Memcached # # VERSION 1.0 # use the ubuntu base image provided by Docker FROM ubuntu MAINTAINER Julien, julien@docker.com # make sure the package repository is up to date RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list RUN apt-get update # install memcached RUN apt-get install -y memcached
  • 9. 42h ENTRYPOINT 1/2 • Triggers a command as soon as the container starts • Example: ENTRYPOINT echo “Whale You Be My Container?” • Dockerfile: https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/slide_9/Dockerfile # Whale you be my container? # # VERSION 0.42 # use the base image provided by Docker FROM base MAINTAINER Moby Dock victor.coisne@docker.com # say hello when the container is launched ENTRYPOINT echo "Whale you be my container"
  • 10. 42h ENTRYPOINT 2/2 • Run containers as executables! :) $ cat /etc/passwd | docker run -i wc • Dockerfile: https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/slide_10/Dockerfile # This is wc # # VERSION 0.42 # use the base image provided by Docker FROM base MAINTAINER Roberto roberto@docker.com # count lines with wc ENTRYPOINT ["wc", "-l"]
  • 11. 42h USER • Sets the username to use when running the image • Example: USER daemon
  • 12. 42h EXPOSE • Sets ports to be exposed to other containers when running the image (cf lightning talk by Michael Crosby @crosbymichael) • Example: EXPOSE 80
  • 13. Exercice: create a perfect Memcached Dockerfile Answer https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/memcached/Dockerfile $ docker build -t memcached . $ docker run –p 11211 memcached #BOOM • Try it (update port number, $ docker ps) Python https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/memcached/test.py Ruby https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/memcached/test.rb PHP https://github.com/jbarbier/Dockerfile-Basics-Docker-Workshop-2-Twitter/blob/master/memcached/test.php 42h
  • 14. 42h Quizz: Online Dockerfile Tutorials Test your skills here: http://www.docker.io/learn/dockerfile/