2019/12/25

docker image build Dockerfile

docker-compse.yml 内で定義  go のimage
image:xxx/xxx ->直接pull して使う

imageを調査する
 履歴調査 docker image history image_name
 構成調査 docker image inspect image_name

build a image from dockerfile
 docker build --help 

Dockerfile 原則
 1. container from Dockerfile  is ephemeral
 2. one container one process (easy to scale  horizontally)
 3. minimize container layer ( use one-line command. one command one layer)

   RUN apt-get update && apt-get install -y \
  bzr \
  cvs \
  git \
  mercurial \
  subversion

 4. docker build dockerfile_path (---no-cache=true)
     run commands in dockerfile to create layer.
     but first to search cache (sha256のchecksumがあり)あれば、使う。