List out all INSTRUCTION statement of dockerfile and give one line explanation
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
1) FROM : must be the first non-comment instruction in the Dockerfile
eg : FROM ubuntu
2) MAINTAINER :instruction allows you to set the Author field of the generated images
eg : MAINTAINER Mani K.M mani.km@quest-global.command
3) RUN : The exec form makes it possible, to RUN commands using a base image that does not contain the specified shell executable
eg: RUN apt-get update
4) CMD: The main purpose of a CMD is to provide defaults for an executing container
eg : CMD echo Hello world
5) LABEL : instruction adds metadata to an image
eg : LABEL version = “1.0”
6) EXPOSE : Informs Docker that the container listens on the specified network port(s) at runtime.
eg: 80/udp
7) ENV : The ENV instruction sets the environment variable to the value .
eg: JAVA_HOME=”/usr/java/latest”
8) ADD : Copies new files, directories, or remote file URLs
eg: ADD hom* /mydir/
9) COPY : Copies new files or directories from and adds them to the filesystem of the image at the path .
eg : COPY –chown=55:mygroup files* /somedir/
10) ENTRYPOINT : Allows you to configure a container that will run as an executable.
eg : ENTRYPOINT [“/usr/sbin/apache2ctl”, “-D”, “FOREGROUND”]
11) VOLUME : Creates a mount point with the specified name and marks it as holding externally mounted volumes from native host or other containers.
eg: VOLUME /myvol
12) USER : The USER instruction sets the user name or UID to use when running the image and for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile.
eg : USER mani
13 ) WORKDIR : Sets the working directory for any RUN, CMD, ENTRYPOINT, COPY, and ADD instructions that follow it.
eg: WORKDIR /export/home
14) ARG : Defines a variable that users can pass at build-time to the builder with the docker build command using the –build-arg = flag.
eg : ARG user1=mani.km
15) ONBUILD : Adds to the image a trigger instruction to be executed at a later time, when the image is used as the base for another build. The trigger will be executed in the context of the downstream build, as if it had been inserted immediately after the FROM instruction in the downstream Dockerfile.
eg : ONBUILD RUN /usr/local/bin/python-build –dir /app/src
16) STOPSIGNAL: instruction sets the system call signal that will be sent to the container to exit. This signal can be a valid unsigned number that matches a position in the kernel’s syscall table, for instance 9, or a signal name in the format SIGNAME, for instance SIGKILL.
eg : STOPSIGNAL signal
17) HEALTHCHECK : Tells Docker how to test a container to check that it is still working
eg: HEALTHCHECK –interval=5m –timeout=3s \
CMD curl -f http://localhost/ || exit 1
18) SHELL : Allows the default shell used for the shell form of commands to be overridden.
eg : SHELL [“powershell”, “-command”]