Posts

Showing posts with the label Multi-stage docker builds

Multi-stage docker builds

Image
  Multi-stage builds are a new feature requiring Docker ≥ 17.05 Multi-Stage build — optimized Dockerfile Why we need multi-stage build? One of the most challenging things about building images is keeping the image size down. For that we have to be careful while moving from one environment to another environment and we needed to keep tracks of artifacts, traditionally these can be achieved using shell scripts. (shell script at the rescue 😄 ). Apart from that, Maintaining two or more  dockerfile  for application is not ideal. Multi-stage build simplifies this situation. What is multi-stage build? 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. With multi-stage builds, you use multiple  FROM statements in your Dockerfile. Each  FROM instruction can use a different base, and each of them begin...