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
940
Docker-Compose & BuildKit
orisano
September 05, 2019
Tweet
Share
More Decks by orisano
See All by orisano
OSS Performance Tuning Tips
orisano
8
5.5k
Container Build Talk
orisano
3
2.4k
dockerignore talk
orisano
2
6.9k
Better docker image+
orisano
6
5.8k
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
Gradle: The Build System That Loves To Hate You
aurimas
2
150
CyberAgent 生成AI Deep Dive with Amazon Web Services / genai-aws
cyberagentdevelopers
PRO
1
480
現地でMeet Upをやる場合の注意点〜反省点を添えて〜
shotashiratori
0
520
急成長中のWINTICKETにおける品質と開発スピードと向き合ったQA戦略と今後の展望 / winticket-autify
cyberagentdevelopers
PRO
1
160
プロダクトチームへのSystem Risk Records導入・運用事例の紹介/Introduction and Case Studies on Implementing and Operating System Risk Records for Product Teams
taddy_919
1
170
話題のGraphRAG、その可能性と課題を理解する
hide212131
4
1.5k
10分でわかるfreee エンジニア向け会社説明資料
freee
18
520k
一休.comレストランにおけるRustの活用
kymmt90
3
580
【技術書典17】OpenFOAM(自宅で極める流体解析)2次元円柱まわりの流れ
kamakiri1225
0
210
生成AIと知識グラフの相互利用に基づく文書解析
koujikozaki
1
140
小規模に始めるデータメッシュとデータガバナンスの実践
kimujun
3
590
ガバメントクラウド単独利用方式におけるIaC活用
techniczna
3
270
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
3
370
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Practical Orchestrator
shlominoach
186
10k
Learning to Love Humans: Emotional Interface Design
aarron
272
40k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
What's in a price? How to price your products and services
michaelherold
243
12k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
How to Ace a Technical Interview
jacobian
275
23k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Embracing the Ebb and Flow
colly
84
4.4k
Writing Fast Ruby
sferik
626
61k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
46
2.1k
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͢Δ ͜ͱʹͯ͠ճආͨ͠
࠷ߴͷମݧ (͏ෆཁͰ͕͢)