DevOps Classroom notes 08/Oct/2024

Dockerfile

  • Refer Here for official docs
  • Dockerfile contains set of instructions required to build the image
INSTRUCTION  args
  • examples
FROM nginx
FROM openjdk:17
RUN 
COPY . /app
  • Each Instruction has a purpose
  • Lets look at widely used instructions
    • FROM Refer Here for officials docs & FROM is used to choose the base image
    • LABEL: This is used to add the metadata
    • RUN: This instruction executes the commands written while building the image
    • EXPOSE: publishes the port information
    • ADD/COPY: They are used to copy the files into docker image
    • CMD: This will be executed as PID1 i.e. when we start the container this command executes and container will be in running state as long as the PID1 is running
  • For experiments done kindly refer classroom video

Shell form and Exec Form

  • Refer Here for official docs
  • Widely most of the Dockerfiles contains
    • RUN in shell FORM
    • CMD and Entrypoint in EXEC FORM

Docker Image

  • Docker Image should contain all the files necessary to run application
  • Every Docker Image has a unique image id and name and tag
  • Docker Image is collection of Readonly Layers
  • A Layer is created during image creation by any instruction which leads to changes in the disk contents (RUN, ADD, COPY)
  • Best Practice is to create few or less reusable layers
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

Turn on JavaScript to leave a comment.

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

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%