SlideShare a Scribd company logo
1 of 16
Dockerfile basics
docker workshop #1
at GeekDom / Rackspace
Dockerfiles
• Dockerfiles = image representations
• Simple syntax for building images
• Automate and script the images creation
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
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
docker build
• Creates an image from a Dockerfile
• From the current directory = docker build
• From stdin = docker build - < Dockerfile
• From GitHub = docker build github.com/creack/docker-firefox
• TIP: Use –t to tag your image
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
• http://instacached.com/D1
• Docker build –t memcached .
# Commenting
• #
• http://instacached.com/D2
# Memcached
#
# VERSION 1.0
# use the ubuntu base image provided by dotCloud
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
MAINTAINER
• specify name / contact of the person maintaining the Dockerfile
• Example: MAINTAINER Yannis, yannis@dotcloud.com
• http://instacached.com/D3
# Memcached
#
# VERSION 1.0
# use the ubuntu base image provided by dotCloud
FROM ubuntu
MAINTAINER Yannis, yannis@dotcloud.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
ENTRYPOINT 1/2
• Triggers a command as soon as the container starts
• Example: ENTRYPOINT echo “Whale You Be My Container?”
• http://instacached.com/D4
# Whale you be my container?
#
# VERSION 0.42
# use the base image provided by dotCloud
FROM base
MAINTAINER Victor Coisne victor.coisne@dotcloud.com
# say hello when the container is launched
ENTRYPOINT echo "Whale you be my container"
ENTRYPOINT 2/2
• Run containers as executables! :)
• cat /etc/passwd | docker run -i wc
• http://instacached.com/D5
# This is wc
#
# VERSION 0.42
# use the base image provided by dotCloud
FROM base
MAINTAINER Victor Coisne victor.coisne@dotcloud.com
# count lines with wc
ENTRYPOINT ["wc", "-l"]
USER
• Sets the username to use when running the image
• Example: USER daemon
EXPOSE
• Sets ports to be publicly exposed when running the image
• Example: EXPOSE 11211
Memcached
• http://instacached.com/Dockerfile
• docker build -t memcached - < Dockerfile
• docker run memcached
• BOOM! :)
• Try it
• Python: http://instacached.com/test.py.txt
• Ruby: http://instacached.com/test.rb.txt
• PHP: http://instacached.com/test.php.txt
Online Dockerfile Tutorials
• Check our Dockerfile tutorials and test your skills here:
http://www.docker.io/learn/dockerfile/
Thank you
• GeekDom SF
• Rackspace
• Docker / dotCloud
• Blake Haggerty
• Robert Hrdinsky
• You!
www.docker.io

More Related Content

What's hot

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 101 - Getting started
Docker 101 - Getting startedDocker 101 - Getting started
Docker 101 - Getting startedMatheus Marabesi
 
Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Herofazalraja
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerLuong Vo
 
Docker intro
Docker introDocker intro
Docker introOleg Z
 
Docker 101: An Introduction
Docker 101: An IntroductionDocker 101: An Introduction
Docker 101: An IntroductionPOSSCON
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Bill Maxwell
 
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
 
Docker get started
Docker get startedDocker get started
Docker get startedTruong LD
 
Docker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopJirayut Nimsaeng
 
Docker Basic Presentation
Docker Basic PresentationDocker Basic Presentation
Docker Basic PresentationAman Chhabra
 
OpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQOpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQdotCloud
 
Dockerizing your applications - Docker workshop @Twitter
Dockerizing your applications - Docker workshop @TwitterDockerizing your applications - Docker workshop @Twitter
Dockerizing your applications - Docker workshop @TwitterdotCloud
 

What's hot (19)

What is Docker
What is DockerWhat is Docker
What is Docker
 
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 101 - Getting started
Docker 101 - Getting startedDocker 101 - Getting started
Docker 101 - Getting started
 
Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Hero
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Docker intro
Docker introDocker intro
Docker intro
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Docker 101: An Introduction
Docker 101: An IntroductionDocker 101: An Introduction
Docker 101: An Introduction
 
Docker
DockerDocker
Docker
 
Docker
DockerDocker
Docker
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101
 
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
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Docker get started
Docker get startedDocker get started
Docker get started
 
Docker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery Workshop
 
Docker Basic Presentation
Docker Basic PresentationDocker Basic Presentation
Docker Basic Presentation
 
OpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQOpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQ
 
Dockerizing your applications - Docker workshop @Twitter
Dockerizing your applications - Docker workshop @TwitterDockerizing your applications - Docker workshop @Twitter
Dockerizing your applications - Docker workshop @Twitter
 

Viewers also liked

Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker, Inc.
 
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
 
Vagrant vs Docker
Vagrant vs DockerVagrant vs Docker
Vagrant vs Dockerjchase50
 
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
 
Docker All The Things - ASP.NET 4.x and Windows Server Containers
Docker All The Things - ASP.NET 4.x and Windows Server ContainersDocker All The Things - ASP.NET 4.x and Windows Server Containers
Docker All The Things - ASP.NET 4.x and Windows Server ContainersAnthony Chu
 
Red Hat Certified engineer course
  Red Hat Certified engineer course   Red Hat Certified engineer course
Red Hat Certified engineer course Ali Abdo
 

Viewers also liked (20)

Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
 
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 on Windows
Docker on WindowsDocker on Windows
Docker on Windows
 
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
 
Vagrant + Docker
Vagrant + DockerVagrant + Docker
Vagrant + Docker
 
Docker compose selenium-grid_tottoruby_25
Docker compose selenium-grid_tottoruby_25Docker compose selenium-grid_tottoruby_25
Docker compose selenium-grid_tottoruby_25
 
Vagrant vs Docker
Vagrant vs DockerVagrant vs Docker
Vagrant vs Docker
 
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 Basics
Docker BasicsDocker Basics
Docker Basics
 
docker installation and basics
docker installation and basicsdocker installation and basics
docker installation and basics
 
Docker All The Things - ASP.NET 4.x and Windows Server Containers
Docker All The Things - ASP.NET 4.x and Windows Server ContainersDocker All The Things - ASP.NET 4.x and Windows Server Containers
Docker All The Things - ASP.NET 4.x and Windows Server Containers
 
Getting started with BeagleBone Black - Embedded Linux
Getting started with BeagleBone Black - Embedded LinuxGetting started with BeagleBone Black - Embedded Linux
Getting started with BeagleBone Black - Embedded Linux
 
BusyBox for Embedded Linux
BusyBox for Embedded LinuxBusyBox for Embedded Linux
BusyBox for Embedded Linux
 
Red Hat Certified engineer course
  Red Hat Certified engineer course   Red Hat Certified engineer course
Red Hat Certified engineer course
 

Similar to Dockerfile basics | docker workshop #1 at Rackspace

Dockerfile at Guidewire
Dockerfile at GuidewireDockerfile at Guidewire
Dockerfile at GuidewireDocker, Inc.
 
Dockerfile Basics Workshop #2
Dockerfile Basics Workshop #2Dockerfile Basics Workshop #2
Dockerfile Basics Workshop #2Docker, 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
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerKuan Yen Heng
 
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)
 
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
 
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 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
 
dockerizing web application
dockerizing web applicationdockerizing web application
dockerizing web applicationWalid Ashraf
 
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
 
Docker 101 - Intro to Docker
Docker 101 - Intro to DockerDocker 101 - Intro to Docker
Docker 101 - Intro to DockerAdrian Otto
 

Similar to Dockerfile basics | docker workshop #1 at Rackspace (20)

Dockerfile at Guidewire
Dockerfile at GuidewireDockerfile at Guidewire
Dockerfile at Guidewire
 
Dockerfile Basics Workshop #2
Dockerfile Basics Workshop #2Dockerfile Basics Workshop #2
Dockerfile Basics Workshop #2
 
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
 
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
 
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, LinuX Container
Docker, LinuX ContainerDocker, LinuX Container
Docker, LinuX Container
 
Docker presentation
Docker presentationDocker presentation
Docker presentation
 
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
 
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
 
dockerizing web application
dockerizing web applicationdockerizing web application
dockerizing web application
 
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...
 
Docker
DockerDocker
Docker
 
Docker tips
Docker tipsDocker tips
Docker tips
 
Docker 2014
Docker 2014Docker 2014
Docker 2014
 
Docker Workshop
Docker WorkshopDocker Workshop
Docker Workshop
 
A Hands-on Introduction to Docker
A Hands-on Introduction to DockerA Hands-on Introduction to Docker
A Hands-on Introduction to Docker
 
Docker 101 - Intro to Docker
Docker 101 - Intro to DockerDocker 101 - Intro to Docker
Docker 101 - Intro to Docker
 

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

Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
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
 
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
 
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
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
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
 
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
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
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
 
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
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
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
 

Recently uploaded (20)

Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
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
 
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
 
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
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
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
 
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
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
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
 
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...
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
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
 

Dockerfile basics | docker workshop #1 at Rackspace

  • 1. Dockerfile basics docker workshop #1 at GeekDom / Rackspace
  • 2. Dockerfiles • Dockerfiles = image representations • Simple syntax for building images • Automate and script the images creation
  • 3. 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. 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. docker build • Creates an image from a Dockerfile • From the current directory = docker build • From stdin = docker build - < Dockerfile • From GitHub = docker build github.com/creack/docker-firefox • TIP: Use –t to tag your image
  • 6. 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 • http://instacached.com/D1 • Docker build –t memcached .
  • 7. # Commenting • # • http://instacached.com/D2 # Memcached # # VERSION 1.0 # use the ubuntu base image provided by dotCloud 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. MAINTAINER • specify name / contact of the person maintaining the Dockerfile • Example: MAINTAINER Yannis, yannis@dotcloud.com • http://instacached.com/D3 # Memcached # # VERSION 1.0 # use the ubuntu base image provided by dotCloud FROM ubuntu MAINTAINER Yannis, yannis@dotcloud.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. ENTRYPOINT 1/2 • Triggers a command as soon as the container starts • Example: ENTRYPOINT echo “Whale You Be My Container?” • http://instacached.com/D4 # Whale you be my container? # # VERSION 0.42 # use the base image provided by dotCloud FROM base MAINTAINER Victor Coisne victor.coisne@dotcloud.com # say hello when the container is launched ENTRYPOINT echo "Whale you be my container"
  • 10. ENTRYPOINT 2/2 • Run containers as executables! :) • cat /etc/passwd | docker run -i wc • http://instacached.com/D5 # This is wc # # VERSION 0.42 # use the base image provided by dotCloud FROM base MAINTAINER Victor Coisne victor.coisne@dotcloud.com # count lines with wc ENTRYPOINT ["wc", "-l"]
  • 11. USER • Sets the username to use when running the image • Example: USER daemon
  • 12. EXPOSE • Sets ports to be publicly exposed when running the image • Example: EXPOSE 11211
  • 13. Memcached • http://instacached.com/Dockerfile • docker build -t memcached - < Dockerfile • docker run memcached • BOOM! :) • Try it • Python: http://instacached.com/test.py.txt • Ruby: http://instacached.com/test.rb.txt • PHP: http://instacached.com/test.php.txt
  • 14. Online Dockerfile Tutorials • Check our Dockerfile tutorials and test your skills here: http://www.docker.io/learn/dockerfile/
  • 15. Thank you • GeekDom SF • Rackspace • Docker / dotCloud • Blake Haggerty • Robert Hrdinsky • You!