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 Network Firewall 概要
oracle4engineer
PRO
0
4.2k
マルチモーダル / AI Agent / LLMOps 3つの技術トレンドで理解するLLMの今後の展望
hirosatogamo
37
12k
Engineer Career Talk
lycorp_recruit_jp
0
190
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
プロダクト活用度で見えた真実 ホリゾンタルSaaSでの顧客解像度の高め方
tadaken3
0
200
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
3
640
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
230
Taming you application's environments
salaboy
0
200
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.5k
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
260
インフラとバックエンドとフロントエンドをくまなく調べて遅いアプリを早くした件
tubone24
1
430
Featured
See All Featured
Statistics for Hackers
jakevdp
796
220k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
A Modern Web Designer's Workflow
chriscoyier
693
190k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Typedesign – Prime Four
hannesfritz
40
2.4k
Docker and Python
trallard
40
3.1k
Become a Pro
speakerdeck
PRO
25
5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
A better future with KSS
kneath
238
17k
Code Reviewing Like a Champion
maltzj
520
39k
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͢Δ ͜ͱʹͯ͠ճආͨ͠
࠷ߴͷମݧ (͏ෆཁͰ͕͢)