Member-only story

100 Days of DevOps — Day 59- Introduction to DockerFile

Prashant Lakhera
2 min readApr 11, 2019

Welcome to Day 59 of 100 Days of DevOps, Focus for today is DockerFile

What is DockerFile?

  • A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image
  • Basic Dockerfile look like this
#My first test docker fileFROM centos:7LABEL maintainer="plakhera@example.com"RUN yum -y install httpd
  • When we build a dockerfile it should name as Dockerfile(case-sensitive)
  • FROM specify from where we building this image
  • LABEL refer to the person who is maintaining/creating this image(earlier maintainer option is deprecated and it’s label now)
  • RUN refer to the command we are running
  • Now we are going to build in the context(. indicate the current directory)
# docker build -t myfirstimage:v1 .Sending build context to Docker daemon  2.048kBStep 1/3 : FROM centos:7---> e934aafc2206Step 2/3 : LABEL maintainer="plakhera@example.com"---> a4f7e2fbcc92Step 3/3 : RUN yum -y install httpd---> Running in 57199dabb5ec
  • Here step refers to the layer

--

--

Prashant Lakhera
Prashant Lakhera

Written by Prashant Lakhera

AWS Community Builder, Ex-Redhat, Author, Blogger, YouTuber, RHCA, RHCDS, RHCE, Docker Certified,4XAWS, CCNA, MCP, Certified Jenkins, Terraform Certified, 1XGCP

No responses yet