For example, I may have the following Dockfile. When I run docker build, for each RUN, there is a spearate hash (e.g., 1d9c17228a9e), and it runs very fast it had run already. I guess each hash is associated an actual file at the backend. Is it so?
If there are separate files, how they can be loaded in a single virtual machine quickly? Is there any kind of assemble upon starting a new virtual machine (docker container)? Thanks.
$ docker build -t ubtsrv .
Sending build context to Docker daemon  12.29kB
Step 1/22 : FROM ubuntu
 ---> 1d9c17228a9e
Step 2/22 : RUN rm -rf /etc/dpkg/dpkg.cfg.d/excludes
 ---> Using cache
 ---> eb02f606ba08
Step 3/22 : RUN apt-get -y update &&     dpkg -l | grep ^ii | cut -d' ' -f3 | xargs apt-get install -y --reinstall
 ---> Using cache
 ---> 7062816b0023
Step 4/22 : RUN apt-get -y install apt-utils
 ---> Using cache
 ---> b89d4cdb791c
Step 5/22 : RUN apt -y update && apt -y upgrade
 ---> Using cache
 ---> 8100af2b7f2e
Step 6/22 : RUN apt-get -y install vim
 ---> Using cache
 ---> 57c142f99935
Step 7/22 : RUN apt-get -y install man
 ---> Using cache
 ---> ddb73e4bbddc
Step 8/22 : RUN apt-get -y install gawk
 ---> Using cache
 ---> 7422b4371c16
Step 9/22 : RUN apt-get -y install mawk
 ---> Using cache
 ---> 53a01709a342
Step 10/22 : RUN apt-get -y install build-essential
 ---> Using cache
 ---> af94947e6922
Step 11/22 : RUN apt-get -y install command-not-found
 ---> Using cache
 ---> 20094698a583
Step 12/22 : RUN apt-get -y install clang
 ---> Using cache
 ---> e63570058a57
Step 13/22 : RUN apt-get -y install htop
 ---> Using cache
 ---> b09fec30dc23
Step 14/22 : RUN apt-get -y install wget
 ---> Using cache
 ---> d2794d29f9ee
Step 15/22 : RUN apt-get -y install curl
 ---> Using cache
 ---> 2b122c49f3ca
Step 16/22 : RUN wget -q ftp://ftp.gnu.org/gnu/bash/bash-4.4.18.tar.gz &&   tar xzvf bash-4.4.18.tar.gz &&   cd bash-4.4.18 &&   ./configure &&   make -j &&   make install &&   cd .. &&   rm -rf bash-4.4.18.tar.gz bash-4.4.18
 ---> Using cache
 ---> c4bf046aff2a
Step 17/22 : RUN apt-get install -y git
 ---> Using cache
 ---> 40ebefa7acda
Step 18/22 : RUN apt-get install -y ack
 ---> Using cache
 ---> 05cefb3f0496
Step 19/22 : RUN apt-get install -y info
 ---> Using cache
 ---> 3361e4e4e06f
Step 20/22 : RUN apt-get install -y llvm
 ---> Using cache
 ---> 50b7c75fc2f5
Step 21/22 : RUN apt-get install -y graphviz
 ---> Using cache
 ---> 80f89477930c
Step 22/22 : RUN apt-get install -y cmake
 ---> Using cache
 ---> c8320b1b2523
Successfully built c8320b1b2523
Successfully tagged ubtsrv:latest
$ cat Dockerfile 
FROM ubuntu
RUN rm -rf /etc/dpkg/dpkg.cfg.d/excludes
RUN apt-get -y update && \
    dpkg -l | grep ^ii | cut -d' ' -f3 | xargs apt-get install -y --reinstall
RUN apt-get -y install apt-utils
RUN apt -y update && apt -y upgrade
RUN apt-get -y install vim
RUN apt-get -y install man
RUN apt-get -y install gawk
RUN apt-get -y install mawk
RUN apt-get -y install build-essential
RUN apt-get -y install command-not-found
RUN apt-get -y install clang
RUN apt-get -y install htop
RUN apt-get -y install wget
RUN apt-get -y install curl
RUN wget -q ftp://ftp.gnu.org/gnu/bash/bash-4.4.18.tar.gz && \
  tar xzvf bash-4.4.18.tar.gz && \
  cd bash-4.4.18 && \
  ./configure && \
  make -j && \
  make install && \
  cd .. && \
  rm -rf bash-4.4.18.tar.gz bash-4.4.18
RUN apt-get install -y git
RUN apt-get install -y ack
RUN apt-get install -y info
RUN apt-get install -y llvm
RUN apt-get install -y graphviz
RUN apt-get install -y cmake
 
    