5. List of dockerfile instructions and its Brief Summary? by Johnson

FROM : To create a base image such as an operating system

RUN: A RUN instruction is used to run specified commands. We can use multiple RUN instructions to run different commands.

CMD: If we need to run a default command that executed for all the containers of the image. If we want to run command during docker run command it overrides the default one.

ENTRYPOINT: If we try to specify default arguments in the docker run command, it will not ignore the ENTRYPOINT arguments.

WORKDIR: when enter inside the container we can specify our working directory using WORKDIR instruction.

COPY: This instruction allows you to copy a file or directory from our local machine to the docker container.

ADD: This is similar to COPY instruction like we can use ADD to copy files and folders from your local machine to docker containers. However, ADD also allows you to copy files from a URL as well as a tar file.

EXPOSE: The EXPOSE instruction inside the dockerfile is listening to the specified port in the network.

LABEL: It is a key-value pair we can use a LABEL instruction to add description or meta data for a docker image.

0 0 votes
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x