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
950
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
6.9k
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
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
OTelCol_TailSampling_and_SpanMetrics
gumamon
1
200
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
1
110
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
180
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
890
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
420
10XにおけるData Contractの導入について: Data Contract事例共有会
10xinc
6
660
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
330
DynamoDB でスロットリングが発生したとき_大盛りver/when_throttling_occurs_in_dynamodb_long
emiki
1
430
FlutterアプリにおけるSLI/SLOを用いたユーザー体験の可視化と計測基盤構築
ostk0069
0
100
Platform Engineering for Software Developers and Architects
syntasso
1
520
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
480
Featured
See All Featured
How to Ace a Technical Interview
jacobian
276
23k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Site-Speed That Sticks
csswizardry
0
28
Done Done
chrislema
181
16k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
How GitHub (no longer) Works
holman
310
140k
Fireside Chat
paigeccino
34
3k
Adopting Sorbet at Scale
ufuk
73
9.1k
Unsuck your backbone
ammeep
668
57k
Rails Girls Zürich Keynote
gr2m
94
13k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
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͢Δ ͜ͱʹͯ͠ճආͨ͠
࠷ߴͷମݧ (͏ෆཁͰ͕͢)