# Dockerfile

if dockerfile named is changed we shd use

$ docker build -f dockerfilenmae -t imagename .

\-f dockerfile

\-t --&gt; it is imagename

1. FROM: indicates base image to run our application, we can have more than 1 base image
    

ex:- FROM ubuntu

1. MAINTAINER - represent who is the author of dockerfile
    

ex:- MAINTAINER GOVI

1. COPY - is used to copy files or folders to image while creating image
    

ex:- COPY &lt;source&gt; &lt;destination&gt;

1. ADD - is used to copy files to image
    

ex:- ADD &lt;source&gt; &lt;destination&gt;

add cmd can extract tar file only not zip files

DIFFERENCE BETWEEN COPY AND ADD --&gt; ADD CMD can download files from remote url (its wget in docker file)

1. RUN - it used to execute cmds only while creating the image
    

ex:- RUN mkdir workspace

ex:- RUN apt install git -y

1. CMD - used to exec cmds only while conatiner is created ,
    

( the cmds is exec when container is started it can only be run once, CMD we can override )

ex:- CMD service start docker

1. ENTRYPOINT - used to exec cmds only while the container is created, CMD we can override but ENTRYPOINT cant be override( CMD can be override using cmd line arrugument )
    

ex:- ENTRYPOINT \[ "echo",hello world"\]

1. WORKDIR - used to set working DIR of image or container ( the cmds will be executed from WORKDIR directory
    

ex: WORKDIR &lt;DIR-PATH&gt;

1. ENV - used to set environment variables
    

ex: ENV &lt;key&gt; &lt;value&gt;

1. LABEL - used to represent data in key-value pair
    
2. ARG - used to avoid hard-coded values in docker file
    
    ex:- ARG branch=dev
    
3. USER - used to set user for container or images
    
4. EXPOSE - used to represent which port number our container is running
