Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
How To Put Your Docker Image On A Diet
Search
Peter Fisher
September 26, 2019
Technology
0
200
How To Put Your Docker Image On A Diet
Talk given at PHP South Wales
Peter Fisher
September 26, 2019
Tweet
Share
More Decks by Peter Fisher
See All by Peter Fisher
Software Complexities
pfwd
0
180
Using a framework or not?
pfwd
1
220
How To Put Your Docker Image On A Diet | PHP South West
pfwd
1
260
Other Decks in Technology
See All in Technology
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
2
330
PHP ユーザのための OpenTelemetry 入門 / phpcon2024-opentelemetry
shin1x1
1
190
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
280
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
450
社外コミュニティで学び社内に活かす共に学ぶプロジェクトの実践/backlogworld2024
nishiuma
0
260
LINEスキマニにおけるフロントエンド開発
lycorptech_jp
PRO
0
330
非機能品質を作り込むための実践アーキテクチャ
knih
3
1.1k
オプトインカメラ:UWB測位を応用したオプトイン型のカメラ計測
matthewlujp
0
170
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
210
Storage Browser for Amazon S3
miu_crescent
1
140
Opcodeを読んでいたら何故かphp-srcを読んでいた話
murashotaro
0
180
継続的にアウトカムを生み出し ビジネスにつなげる、 戦略と運営に対するタイミーのQUEST(探求)
zigorou
0
530
Featured
See All Featured
Music & Morning Musume
bryan
46
6.2k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
BBQ
matthewcrist
85
9.4k
Automating Front-end Workflow
addyosmani
1366
200k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Designing Experiences People Love
moore
138
23k
Building an army of robots
kneath
302
44k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Transcript
PUT YOUR DOCKER IMAGE ON A DIET @PFWD @HowToCodeWell
SELF TAUGHT DOCKER DEV IF YOU SEE AN IMPROVEMENT PLEASE
LET ME KNOW WE ARE ALL LEARNING ALL THE TIME @PFWD @HowToCodeWell
PHP 7.4 RC 1 SYMFONY 4.3.6 APACHE 2 WEB SERVER
ORIGINAL 1.09GB AFTER DIET 171 MB @PFWD @HowToCodeWell
@PFWD @HowToCodeWell
WHY | WHAT | HOW @PFWD @HowToCodeWell
PETER FISHER BSC MBSC HOW TO CODE WELL
@PFWD @HowToCodeWell
WHY | WHAT | HOW @PFWD @HowToCodeWell
SPEED | SECURITY | SANITY | SCALABILITY @PFWD @HowToCodeWell
SPEED THE LIGHTER THE IMAGE THE FASTER THE DEVELOPMENT @PFWD
@HowToCodeWell
SPEED THE LIGHTER THE IMAGE THE FASTER THE DEPLOYMENT @PFWD
@HowToCodeWell
SPEED THE LIGHTER THE IMAGE THE FASTER THE DISTRIBUTION @PFWD
@HowToCodeWell
SECURITY THE SMALLER THE IMAGE THE SMALLER THE ATTACK SURFACE
@PFWD @HowToCodeWell
SECURITY DO NOT BAKE SECURITY CREDS INTO YOUR IMAGES @PFWD
@HowToCodeWell
SANITY THE SMALLER THE IMAGE THE LESS YOU HAVE TO
MAINTAIN @PFWD @HowToCodeWell
SANITY THE SMALLER THE IMAGE THE MORE CONTROL YOU HAVE
@PFWD @HowToCodeWell
SANITY THE SMALLER THE IMAGE THE QUICKER YOU CAN SPOT
PROBLEMS @PFWD @HowToCodeWell
SANITY THE SMALLER THE IMAGE THE LESS RESPONSIBILITY IT HAS
@PFWD @HowToCodeWell
SCALEABILITY THE SMALLER THE IMAGE THE QUICKER IT CAN INSTALL
@PFWD @HowToCodeWell
SCALEABILITY THE SMALLER THE IMAGE THE QUICKER TO EXPAND @PFWD
@HowToCodeWell
SCALEABILITY THE SMALLER THE IMAGE THE QUICKER TO CONTRACT @PFWD
@HowToCodeWell
SCALEABILITY THE SMALLER THE IMAGE THE QUICKER TO REUSE @PFWD
@HowToCodeWell
WHY | WHAT | HOW @PFWD @HowToCodeWell
WHAT IS THE DIFFERENCE BETWEEN A DOCKER CONTAINER AND A
VIRTUAL MACHINE? @PFWD @HowToCodeWell
@PFWD @HowToCodeWell
VIRTUALIZATION != CONTAINERIZATION @PFWD @HowToCodeWell
VIRTUALIZATION = IS A HOUSE @PFWD @HowToCodeWell
CONTAINERIZATION = IS A ROOM @PFWD @HowToCodeWell
DIFFERENT LEVELS OF ABSTRACTION @PFWD @HowToCodeWell
BOTH SOLVE DIFFERENT PROBLEMS @PFWD @HowToCodeWell
BOTH SHOULD BE USED DIFFERENTLY @PFWD @HowToCodeWell
VIRTUALIZATION CUSTOM ENVIRONMENT ALLOCATED RESOURCES ECOSYSTEM @PFWD @HowToCodeWell
CONTAINIZATION SINGLE PROCESS SINGLE RESPONSIBILITY SINGLE PURPOSE @PFWD @HowToCodeWell
WHAT IS A DOCKER IMAGE ANYWAY? @PFWD @HowToCodeWell
WHAT IS A DOCKER IMAGE ANYWAY? ANSWER: A FILE MADE
FROM MANY LAYERS WHICH CREATES A CONTAINER @PFWD @HowToCodeWell
CONTAINERS ARE BUILT FROM IMAGES @PFWD @HowToCodeWell
WHAT IS A DOCKER IMAGE MADE FROM? @PFWD @HowToCodeWell
WHAT IS A DOCKER IMAGE ANYWAY? ANSWER: MANY DIFFERENT IMAGES
@PFWD @HowToCodeWell
WHAT IS A DOCKER FILE? @PFWD @HowToCodeWell
WHAT IS A DOCKER FILE? ANSWER: A SERIES OF INSTRUCTIONS
THAT BUILD A DOCKER IMAGE @PFWD @HowToCodeWell
WHY | WHAT | HOW @PFWD @HowToCodeWell
VERSION 1.0.0 1.09 GB @PFWD @HowToCodeWell
VERSION 1.0.0 1.09 GB @PFWD @HowToCodeWell
26 BUILD STEPS 18 RUN INSTRUCTIONS VERSION 1.0.0 1.09 GB
@PFWD @HowToCodeWell
10 BUILD STEPS VERSION 1.1.0 1.06 GB @PFWD @HowToCodeWell
MULTIPLE CONTAINER RESPONSIBILITIES VERSION 1.1.0 1.06 GB @PFWD @HowToCodeWell
REMOVED MULTIPLE CONTAINER REPSONSIBILTES MYSQL-SERVER MYSQL-CLIENT RABBITMQ-SERVER VERSION 1.2.0 708MB
@PFWD @HowToCodeWell
DO NOT VERSION 1.2.0 708MB @PFWD @HowToCodeWell
REMOVED PHP-7.4-* VERSION 1.3.0 449MB @PFWD @HowToCodeWell
WRONG BASE IMAGE VERSION 1.3.0 449MB @PFWD @HowToCodeWell
VERSION 1.4.0 601MB USE PHP APACHE BASE IMAGE @PFWD @HowToCodeWell
VERSION 1.5.0 485MB @PFWD @HowToCodeWell
VERSION 1.6.0 478MB DON’T INSTALL RECOMENDED PACKAGES —no-install-recommends @PFWD @HowToCodeWell
VERSION 1.7.0 444MB MULTI STAGE DOCKER BUILD 3 STAGES! @PFWD
@HowToCodeWell
DEV PACKAGES SHOULD BE FOR DEV NOT FOR PROD! @PFWD
@HowToCodeWell
VERSION 1.8.0 424MB MULTI STAGE DOCKER BUILD 5 STAGES! 2
TARGETS NO DEV PACKAGES IN STAGING STAGING HAS AUTOLOADER DUMPED @PFWD @HowToCodeWell
VERSION 1.9.0 171MB ALPINE IMAGES DECOUPLING PHP FROM APACHE @PFWD
@HowToCodeWell
VERSION 1.9.0 88.5MB USE PHP FPM PHP AND APACHE ARE
IN 2 CONTAINERS @PFWD @HowToCodeWell
VERSION 1.9.0 PHP 88.5MB APACHE 171MB ER… HOW? @PFWD @HowToCodeWell
VERSION 1.9.0 PHP 88.5MB APACHE 171MB PROXY PHP REQUESTS TO
THE PHP CONTAINER @PFWD @HowToCodeWell
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
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
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
Peter Fisher BSC MBSC GITHUB https://github.com/pfwd/how-to-put- your-docker-image-on-a-diet Version 1.0.0 $
docker-compose up -d --build Grab a ☕ @PFWD @HowToCodeWell
Peter Fisher BSC MBSC THANK YOU QUESTIONS? LET ME KNOW
WHAT YOU THINK! @PFWD @HowToCodeWell