Understanding Docker Multi-Stage Builds | How to reduce the size of your Docker Image

preview_player
Показать описание
Agenda:

How to reduce the size of Docker Image?

How to create an efficient Docker Image?

Understanding Docker Multi-Stage Builds

*********************************************************************

What is a dockerfile?

Docker can build images automatically by reading the instructions from a Dockerfile.

A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.

*********************************************************************

Dockerfile Directives

FROM Starts a new build stage and sets the base image.

ENV: Set environment variables. These can be referenced in the Dockerfile itself and are visible to the container at runtime.

COPY adds files from your Docker client’s current directory.

RUN Creates a new layer on top of the previous layer by running a command inside that new layer.

CMD specifies what command to run within the container.

WORKDIR Sets the current working directory inside the container.

ADD Similar to COPY, but can also pull files using a URL and extract an achieve into loose files in the image.

*********************************************************************
Use multi-stage builds

Multi-stage builds are a new feature requiring Docker 17.05 or higher on the daemon and client.

Multistage builds are useful to anyone who has struggled to optimize Dockerfiles while keeping them easy to read and maintain.

*********************************************************************

As a prerequisite, you need to have docker installed.

Docker Introduction:

Docker installation from Scratch:

What is Dockerfile | Understanding Dockerfile Directives | How to Build an Image using Dockerfile :
Рекомендации по теме
Комментарии
Автор

Thanks, Bengaluru! Your explanation about building and running apps using a single file with more than one docker image was fantastic

RenatoMatos
Автор

Thanks Akash, you have haven't made this complex, very easy to understand

nafasm
Автор

Simple and informative video.. Cleared the concept.
Thanks!

sunnygangwal
Автор

Thanks for this class. Which file we can remove for nodejs aplication

winerbishnu
Автор

thanks for good explanation, but where are the next steps, docker container, docker engine etc, how we reach docker swarm

salishsath
Автор

One doubt doea this mean master node copy will always high image space and workwr will lesa image space . will this works . one doubt many say docker swarm vs kubernates . kubernates is how efficient in managing .

awstej
Автор

Hello Akash, You video is very lucid, informative and really most simple but very cut to the core.
I need some of your help on something which i am working on, could you please reply to my email id so that we can communicate further? Thank you,

gagabuguy