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
Docker-Compose & BuildKit
Search
orisano
September 05, 2019
Technology
4
960
Docker-Compose & BuildKit
orisano
September 05, 2019
Tweet
Share
More Decks by orisano
See All by orisano
OSS Performance Tuning Tips
orisano
8
5.6k
Container Build Talk
orisano
3
2.4k
dockerignore talk
orisano
2
7k
Better docker image+
orisano
6
5.9k
Socket.IO Introduction
orisano
0
3k
Profiling Go Application
orisano
11
7.6k
Multi-stage Builds Patterns & Practice
orisano
6
5k
better docker image
orisano
22
30k
the world of characters
orisano
8
1.3k
Other Decks in Technology
See All in Technology
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
32k
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
180
5分でわかるDuckDB
chanyou0311
10
3.3k
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
320
C++26 エラー性動作
faithandbrave
2
820
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
670
普通のエンジニアがLaravelコアチームメンバーになるまで
avosalmon
0
120
社外コミュニティで学び社内に活かす共に学ぶプロジェクトの実践/backlogworld2024
nishiuma
0
280
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
230
podman_update_2024-12
orimanabu
1
290
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
210
Server-Side Engineer of LINE Sukimani
lycorp_recruit_jp
0
340
Featured
See All Featured
Producing Creativity
orderedlist
PRO
342
39k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The Pragmatic Product Professional
lauravandoore
32
6.3k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Scaling GitHub
holman
459
140k
Being A Developer After 40
akosma
87
590k
Adopting Sorbet at Scale
ufuk
73
9.1k
Testing 201, or: Great Expectations
jmmastey
41
7.1k
Writing Fast Ruby
sferik
628
61k
Transcript
Docker Compose & BuildKit Docker Meetup Tokyo #32 #DockerTokyo @orisano
docker-compose ͍ͬͯΔਓ
ศརͰ͢ΑͶ
ෳͷίϯςφΠϝʔδΛ ؆୯ʹ͑Δ
ͳΜͳΒ ίϯςφҰͭͰ docker-compose͏
࣮ߦ࣌ͷύϥϝʔλΛ ϑΝΠϧʹهड़Ͱ͖Δ
up —buildͰ buildͱrun͕ಉ࣌ͰͰ͖Δ
࠷ߴ
ͱ͜ΖͰ
docker-compose build ͍ͬͯΔਓ͍·͔͢ʁ
͍ͳ͍Ͱ͢ΑͶ… (ҙ֎ͱ͍Δͷ͔)
docker-compose up —build ͬͪΌ͍·͢ΑͶ
Ͱ docker-composeͷbuild ॏ͘ͳ͍Ͱ͔͢?
docker build͕͍ͱ ΠϥΠϥ͠·ͤΜ͔?
BuildKit͍ͨ͘ͳ͍Ͱ͔͢?
docker-compose Ͱ BuildKit Λ͑ΔΑ͏ʹͨ͠
“͑ΔΑ͏ʹͨ͠” ͳͷͰ ͱͱ͑ͳ͔ͬͨ
ͳͥͳͷ͔
ͦͦ docker-composeͷbuild ԿΛ͍ͬͯΔͷ͔
docker-composeͷbuild γϯϓϧͰ yamlͷ༰͔ΒparameterΛ औΓग़ͯ͠build͢Δ
͜͜ͰҰ୴
docker build ͷΈ
None
None
None
ؾʹͳͬͨํ https://speakerdeck.com/orisano/container-build-talk
docker-composeࣗମ docker/cli͕ͳͯ͘ಈ͘
docker-compose docker-pyΛ͍ͬͯΔ
docker-py dockerdͷAPIΛୟ͘ python client
None
docker-compose image໊Λ࡞Δ͚ͩͷػߏʹ ͍ۙ
imageʹ {project}_{service} Έ͍ͨͳ໊લΛ͚ͭͯ APIΛݺͿ
ͳͥ BuildKit͕͑ͳ͍ͷ͔
BuildKit ίϯςΩετΛࠩసૹ͢Δ
ࠩసૹ(fssync) grpc
docker-pyʹͦΕ͕ ࣮͞Ε͍ͯͳ͍
pythonͰ࣮͢Δͷ ͕͔͔࣌ؒΓͦ͏…
Issue্͕͕ͬͯࢭ·͍ͬͯͨ
࠳
ͱ͍͑ docker-compose build ͕͍ͷࠔΔ
͘͢͝ࠔΔ
@AkihiroSuda͞Μʹ ͱΓ͋͑ͣ૬ஊͯ͠ΈΔ
@AkihiroSuda͞Μ͔Β ʮexec͢Δ͕ͭྑͦ͞͏ʯ ͱݴΘΕΔ
࣮ͯ͠PR (—exec) docker/compose#6584 (2019/3/15)
4/4 thaJeztah͔Βίϝϯτ ΞϧϑΝϕοτॱʹ͠ͳ͍ͷʁ ͱͱͦ͏͡Όͳ͍
4/5 ulyssessouza͔Βίϝϯτ ΞϧϑΝϕοτॱʹ͠ͳ͍ͷʁ ͱͱͦ͏͡Όͳ͍
4/24 ulyssessouza͔Βίϝϯτ —exec ͬͯඍົ͡Όͳ͍? ͳΜ໊͔͍͍લͳ͍?
5/16 ulyssessouza͔Βίϝϯτ —cli͕ྑͦ͞͏
6/6 ulyssessouza ٳΈʹೖΔ
6/13 thaJeztah͔Βίϝϯτ ̎ͭ͘Β͍ߟ͑Δ͜ͱ͕ ͋Γͦ͏
6/14 thaJeztah͔Βίϝϯτ ͜͏͍͏ਐΊํͲ͏?
7/19 thaJeztah͔Βίϝϯτ ulyssessouzaͱٞͨ͠
8/13 ulyssessouza͔Βίϝϯτ —cliΛΊͨ COMPOSE_NATIVE_BUILDER=1
8/20 thaJeztah͔Βίϝϯτ docker-compose up —build Ͱಉ͡ಈ͖Λͯ͠΄͍͠
8/22 ରԠ
8/22 PR close(!!!!!!!!)
8/22 docker/compose#6865 ulyssessouza ʹΑΓ PR͕৽نʹ࡞ΒΕΔ
8/22~24 ಈ͖ͳ͠
8/25~8/29 @orisano ՝Λશ෦ղܾ
8/30 ແࣄϚʔδ
࣍ͷrc͔Β COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 Ͱ͑ΔΑ͏ʹͳΓ·͢
ޤ͏͝ظ
ֶͼ
ϑϥάΛՃ͢Δ͜ͱ ϝϯςφϯείετ͕ ൃੜ͢Δ͜ͱΛҙࣝ͢Δ
ڥม͔Β࢝ΊͯΈΔ
͜΅Ε
docker build ͷ݁Ռ streamͰྲྀΕͯ͘Δͷ͕ͩ
docker-composeͦͷதͷ Successfully Built ͱ͍͏จࣈྻ͔Β ݁ՌΠϝʔδͷid Λऔಘ͍ͯ͠Δ
ϨϏϡʔ࣌ʹ ͳʹ͜ΕͱݴΘΕ͕ͨ ͳʹ͜Εͱࢥͬͨ
͜΅Ε2
࣮͜Εͱಉ࣌ظʹ docker-composeͷ cache-fromͰࠔΔͱ͜Ζ͕ ͋ͬͨͷͰPR
ͦΕ͙͢ʹϚʔδ͞Εͨ
cache_fromʹ ڥมΛ͔ͨͬͨ͠
͢ͱಈ͍ͨ CI͕շదʹͳͬͨ
ϩʔΧϧͰ ຖճϑϧϏϧυ͕ ͠ΔΑ͏ʹͳͬͨ
ࠈ
docker buildͷ༷Ͱ —cache-fromʹͳʹ͔͢ͱ ϩʔΧϧͷΩϟογϡ͕ ޮ͔ͳ͘ͳΔ
ৄ͘͠ ͪΌΜͱཧղ͢Δdocker build cache https://orisano.hatenablog.com/entry/2018/12/17/025931
ࢦఆ͞ΕͨΠϝʔδ͕ ଘࡏ͠ͳ͍߹ແࢹ͢Δ
ڥมʹͳʹ͔༩͑ͳ͍ͱ cache-fromʹۭจࣈྻ͕…
ࠓͰ docker-composeଆͰ ۭͷΠϝʔδແࢹ͢Δ Α͏ʹͳΓ·ͨ͠
ΊͰͨ͠
͜΅Ε3
ࠓճͷPR Ϛʔδ·Ͱ5ϲ݄͔͔ͬͨ
5ϲ݄ؒ͑Δͷ ແཧͩͬͨͷͰखݩͰ ࣗͷforkΛ͍ͬͯͨ (ͬͯ͘ΕΔϑΝϯͷํ͕͍ͨ)
ͦΕΛϓϩδΣΫτͷ makeʹՃ͢ΔΘ͚ʹ ͍͔ͳ͔ͬͨ
Ͳ͏ʹ͔Ͱ͖ͳ͍ͩΖ͏͔
ࢥ͍ग़͢
docker-compose image໊Λ࡞Δ͚ͩͷػߏʹ ͍ۙ
imageʹ {project}_{service} Έ͍ͨͳ໊લΛ͚ͭͯ APIΛݺͿ
ͭ·Γ
docker-composeͷ ͏໊લͰdocker build͢Δ ͜ͱʹͯ͠ճආͨ͠
࠷ߴͷମݧ (͏ෆཁͰ͕͢)