Reduce Layers

Each RUNCOPY, and ADD instruction adds a new layer to your image. Combining commands helps reduce the number of layers and the overall image size.

 

Inefficient:

RUN apt-get update
RUN apt-get install -y python
RUN apt-get install -y pip

 

Efficient:

RUN apt-get update && apt-get install -y \
    python \
    pip \
 && rm -rf /var/lib/apt/lists/*
Discussion
Thanks for sharing

1

Thank you for submitting this lab Shubham! Can you please share some links to useful resources where we can learn further?

1

Sure you can visit my medium were i put stories of new learning activities medium.com/@shubhamprajapati032

12

2