SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

OpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQOpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQdotCloud
 
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
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to dockerWei-Ting Kuo
 
Docker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopJirayut Nimsaeng
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to dockerWalid Ashraf
 
Docker 101: An Introduction
Docker 101: An IntroductionDocker 101: An Introduction
Docker 101: An IntroductionPOSSCON
 
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
 
Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Nicolas Poggi
 
docker installation and basics
docker installation and basicsdocker installation and basics
docker installation and basicsWalid Ashraf
 
Ruby and Docker on Rails
Ruby and Docker on RailsRuby and Docker on Rails
Ruby and Docker on RailsMuriel Salvan
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and dockerDuckDuckGo
 
Locally it worked! virtualizing docker
Locally it worked! virtualizing dockerLocally it worked! virtualizing docker
Locally it worked! virtualizing dockerSascha Brinkmann
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Bill Maxwell
 
Hands-On Session Docker
Hands-On Session DockerHands-On Session Docker
Hands-On Session DockerLinetsChile
 

Mais procurados (19)

OpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQOpenStack - Docker - Rackspace HQ
OpenStack - Docker - Rackspace HQ
 
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
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Intro To Docker
Intro To DockerIntro To Docker
Intro To Docker
 
Docker
DockerDocker
Docker
 
What is Docker
What is DockerWhat is Docker
What is Docker
 
Docker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery Workshop
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Docker 101: An Introduction
Docker 101: An IntroductionDocker 101: An Introduction
Docker 101: An Introduction
 
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
 
Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]
 
docker installation and basics
docker installation and basicsdocker installation and basics
docker installation and basics
 
Ruby and Docker on Rails
Ruby and Docker on RailsRuby and Docker on Rails
Ruby and Docker on Rails
 
Introduction To Docker
Introduction To DockerIntroduction To Docker
Introduction To Docker
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and docker
 
Locally it worked! virtualizing docker
Locally it worked! virtualizing dockerLocally it worked! virtualizing docker
Locally it worked! virtualizing docker
 
Austin - Container Days - Docker 101
Austin - Container Days - Docker 101Austin - Container Days - Docker 101
Austin - Container Days - Docker 101
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Hands-On Session Docker
Hands-On Session DockerHands-On Session Docker
Hands-On Session Docker
 

Destaque

Docker, Innovation Accelerator
Docker, Innovation AcceleratorDocker, Innovation Accelerator
Docker, Innovation AcceleratorDocker, Inc.
 
Test What You Write, Ship What You Test
Test What You Write, Ship What You TestTest What You Write, Ship What You Test
Test What You Write, Ship What You TestDocker, Inc.
 
DockerCon EU 2015: Nesting Containers: Real Life Observations
DockerCon EU 2015: Nesting Containers: Real Life ObservationsDockerCon EU 2015: Nesting Containers: Real Life Observations
DockerCon EU 2015: Nesting Containers: Real Life ObservationsDocker, Inc.
 
Why should I care about stateful containers?
Why should I care about stateful containers?Why should I care about stateful containers?
Why should I care about stateful containers?Docker, Inc.
 
Understanding Containers through Gaming by Brendan Fosberry
Understanding Containers through Gaming by Brendan Fosberry Understanding Containers through Gaming by Brendan Fosberry
Understanding Containers through Gaming by Brendan Fosberry Docker, Inc.
 
LXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous DeliveryLXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous DeliveryDocker, Inc.
 
Containerize All the (Multi-Platform) Things! by Phil Estes
Containerize All the (Multi-Platform) Things! by Phil EstesContainerize All the (Multi-Platform) Things! by Phil Estes
Containerize All the (Multi-Platform) Things! by Phil EstesDocker, Inc.
 
DockerCon SF 2015: Docker After Launching 1 Billion Containers
DockerCon SF 2015: Docker After Launching 1 Billion ContainersDockerCon SF 2015: Docker After Launching 1 Billion Containers
DockerCon SF 2015: Docker After Launching 1 Billion ContainersDocker, Inc.
 
Docker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker, Inc.
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPressDocker, Inc.
 
Dockercon Swarm Updated
Dockercon Swarm UpdatedDockercon Swarm Updated
Dockercon Swarm UpdatedDocker, Inc.
 
Trust and Image Provenance by Derek McGowan
Trust and Image Provenance by Derek McGowanTrust and Image Provenance by Derek McGowan
Trust and Image Provenance by Derek McGowanDocker, Inc.
 
Intro to Docker November 2013
Intro to Docker November 2013Intro to Docker November 2013
Intro to Docker November 2013Docker, Inc.
 
DockerCon14 John Engates
DockerCon14 John EngatesDockerCon14 John Engates
DockerCon14 John EngatesDocker, Inc.
 
WOT Cloud Computing Architect Summit
WOT Cloud Computing Architect SummitWOT Cloud Computing Architect Summit
WOT Cloud Computing Architect SummitDocker, Inc.
 
Autoscaling Docker Containers by Konstantinos Faliagkas, Docker Birthday #3 A...
Autoscaling Docker Containers by Konstantinos Faliagkas, Docker Birthday #3 A...Autoscaling Docker Containers by Konstantinos Faliagkas, Docker Birthday #3 A...
Autoscaling Docker Containers by Konstantinos Faliagkas, Docker Birthday #3 A...Docker, Inc.
 
DockerCon EU 2015: Monitoring and Managing Dynamic Docker Environments
DockerCon EU 2015: Monitoring and Managing Dynamic Docker EnvironmentsDockerCon EU 2015: Monitoring and Managing Dynamic Docker Environments
DockerCon EU 2015: Monitoring and Managing Dynamic Docker EnvironmentsDocker, Inc.
 
DockerCon 14 Keynote Day 2
DockerCon 14 Keynote Day 2DockerCon 14 Keynote Day 2
DockerCon 14 Keynote Day 2Docker, Inc.
 
Cost Control Across Cloud, On-Premise and VM Computers by Mark Lavi, Calm.io
Cost Control Across Cloud, On-Premise and VM Computers by Mark Lavi, Calm.ioCost Control Across Cloud, On-Premise and VM Computers by Mark Lavi, Calm.io
Cost Control Across Cloud, On-Premise and VM Computers by Mark Lavi, Calm.ioDocker, Inc.
 

Destaque (20)

Docker, Innovation Accelerator
Docker, Innovation AcceleratorDocker, Innovation Accelerator
Docker, Innovation Accelerator
 
Test What You Write, Ship What You Test
Test What You Write, Ship What You TestTest What You Write, Ship What You Test
Test What You Write, Ship What You Test
 
DockerCon EU 2015: Nesting Containers: Real Life Observations
DockerCon EU 2015: Nesting Containers: Real Life ObservationsDockerCon EU 2015: Nesting Containers: Real Life Observations
DockerCon EU 2015: Nesting Containers: Real Life Observations
 
Developer Week
Developer WeekDeveloper Week
Developer Week
 
Why should I care about stateful containers?
Why should I care about stateful containers?Why should I care about stateful containers?
Why should I care about stateful containers?
 
Understanding Containers through Gaming by Brendan Fosberry
Understanding Containers through Gaming by Brendan Fosberry Understanding Containers through Gaming by Brendan Fosberry
Understanding Containers through Gaming by Brendan Fosberry
 
LXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous DeliveryLXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous Delivery
 
Containerize All the (Multi-Platform) Things! by Phil Estes
Containerize All the (Multi-Platform) Things! by Phil EstesContainerize All the (Multi-Platform) Things! by Phil Estes
Containerize All the (Multi-Platform) Things! by Phil Estes
 
DockerCon SF 2015: Docker After Launching 1 Billion Containers
DockerCon SF 2015: Docker After Launching 1 Billion ContainersDockerCon SF 2015: Docker After Launching 1 Billion Containers
DockerCon SF 2015: Docker After Launching 1 Billion Containers
 
Docker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in ProductionDocker Online Meetup #3: Docker in Production
Docker Online Meetup #3: Docker in Production
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
 
Dockercon Swarm Updated
Dockercon Swarm UpdatedDockercon Swarm Updated
Dockercon Swarm Updated
 
Trust and Image Provenance by Derek McGowan
Trust and Image Provenance by Derek McGowanTrust and Image Provenance by Derek McGowan
Trust and Image Provenance by Derek McGowan
 
Intro to Docker November 2013
Intro to Docker November 2013Intro to Docker November 2013
Intro to Docker November 2013
 
DockerCon14 John Engates
DockerCon14 John EngatesDockerCon14 John Engates
DockerCon14 John Engates
 
WOT Cloud Computing Architect Summit
WOT Cloud Computing Architect SummitWOT Cloud Computing Architect Summit
WOT Cloud Computing Architect Summit
 
Autoscaling Docker Containers by Konstantinos Faliagkas, Docker Birthday #3 A...
Autoscaling Docker Containers by Konstantinos Faliagkas, Docker Birthday #3 A...Autoscaling Docker Containers by Konstantinos Faliagkas, Docker Birthday #3 A...
Autoscaling Docker Containers by Konstantinos Faliagkas, Docker Birthday #3 A...
 
DockerCon EU 2015: Monitoring and Managing Dynamic Docker Environments
DockerCon EU 2015: Monitoring and Managing Dynamic Docker EnvironmentsDockerCon EU 2015: Monitoring and Managing Dynamic Docker Environments
DockerCon EU 2015: Monitoring and Managing Dynamic Docker Environments
 
DockerCon 14 Keynote Day 2
DockerCon 14 Keynote Day 2DockerCon 14 Keynote Day 2
DockerCon 14 Keynote Day 2
 
Cost Control Across Cloud, On-Premise and VM Computers by Mark Lavi, Calm.io
Cost Control Across Cloud, On-Premise and VM Computers by Mark Lavi, Calm.ioCost Control Across Cloud, On-Premise and VM Computers by Mark Lavi, Calm.io
Cost Control Across Cloud, On-Premise and VM Computers by Mark Lavi, Calm.io
 

Semelhante a Dockerfile Basics Workshop #1

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
 
Docker use dockerfile
Docker use dockerfileDocker use dockerfile
Docker use dockerfilecawamata
 
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
 

Semelhante a Dockerfile Basics Workshop #1 (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
 
Docker use dockerfile
Docker use dockerfileDocker use dockerfile
Docker use dockerfile
 
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
 

Mais de Docker, Inc.

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

Mais de Docker, Inc. (20)

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

Dockerfile Basics Workshop #1

  • 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!