Dockerfile
if dockerfile named is changed we shd use
$ docker build -f dockerfilenmae -t imagename .
-f dockerfile
-t --> it is imagename
- FROM: indicates base image to run our application, we can have more than 1 base image
ex:- FROM ubuntu
- MAINTAINER - represent who is the author of dockerfile
ex:- MAINTAINER GOVI
- COPY - is used to copy files or folders to image while creating image
ex:- COPY <source> <destination>
- ADD - is used to copy files to image
ex:- ADD <source> <destination>
add cmd can extract tar file only not zip files
DIFFERENCE BETWEEN COPY AND ADD --> ADD CMD can download files from remote url (its wget in docker file)
- RUN - it used to execute cmds only while creating the image
ex:- RUN mkdir workspace
ex:- RUN apt install git -y
- 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
- 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"]
- WORKDIR - used to set working DIR of image or container ( the cmds will be executed from WORKDIR directory
ex: WORKDIR <DIR-PATH>
- ENV - used to set environment variables
ex: ENV <key> <value>
LABEL - used to represent data in key-value pair
ARG - used to avoid hard-coded values in docker file
ex:- ARG branch=dev
USER - used to set user for container or images
EXPOSE - used to represent which port number our container is running