Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How To Put Your Docker Image On A Diet

Peter Fisher
September 26, 2019

How To Put Your Docker Image On A Diet

Talk given at PHP South Wales

Peter Fisher

September 26, 2019
Tweet

More Decks by Peter Fisher

Other Decks in Technology

Transcript

  1. SELF TAUGHT DOCKER DEV IF YOU SEE AN IMPROVEMENT PLEASE

    LET ME KNOW WE ARE ALL LEARNING ALL THE TIME @PFWD @HowToCodeWell
  2. PHP 7.4 RC 1 SYMFONY 4.3.6 APACHE 2 WEB SERVER

    ORIGINAL 1.09GB AFTER DIET 171 MB @PFWD @HowToCodeWell
  3. WHAT IS THE DIFFERENCE BETWEEN A DOCKER CONTAINER AND A

    VIRTUAL MACHINE? @PFWD @HowToCodeWell
  4. WHAT IS A DOCKER IMAGE ANYWAY? ANSWER: A FILE MADE

    FROM MANY LAYERS WHICH
 CREATES A CONTAINER @PFWD @HowToCodeWell
  5. WHAT IS A DOCKER FILE? ANSWER: A SERIES OF INSTRUCTIONS

    THAT
 BUILD A DOCKER IMAGE @PFWD @HowToCodeWell
  6. VERSION 1.8.0 424MB MULTI STAGE DOCKER BUILD 5 STAGES! 2

    TARGETS NO DEV PACKAGES IN STAGING STAGING HAS AUTOLOADER DUMPED @PFWD @HowToCodeWell
  7. VERSION 1.9.0 88.5MB USE PHP FPM PHP AND APACHE ARE

    IN 2 CONTAINERS @PFWD @HowToCodeWell
  8. VERSION 1.9.0 PHP 88.5MB APACHE 171MB PROXY PHP REQUESTS TO

    THE PHP CONTAINER @PFWD @HowToCodeWell
  9. VERSION 1.9.0 PHP 88.5MB APACHE 171MB 1) USE THE PHP

    SERVICE NAME 2) NETWORK APACHE AND PHP 3) SHARE THE SITE VOLUME @PFWD @HowToCodeWell
  10. VERSION 1.9.0 PHP 88.5MB APACHE 171MB 1) USE THE PHP

    SERVICE NAME 2) NETWORK APACHE AND PHP 3) SHARE THE SITE VOLUME @PFWD @HowToCodeWell
  11. Version Size 1.0.0 1.0.9 GB 1.1.0 1.0.6 GB Reduced build

    steps 1.2.0 708 MB Removed other responsibilities 1.3.0 449 MB Removed unknown PHP packages (php7.4-*) 1.4.0 601 MB Changed the base image 1.5.0 485 MB Removed package and composer cache 1.6.0 478 MB Didn’t install recommend packages 1.7.0 444 MB Used Multi Stage Docker Images 1.8.0 424 MB Removed dev composer packages 1.9.0 171 MB - Apache 88 MB - PHP Separated Apache and PHP @PFWD @HowToCodeWell
  12. Peter Fisher BSC MBSC THANK YOU QUESTIONS? LET ME KNOW

    WHAT YOU THINK! @PFWD @HowToCodeWell