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
AWS re:Invent 2024 ふりかえり勉強会
yhana
0
420
普通のエンジニアがLaravelコアチームメンバーになるまで
avosalmon
0
120
DevFest 2024 Incheon / Songdo - Compose UI 조합 심화
wisemuji
0
140
ゼロから創る横断SREチーム 挑戦と進化の軌跡
rvirus0817
3
280
エンジニアカフェ忘年会2024「今年やらかしてしまったこと!」
keropiyo
0
100
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
160
サイボウズフロントエンドエキスパートチームについて / FrontendExpert Team
cybozuinsideout
PRO
5
38k
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
18
5.4k
Opcodeを読んでいたら何故かphp-srcを読んでいた話
murashotaro
0
320
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
180
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
110
能動的ドメイン名ライフサイクル管理のすゝめ / Practice on Active Domain Name Lifecycle Management
nttcom
0
200
Featured
See All Featured
Visualization
eitanlees
146
15k
Gamification - CAS2011
davidbonilla
80
5.1k
A designer walks into a library…
pauljervisheath
205
24k
Side Projects
sachag
452
42k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
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͢Δ ͜ͱʹͯ͠ճආͨ͠
࠷ߴͷମݧ (͏ෆཁͰ͕͢)