DELAPARRA
Index
Color
NL
Category: Docker

layer

Explained by Updated

What is layer?

layer: Each Dockerfile instruction creates a stacked, cached filesystem layer. Layers are shared between images, which is why pulls and builds are fast. A Docker image is built from layers. Each instruction in a Dockerfile, such as RUN, COPY or ADD, creates a new read-only layer on top of the previous one.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about layer

How is layer used in practice?

Layers are cached and shared. If nothing changed in a step, Docker reuses the cached layer, which makes rebuilds fast. Images built on the same base share those base layers on disk and when pulling.

What should you keep in mind with layer?

Order your Dockerfile to make the most of this. Put steps that rarely change, like installing system packages and dependencies, before steps that change often, like copying your source code. Clean up in the same RUN step that created the files, because deleting files in a later layer does not make the image smaller. docker history shows each layer and its size.

What does an example of layer look like?

docker history myapp:1.0

At a glance

CategoryDocker
Explained by
Updated

More Docker terms

All terms starting with L

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.