DevOps Classroom notes 16/Sep/2026

Docker layers

  • every instruction in dockerfile (cmd, entrypoint, workdir, copy, add, user, from).
  • all layers will be read only

FROM ubuntu:latest

RUN apt update && apt-get install openjdk-17-jdk -y && apt-get install maven  git -y 

RUN git clone https://github.com/spring-projects/spring-petclinic.git

WORKDIR spring-petclinic

 "Layers": [
                "sha256:4a6e4a6c5956212bf74c556250eb0028096f13d74501e43af51a1dbed8d69749",
                "sha256:4f41b99e67b8aeaedacb31ca888054a4b877577371f0bbe01196e136d2793635",
                "sha256:d1a934b98182759aeaa02239e8f05208da4c3c2df0eb94a9af72989b21c14d32",
                "sha256:e5a3840f1f51b9c292b67e667a7327e56c7ce29c796b7fa22973c9d26e99dee9",
                "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
            ]
"Layers": [
                "sha256:4a6e4a6c5956212bf74c556250eb0028096f13d74501e43af51a1dbed8d69749",
                "sha256:4f41b99e67b8aeaedacb31ca888054a4b877577371f0bbe01196e136d2793635",
                "sha256:d1a934b98182759aeaa02239e8f05208da4c3c2df0eb94a9af72989b21c14d32",
                "sha256:4cd00040cb7c9469f573dbf938fc8077dc1582f476a310f500c7dcdfec85a649",
                "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
            ]
FROM ubuntu:latest

RUN apt update && apt-get install openjdk-17-jdk -y && apt-get install maven  git -y

RUN git clone https://github.com/spring-projects/spring-framework.git

WORKDIR spring-framework

keypoints

  1. immutable: once build a layer never change and new instruction will create new layer
  2. cached: reusefull layer for multiple images. save disk storage
  3. read-only : all layer in image will be readonly
  4. Ordered: layers will be applicable to Dockerfile order

Layer will be having wirte access when you run image as container

  • docker run
  • Docker run will have R/W access
FROM ubuntu:latest

RUN apt update 
RUN apt-get install openjdk-17-jdk -y 
RUN apt-get install maven -y
RUN apt-get install git -y  

RUN git clone https://github.com/spring-projects/spring-petclinic.git

WORKDIR spring-petclinic

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
Customized Social Media Icons from Acurax Digital Marketing Agency
Exit mobile version
%%footer%%