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
190
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
170
Using a framework or not?
pfwd
1
210
How To Put Your Docker Image On A Diet | PHP South West
pfwd
1
260
Other Decks in Technology
See All in Technology
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
580
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
110
隣接領域をBeyondするFinatextのエンジニア組織設計 / beyond-engineering-areas
stajima
1
270
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
750
Terraform Stacks入門 #HashiTalks
msato
0
350
Can We Measure Developer Productivity?
ewolff
1
150
強いチームと開発生産性
onk
PRO
34
11k
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
180
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
150
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
120
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
130
The Rise of LLMOps
asei
7
1.4k
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Code Reviewing Like a Champion
maltzj
520
39k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Raft: Consensus for Rubyists
vanstee
136
6.6k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Building Applications with DynamoDB
mza
90
6.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Facilitating Awesome Meetings
lara
50
6.1k
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