SlideShare a Scribd company logo
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
Agenda
What is DevOps?
DevOps Use Case
DevOps Phases
DevOps Hands-On
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
Topics for Today’s Session
www.edureka.co/devopsDevOps Certification Training
What is Docker?1
What is a Dockerfile?2
Dockerfile syntax3
Hands-on: Dockerizing Apache & Nginx4
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
What is Docker?
www.edureka.co/devopsDevOps Certification Training
The Old Way: Application on Host The New Way: Deploy Containers
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
How To Use Docker?
www.edureka.co/devopsDevOps Certification Training
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
How to build
Docker Images?
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
How To Build Docker Images? – Using Predefined Images
www.edureka.co/devopsDevOps Certification Training
Pull Docker Images
Run Docker Images
to Create Docker
Containers
Docker
Container
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
What if I want to
create my own
image?
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
How To Build Docker Images? – Using DockerFile
www.edureka.co/devopsDevOps Certification Training
DockerFile
Dockerfile is a script, composed of various commands (instructions) and arguments listed successively to automatically perform actions on a
base image in order to create (or form) a new one
Base Image
RUN
FROM
MAINTAINER
ADD
CMD
ENTRYPOINT
ENV
EXPOSE
USER
VOLUME
WORKDIR
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
How To Write A
DockerFile?
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
DockerFile Syntax
www.edureka.co/devopsDevOps Certification Training
Dockerfile syntax consists of two kind of main line blocks: comments and commands + arguments
# Line blocks used for commenting
command argument argument1...
Syntax
# Print “Welcome To Edureka!”
RUN echo “Welcome To Edureka!”
Example
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Let’s have a look at Different Set of Commands which DockerFile can
Contain Before working on a DockerFile Example
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
DockerFile Commands – FROM
www.edureka.co/devopsDevOps Certification Training
FROM
FROM directive is probably the most crucial amongst all others for Dockerfiles. It defines the base image to
use to start the build process
# Usage: FROM [image name]
FROM ubuntu
Example:
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
DockerFile Commands – RUN
www.edureka.co/devopsDevOps Certification Training
RUN
The RUN command is the central executing directive for Dockerfiles. It takes a command as its argument
and runs it to form the image. Unlike CMD, it actually is used to build the image
# Usage: RUN [command]
RUN apt-get install -y riak
Example:
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
DockerFile Commands – CMD
www.edureka.co/devopsDevOps Certification Training
CMD
The command CMD, similar to RUN, can be used for executing a specific command. However, unlike RUN it
is not executed during build, but when a container is instantiated using the image being built
# Usage 1: CMD application "argument", "argument", ..
CMD "echo" " Welcome To Edureka!"
Example:
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
DockerFile Commands – ENTRYPOINT
www.edureka.co/devopsDevOps Certification Training
ENTRYPOINT
ENTRYPOINT argument sets the concrete default application that is used every time a container is created
using the image
# Usage: ENTRYPOINT application "argument", "argument", ..
# Remember: arguments are optional. They can be provided by CMD
# or during the creation of a container.
ENTRYPOINT echo
# Usage example with CMD:
# Arguments set with CMD can be overridden during *run* CMD "Hello docker!"
CMD “Welcome to edureka!”
ENTRYPOINT echo
Example:
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
DockerFile Commands – ADD
www.edureka.co/devopsDevOps Certification Training
ADD
The ADD command gets two arguments: a source and a destination. It basically copies the files from
the source on the host into the container's own filesystem at the set destination
# Usage: ADD [source directory or URL] [destination directory]
ADD /my_app_folder /my_app_folder
Example:
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
DockerFile Commands – ENV
www.edureka.co/devopsDevOps Certification Training
ENV
The ENV command is used to set the environment variables (one or more). These variables consist of “key
value” pairs which can be accessed within the container by scripts and applications alike
# Usage: ENV key value
ENV SERVER_WORKS 4
Example:
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
DockerFile Commands – WORKDIR
www.edureka.co/devopsDevOps Certification Training
WORKDIR The WORKDIR directive is used to set where the command defined with CMD is to be executed
# Usage:
WORKDIR /path WORKDIR ~/
Example:
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
DockerFile Commands – EXPOSE
www.edureka.co/devopsDevOps Certification Training
EXPOSE
The EXPOSE command is used to associate a specified port to enable networking between the running
process inside the container and the outside world (i.e. the host)
# Usage: EXPOSE [port]
EXPOSE 8080
Example:
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
DockerFile Commands – MAINTAINER
www.edureka.co/devopsDevOps Certification Training
MAINTAINER
This non-executing command declares the author, hence setting the author field of the images. It should
come nonetheless after FROM
# Usage: MAINTAINER [name]
MAINTAINER authors_name
Example:
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
DockerFile Commands – USER
www.edureka.co/devopsDevOps Certification Training
USER
The USER directive is used to set the UID (or username) which is to run the container based on the image
being built
# Usage: USER [UID]
USER 751
Example:
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
DockerFile Commands – VOLUME
www.edureka.co/devopsDevOps Certification Training
VOLUME
The VOLUME command is used to enable access from your container to a directory on the host machine
(i.e. mounting it)
# Usage: VOLUME ["/dir_1", "/dir_2" ..]
VOLUME ["/my_files"]
Example:
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Creating an Image to Install Apache Web Server
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
FROM ubuntu:12.04
MAINTAINER edureka
RUN apt-get update && apt-get install -y apache2 && apt-get clean && rm -rf /var/lib/apt/lists/*
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
EXPOSE 80
CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]
DockerFile For Installing Apache
www.edureka.co/devopsDevOps Certification Training
In addition to its HTTP server capabilities, NGINX can also function as a proxy server for email (IMAP, POP3, and SMTP) and a
reverse proxy and load balancer for HTTP, TCP, and UDP servers.
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile For Installing Nginx
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
DockerFile Tutorial
www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING
FROM ubuntu:14.04
MAINTAINER edureka
RUN apt-get update
RUN apt-get install -y nginx
ADD index.html /usr/share/nginx/html/index.html
ENTRYPOINT ["/usr/sbin/nginx", "-g", "daemon off;"]
EXPOSE 80
DockerFile For Installing Nginx
www.edureka.co/devopsDevOps Certification Training
Apache2 Web Server. Apache is the most commonly used Web server on Linux systems. Web servers are used to serve Web
pages requested by client computers
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Training | Edureka

More Related Content

What's hot

Docker intro
Docker introDocker intro
Docker intro
Oleg Z
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
DuckDuckGo
 
Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Hero
fazalraja
 
Kubernetes
KubernetesKubernetes
Kubernetes
erialc_w
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker, Inc.
 
Introduction to Docker - VIT Campus
Introduction to Docker - VIT CampusIntroduction to Docker - VIT Campus
Introduction to Docker - VIT Campus
Ajeet Singh Raina
 
Getting started with Docker
Getting started with DockerGetting started with Docker
Getting started with Docker
Ravindu Fernando
 
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...
Edureka!
 
Docker in real life
Docker in real lifeDocker in real life
Docker in real life
Nguyen Van Vuong
 
Docker Advanced registry usage
Docker Advanced registry usageDocker Advanced registry usage
Docker Advanced registry usage
Docker, Inc.
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
Peng Xiao
 
Docker
DockerDocker
Kubernetes in Docker
Kubernetes in DockerKubernetes in Docker
Kubernetes in Docker
Docker, Inc.
 
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
Simplilearn
 
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Simplilearn
 
Docker
DockerDocker
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to dockerJohn Willis
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
Luong Vo
 
Docker introduction for the beginners
Docker introduction for the beginnersDocker introduction for the beginners
Docker introduction for the beginners
Juneyoung Oh
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
Eueung Mulyana
 

What's hot (20)

Docker intro
Docker introDocker intro
Docker intro
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Hero
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
 
Introduction to Docker - VIT Campus
Introduction to Docker - VIT CampusIntroduction to Docker - VIT Campus
Introduction to Docker - VIT Campus
 
Getting started with Docker
Getting started with DockerGetting started with Docker
Getting started with Docker
 
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...
 
Docker in real life
Docker in real lifeDocker in real life
Docker in real life
 
Docker Advanced registry usage
Docker Advanced registry usageDocker Advanced registry usage
Docker Advanced registry usage
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Docker
DockerDocker
Docker
 
Kubernetes in Docker
Kubernetes in DockerKubernetes in Docker
Kubernetes in Docker
 
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
 
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
 
Docker
DockerDocker
Docker
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Docker introduction for the beginners
Docker introduction for the beginnersDocker introduction for the beginners
Docker introduction for the beginners
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 

Similar to Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Training | Edureka

Docker team training
Docker team trainingDocker team training
Docker team training
Karthik Venkateswaran
 
Docker Swarm For High Availability | Docker Tutorial | DevOps Tutorial | Edureka
Docker Swarm For High Availability | Docker Tutorial | DevOps Tutorial | EdurekaDocker Swarm For High Availability | Docker Tutorial | DevOps Tutorial | Edureka
Docker Swarm For High Availability | Docker Tutorial | DevOps Tutorial | Edureka
Edureka!
 
Docker For Windows | Setting Up Docker On Windows | Edureka
Docker For Windows | Setting Up Docker On Windows | EdurekaDocker For Windows | Setting Up Docker On Windows | Edureka
Docker For Windows | Setting Up Docker On Windows | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
Edureka!
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdf
OKLABS
 
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Edureka!
 
Docker @ Atlogys
Docker @ AtlogysDocker @ Atlogys
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Edureka!
 
dockerizing web application
dockerizing web applicationdockerizing web application
dockerizing web application
Walid Ashraf
 
DevOps-Redefining your IT Strategy-28thJan15
DevOps-Redefining your IT Strategy-28thJan15DevOps-Redefining your IT Strategy-28thJan15
DevOps-Redefining your IT Strategy-28thJan15
Edureka!
 
Linux Training For Beginners | Linux Administration Tutorial | Introduction T...
Linux Training For Beginners | Linux Administration Tutorial | Introduction T...Linux Training For Beginners | Linux Administration Tutorial | Introduction T...
Linux Training For Beginners | Linux Administration Tutorial | Introduction T...
Edureka!
 
Docker Networking | Container Network Model (CNM) | Docker Tutorial For Begin...
Docker Networking | Container Network Model (CNM) | Docker Tutorial For Begin...Docker Networking | Container Network Model (CNM) | Docker Tutorial For Begin...
Docker Networking | Container Network Model (CNM) | Docker Tutorial For Begin...
Edureka!
 
Docker Compose | Containerizing MEAN Stack Application | DevOps Tutorial | Ed...
Docker Compose | Containerizing MEAN Stack Application | DevOps Tutorial | Ed...Docker Compose | Containerizing MEAN Stack Application | DevOps Tutorial | Ed...
Docker Compose | Containerizing MEAN Stack Application | DevOps Tutorial | Ed...
Edureka!
 
Continuous Delivery with Docker and Jenkins pipeline
Continuous Delivery with Docker and Jenkins pipelineContinuous Delivery with Docker and Jenkins pipeline
Continuous Delivery with Docker and Jenkins pipeline
Slam Han
 
Docker how to
Docker how toDocker how to
Docker how to
Patryk Omiotek
 
Of Docker and Drupal
Of Docker and DrupalOf Docker and Drupal
Of Docker and Drupal
Gerald Villorente
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windows
Docker, Inc.
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
양재동 코드랩
 
Docker @ FOSS4G 2016, Bonn
Docker @ FOSS4G 2016, BonnDocker @ FOSS4G 2016, Bonn
Docker @ FOSS4G 2016, Bonn
Daniel Nüst
 
Screw DevOps, Let's Talk DataOps
Screw DevOps, Let's Talk DataOpsScrew DevOps, Let's Talk DataOps
Screw DevOps, Let's Talk DataOps
Kellyn Pot'Vin-Gorman
 

Similar to Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Training | Edureka (20)

Docker team training
Docker team trainingDocker team training
Docker team training
 
Docker Swarm For High Availability | Docker Tutorial | DevOps Tutorial | Edureka
Docker Swarm For High Availability | Docker Tutorial | DevOps Tutorial | EdurekaDocker Swarm For High Availability | Docker Tutorial | DevOps Tutorial | Edureka
Docker Swarm For High Availability | Docker Tutorial | DevOps Tutorial | Edureka
 
Docker For Windows | Setting Up Docker On Windows | Edureka
Docker For Windows | Setting Up Docker On Windows | EdurekaDocker For Windows | Setting Up Docker On Windows | Edureka
Docker For Windows | Setting Up Docker On Windows | Edureka
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdf
 
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
Docker Commands With Examples | Docker Tutorial | DevOps Tutorial | Docker Tr...
 
Docker @ Atlogys
Docker @ AtlogysDocker @ Atlogys
Docker @ Atlogys
 
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
 
dockerizing web application
dockerizing web applicationdockerizing web application
dockerizing web application
 
DevOps-Redefining your IT Strategy-28thJan15
DevOps-Redefining your IT Strategy-28thJan15DevOps-Redefining your IT Strategy-28thJan15
DevOps-Redefining your IT Strategy-28thJan15
 
Linux Training For Beginners | Linux Administration Tutorial | Introduction T...
Linux Training For Beginners | Linux Administration Tutorial | Introduction T...Linux Training For Beginners | Linux Administration Tutorial | Introduction T...
Linux Training For Beginners | Linux Administration Tutorial | Introduction T...
 
Docker Networking | Container Network Model (CNM) | Docker Tutorial For Begin...
Docker Networking | Container Network Model (CNM) | Docker Tutorial For Begin...Docker Networking | Container Network Model (CNM) | Docker Tutorial For Begin...
Docker Networking | Container Network Model (CNM) | Docker Tutorial For Begin...
 
Docker Compose | Containerizing MEAN Stack Application | DevOps Tutorial | Ed...
Docker Compose | Containerizing MEAN Stack Application | DevOps Tutorial | Ed...Docker Compose | Containerizing MEAN Stack Application | DevOps Tutorial | Ed...
Docker Compose | Containerizing MEAN Stack Application | DevOps Tutorial | Ed...
 
Continuous Delivery with Docker and Jenkins pipeline
Continuous Delivery with Docker and Jenkins pipelineContinuous Delivery with Docker and Jenkins pipeline
Continuous Delivery with Docker and Jenkins pipeline
 
Docker how to
Docker how toDocker how to
Docker how to
 
Of Docker and Drupal
Of Docker and DrupalOf Docker and Drupal
Of Docker and Drupal
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windows
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
 
Docker @ FOSS4G 2016, Bonn
Docker @ FOSS4G 2016, BonnDocker @ FOSS4G 2016, Bonn
Docker @ FOSS4G 2016, Bonn
 
Screw DevOps, Let's Talk DataOps
Screw DevOps, Let's Talk DataOpsScrew DevOps, Let's Talk DataOps
Screw DevOps, Let's Talk DataOps
 

More from Edureka!

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
ITIL® Tutorial for Beginners | ITIL® Foundation Training | Edureka
ITIL® Tutorial for Beginners | ITIL® Foundation Training | EdurekaITIL® Tutorial for Beginners | ITIL® Foundation Training | Edureka
ITIL® Tutorial for Beginners | ITIL® Foundation Training | Edureka
Edureka!
 

More from Edureka! (20)

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
 
ITIL® Tutorial for Beginners | ITIL® Foundation Training | Edureka
ITIL® Tutorial for Beginners | ITIL® Foundation Training | EdurekaITIL® Tutorial for Beginners | ITIL® Foundation Training | Edureka
ITIL® Tutorial for Beginners | ITIL® Foundation Training | Edureka
 

Recently uploaded

Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 

Recently uploaded (20)

Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 

Dockerfile Tutorial with Example | Creating your First Dockerfile | Docker Training | Edureka

  • 1. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING Agenda What is DevOps? DevOps Use Case DevOps Phases DevOps Hands-On
  • 2. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING Topics for Today’s Session www.edureka.co/devopsDevOps Certification Training What is Docker?1 What is a Dockerfile?2 Dockerfile syntax3 Hands-on: Dockerizing Apache & Nginx4
  • 3. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING What is Docker? www.edureka.co/devopsDevOps Certification Training The Old Way: Application on Host The New Way: Deploy Containers
  • 4. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING How To Use Docker? www.edureka.co/devopsDevOps Certification Training
  • 5. Copyright © 2017, edureka and/or its affiliates. All rights reserved. How to build Docker Images?
  • 6. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING How To Build Docker Images? – Using Predefined Images www.edureka.co/devopsDevOps Certification Training Pull Docker Images Run Docker Images to Create Docker Containers Docker Container
  • 7. Copyright © 2017, edureka and/or its affiliates. All rights reserved. What if I want to create my own image?
  • 8. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING How To Build Docker Images? – Using DockerFile www.edureka.co/devopsDevOps Certification Training DockerFile Dockerfile is a script, composed of various commands (instructions) and arguments listed successively to automatically perform actions on a base image in order to create (or form) a new one Base Image RUN FROM MAINTAINER ADD CMD ENTRYPOINT ENV EXPOSE USER VOLUME WORKDIR
  • 9. Copyright © 2017, edureka and/or its affiliates. All rights reserved. How To Write A DockerFile?
  • 10. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING DockerFile Syntax www.edureka.co/devopsDevOps Certification Training Dockerfile syntax consists of two kind of main line blocks: comments and commands + arguments # Line blocks used for commenting command argument argument1... Syntax # Print “Welcome To Edureka!” RUN echo “Welcome To Edureka!” Example
  • 11. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Let’s have a look at Different Set of Commands which DockerFile can Contain Before working on a DockerFile Example
  • 12. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING DockerFile Commands – FROM www.edureka.co/devopsDevOps Certification Training FROM FROM directive is probably the most crucial amongst all others for Dockerfiles. It defines the base image to use to start the build process # Usage: FROM [image name] FROM ubuntu Example:
  • 13. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING DockerFile Commands – RUN www.edureka.co/devopsDevOps Certification Training RUN The RUN command is the central executing directive for Dockerfiles. It takes a command as its argument and runs it to form the image. Unlike CMD, it actually is used to build the image # Usage: RUN [command] RUN apt-get install -y riak Example:
  • 14. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING DockerFile Commands – CMD www.edureka.co/devopsDevOps Certification Training CMD The command CMD, similar to RUN, can be used for executing a specific command. However, unlike RUN it is not executed during build, but when a container is instantiated using the image being built # Usage 1: CMD application "argument", "argument", .. CMD "echo" " Welcome To Edureka!" Example:
  • 15. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING DockerFile Commands – ENTRYPOINT www.edureka.co/devopsDevOps Certification Training ENTRYPOINT ENTRYPOINT argument sets the concrete default application that is used every time a container is created using the image # Usage: ENTRYPOINT application "argument", "argument", .. # Remember: arguments are optional. They can be provided by CMD # or during the creation of a container. ENTRYPOINT echo # Usage example with CMD: # Arguments set with CMD can be overridden during *run* CMD "Hello docker!" CMD “Welcome to edureka!” ENTRYPOINT echo Example:
  • 16. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING DockerFile Commands – ADD www.edureka.co/devopsDevOps Certification Training ADD The ADD command gets two arguments: a source and a destination. It basically copies the files from the source on the host into the container's own filesystem at the set destination # Usage: ADD [source directory or URL] [destination directory] ADD /my_app_folder /my_app_folder Example:
  • 17. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING DockerFile Commands – ENV www.edureka.co/devopsDevOps Certification Training ENV The ENV command is used to set the environment variables (one or more). These variables consist of “key value” pairs which can be accessed within the container by scripts and applications alike # Usage: ENV key value ENV SERVER_WORKS 4 Example:
  • 18. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING DockerFile Commands – WORKDIR www.edureka.co/devopsDevOps Certification Training WORKDIR The WORKDIR directive is used to set where the command defined with CMD is to be executed # Usage: WORKDIR /path WORKDIR ~/ Example:
  • 19. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING DockerFile Commands – EXPOSE www.edureka.co/devopsDevOps Certification Training EXPOSE The EXPOSE command is used to associate a specified port to enable networking between the running process inside the container and the outside world (i.e. the host) # Usage: EXPOSE [port] EXPOSE 8080 Example:
  • 20. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING DockerFile Commands – MAINTAINER www.edureka.co/devopsDevOps Certification Training MAINTAINER This non-executing command declares the author, hence setting the author field of the images. It should come nonetheless after FROM # Usage: MAINTAINER [name] MAINTAINER authors_name Example:
  • 21. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING DockerFile Commands – USER www.edureka.co/devopsDevOps Certification Training USER The USER directive is used to set the UID (or username) which is to run the container based on the image being built # Usage: USER [UID] USER 751 Example:
  • 22. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING DockerFile Commands – VOLUME www.edureka.co/devopsDevOps Certification Training VOLUME The VOLUME command is used to enable access from your container to a directory on the host machine (i.e. mounting it) # Usage: VOLUME ["/dir_1", "/dir_2" ..] VOLUME ["/my_files"] Example:
  • 23. Copyright © 2017, edureka and/or its affiliates. All rights reserved. Creating an Image to Install Apache Web Server
  • 24. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING FROM ubuntu:12.04 MAINTAINER edureka RUN apt-get update && apt-get install -y apache2 && apt-get clean && rm -rf /var/lib/apt/lists/* ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data ENV APACHE_LOG_DIR /var/log/apache2 EXPOSE 80 CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"] DockerFile For Installing Apache www.edureka.co/devopsDevOps Certification Training In addition to its HTTP server capabilities, NGINX can also function as a proxy server for email (IMAP, POP3, and SMTP) and a reverse proxy and load balancer for HTTP, TCP, and UDP servers.
  • 25. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile For Installing Nginx
  • 26. Copyright © 2017, edureka and/or its affiliates. All rights reserved. DockerFile Tutorial www.edureka.co/devopsDEVOPS CERTIFICATION TRAINING FROM ubuntu:14.04 MAINTAINER edureka RUN apt-get update RUN apt-get install -y nginx ADD index.html /usr/share/nginx/html/index.html ENTRYPOINT ["/usr/sbin/nginx", "-g", "daemon off;"] EXPOSE 80 DockerFile For Installing Nginx www.edureka.co/devopsDevOps Certification Training Apache2 Web Server. Apache is the most commonly used Web server on Linux systems. Web servers are used to serve Web pages requested by client computers
  • 27. Copyright © 2017, edureka and/or its affiliates. All rights reserved.