Last updated: Sep 16, 2019
IMAGE GALLERY (2)
- in dockers well very much like regular unix base mounting works.
Not practical to remove and recreate dockers on every code change
Docker already caches files in layers with hash
When you run an image and generate a container, you add a new writable layer (the “container layer”) on top of the underlying layers.
Only the instructions
COPYinstructions, the contents of the file(s) in the image are examined and a checksum is calculated for each file.
Use alpine as base image
VOLUMEinstruction should be used to expose any database storage area, configuration storage, or files/folders created by your docker container. You are strongly encouraged to use VOLUME for any mutable and/or user-serviceable parts of your image.
VOLUMEinstruction creates a mount point with the specified name and marks it as holding externally mounted volumes from native host or other containers.
- The host directory is declared at container run-time: The host directory (the mountpoint) is, by its nature, host-dependent. This is to preserve image portability, since a given host directory can’t be guaranteed to be available on all hosts. For this reason, you can’t mount a host directory from within the Dockerfile. The VOLUME instruction does not support specifying a host-dir parameter. You must specify the mountpoint when you create or run the container.
Where are docker images and layers stored on system ?
docker info /var/snap/docker
DIfference between ADD and COPY
ADD instruction copies new files, directories or remote file URLs from
COPY instruction copies new files or directories from