SlideShare a Scribd company logo
Docker
@tianweidut
2016.7.9
•
• DAE-Docker
•
Agenda
Docker
• DAE App
• App docker image
• DAE Python2.7, Python3, Golang
• online/qaci/sandbox/prelease/dev
• container
• Docker
• 2014 Q4: DAE Docker App
• 2015 Q1: App
• 2015 Q2: App Docker
• 2015 Q4: QACI/Prelease Docker
• 2016.06 - : Mesos + Marathon
(1)
• (400+ APP)
• web, service(pidl/thrift)
• DAE App cron, daemon, mq worker, remoteshell, app-admin
• QACI container docker image
• Prelease/Sandbox container docker image
• Docker pidlproxy, dpark, scribe-sink, syslog-ng, thrift-router, dnasmasq ...
(2)
•
• 100 200-400 docker image build
• container 370
• 400+
• 7500 +
• Prelease/Sandbox 200+
Douban App Engine For Docker
• container web service container
container
• container
• Image DAE
• Dev QACI Prelease Sandbox Online
DAE
• PaaS Python Golang 400+ App
• Web, PIDL Service, Thrift Service, Cron, Daemon, MQ, Runscript, Admin, Dpark, QACI, Prelease, Sandbox...
App
MySQL, Beansdb, Memcahce, MQ, MFS, CDN, Redis...
Proj
A
Proj
B
Proj
C
$ dae create
$ dae serve
$ dae test
$ dae deploy
App Auto Scale Load Balancer
Node Balance Elastic Pool
Prelease Sandbox Profile
DAE-Docker
Cron
MQ Worker
DaemonDaemonDaemon
DaemonMQ Worker
M
S
S zookeeper
Mesos Marathon+
MQ: Beanstalkd
New!
Gunicorn:
web._admin
websocket- runscript
- remoteshell
- dbshell
online
offline
http(s)
LVS
Nginx(lb)
Nginx
Gateway
douban
service
thrift
dae_thrift_
router
pidl
pidlproxy-
client
pidlproxy-
server
Router
Layer
unix domain socket
Node
Gate
Docker Container
Gunicorn- sync/async
- multi-instances
- master-worker
puppet:conf
mfs:permdir
volume
monitor/sa
agent
bridge/host
App
Node
DAE API (python/golang)
Auto Scale Distributed Trace Orchestration
waylifebeansdb/mysql/mc/mq/redis/graphite...
Bridge/Deploy Logs
Resource
Layer
dev
Vagrant
Container
DAE-SDK
Docker Compose
Container
App-Test
Jenkins
mysql
redis mc
scribe beansdb
Prelease
Sandbox
Golang
Gevent daes
DAE CI/CD
Github/Code
pull request
merged
review
test + pylint
prelease/sandbox
Make Archive Image Build Image Push
App Node1
App Node2
App NodeN
docker pull
Build Static
Jenkins:QACI
app.yaml chk
hook trigger
deploy
Auto Stage0 Stage Deploy Deploy
Rolling Update cfg update container restart selftest
Image Cached
Rollback
No
Yes
update conf irc/slack/email notify end
Regi
stry
Docker
1. : CentOS 6.5 vs Gentoo
• Centos 6.5 (2014.9)
• Docker ( Gentoo)
• Docker 1.2 Ubuntu/Centos
• CentOS6.5 Gentoo
• CentOS 6.5, Linux 2.6 -> Docker Daemon crash, Kernal Panic
• DAE / -> Gentoo binpkg CentOS RPM
• CentOS 2.6 Python 2.6 -> Python2.7 hack link
• Gentoo
• Gentoo Linux kernel 3.18.10(overlayfs merged)
2. Docker (1)
• Docker 1.2.0 / 1.3.2 : ->
• Docker 1.4.1: production ready
• zombie container (container 1 docker daemon container
docker run container name DAE container
)
• zombie container -> kill docker run process -> rename linkgraphdb ->
cleanup container files
2. Docker (2)
• Docker 1.5.0 DAE
• : push/pull Docker Registry V1
• image pre-build pre-pull (
)
• Docker 1.7.0: Docker
• : docker daemon docker daemon 7-8G container
• + docker daemon
2. Docker (3)
• Docker 1.8.1 6
• 1 : container /etc/hosts net=host container /etc/hosts
/etc/hosts container
• container /etc/hosts container hosts /var/
lib/container/${cid}/hosts `mount --bind` container namespace
net=host :
• volume /var/run/nscd lookup cache
• /var/lib/docker/${cid}/hosts inode
container
2. Docker (4)
• Docker 1.8.1 6
• 2 : volume-from data container data container volume
container app
• data container ready
• 3: docker registry v2 push image buffering disk,
image partent image id
• Docker 1.10.1
• : `Removal In Progress` container container name
• docker rename
• Docker 1.10.3 + docker registry v2 (2016.2 )
push/pull
3. Docker Registry v2
• distribution: docker >1.10 push/pull
•
• docker.douban : build push
• dev.docker.douban :
• distribution api, DAE app
Image
• nginx upstream round robin push
image `digest invalid: provided digest did not
match uploaded content` mfs
layer size
• nginx ip_hash
• distribution sentry
load balancer
distribution distribution distribution
mossefs: Imageredis:cache
4. Docker (1): dm vs overlay
• DeviceMapper
• 2014.09 ~ 2015.06
•
• build image 400+ App 100 build 200-400
build
•
• 1. docker daemon : ` --storage-opt dm.blkdiscard=false --storage-opt
dm.mountopt=nodiscard` --> kernel crash rm image pool
• 2. /var/lib/docker/devicemapper/data `direct-lvm` -> image
build 180s -> 120s
4. Docker (2): dm vs overlay
• ref: http://developerblog.redhat.com/2014/09/30/overview-storage-scalability-docker/
4. Docker (3): dm vs overlay
• Overlay
• 2015.06 - overlay2
•
• 1. AUFS Linux upstream AUFS
• 2. Overlay AUFS Linux 3.18 COW
docker image
•
• /var/lib/docker/overlay lvm Ext4
• build 180s -> 120s -> 100s
4. Docker (4): dm vs overlay
• Overlay
• inode ; build image , `too many links` --> docker 1.12
+ kernel 4.0 + overlay2
•
• 1. base image hard link kernal links
• 2. linux ext4: `#define EXT4_LINK_MAX 65000`
• docker overlay
overlay container
- low-id: image id
- uppper: container
- work: overlay
- merged: container , mount-bind
image
overlay image
- image
- Linux 7 copy
regular file hard link.
5. DAE-Docker Image (1)
5. DAE-Docker Image (2)
• DAE-Python App
• sys-req.txt: gentoo binpkg
• pip-req.txt : python pip requirements
sys-req.txt
pip-req.txt
6. Docker Build (1)
• 400+ App 100 build image 200-400 build
•
• 1. App Image 4GB+, app 180s , `maintainers:
xxx@douban.com` 40s
• 2. Dockerfile layer, merge RUN: 180s -> 40s
• 3. Dockerfile Docker container run + commit : 40s -> 8s
6. Docker Build (2)
• 95% layer diff
layer diff docker build
Gentoo Image portage + runtime
portage
emerge binpkg, python app
run-build Dockerfile volume Docker run + volume + commit Image
: 40s -> 8s Image : 4.0GB -> 1.7GB
6. Docker Build (3)
•
• 1. gentoo_with_portage portage docker
container
• 2. dockerfile docker run + commit docker build docker run volume
gentoo_with_portage container container portage emerge
binpkg
•
• 1. Image
• 2. gentoo_with_portage container
• 3. Dockerfile
• 4. volume-from container `mount --bind` container
gentoo_with_portage volume list
- /usr/portage/
- /etc/portage/
- /var/lib/layman/
- /var/cache/edb/
- /usr/libexec/gcc/
- /usr/share/include/
- /usr/x86_64-pc-linux-gnu/
- /lib64/modules/
- /lib64/firmware/
- /usr/lib64/gcc/x86_64-pc-linux-gnu/
7.
• :
•
• 1. puppet
• 2. ossetup app image /var/dae/app/xxx/
• 3. volume container
• - volume inode container
8. moosefs fuse (1)
• : DAE app permdir mfs( fuse )
mfs volume container mfs-
mount ( mfs master ) container mfs
`Transport endpoint is not connected` container
•
• 1. docker volume mfs inode 1
mfsmount mfs /proc/self/mountinfo
container /etc/self/mountinfo
8. moosefs fuse (2)
•
• 2. docker volume linux `mount --bind `
• 3. Linux shared subtrees mount namespace mount umount
•
• 1. /fuse mount point : `mount --bind /fuse
/fuse`
• 2. /fuse mount mode shared mount `mount --make-shared /fuse`
• 3. mfs mount /fuse/mfs
• 4. container `-v /fuse:/fuse:shared` , shared /fuse mount
namespace container mount namespace mount/umount , mfsmount
container
9. container
• : cadvisor(
) -> dae-monitor-agent
•
• 1. docker ps/inspect/exec container
docker dameon
docker daemon
• 2. docker api
• cgroups: cpu/mem/network/blkio
• docker container
• /var/lib/docker/container/${cid}/hostconfig.json
• /var/run/docker/*/${cid}/state.json
daemon-agent container-agent oom-agent
monitor data upload
redis mc
graphite
DAE Monitor Aggregator
API Icinga2
sentry
email
- version/info
- daemon process
- image storage
- dm cpu/mem
- mem/cpu/blkio
- network
- image version
- fuse mount
dae-monitor-agent
10. container log
• DAE Python:
• monkey patch: logger handler stdout/stderr -> ScribeHandler , container log-
driver=none
• , DAE-go
• container syslog-driver + syslog-ng + scribe/mfs
app-container
--log-driver=syslog
--log-opt syslog-address=tcp://127.0.0.1:9614
--log-opt tag=‘scribe@dae_applog/container’
--log-opt tag='/fuse/dfs/permdirs/daegrade/test.log'
syslog-ng-container
- 9614 syslog-ng
- tag `scribe@` python
scribe mod for syslog-ng, log
scribe-buffer
- tag `/fuse` log mfs
mfs
scribe-buffer
scribe-sink
11. maintainance
• image container(exited/stopped/dead)
• image docker rmi -v -v volume-from
• docker daemon `-H 0.0.0.0:4243` tls
• Docker Daemon daemontools supervisor docker daemon
• docker daemon
Docker在豆瓣的实践 刘天伟-20160709

More Related Content

PDF
douban happyday docker for daeqaci
PDF
DCSF19 Dockerfile Best Practices
ODP
Docker - The Linux Container
PDF
Docker, Kubernetes, and Mesos recipes for Java developers
PPTX
Getting Started with Docker
PDF
[NYC Meetup] Docker at Nuxeo
PDF
Clocker - The Docker Cloud Maker
PDF
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
douban happyday docker for daeqaci
DCSF19 Dockerfile Best Practices
Docker - The Linux Container
Docker, Kubernetes, and Mesos recipes for Java developers
Getting Started with Docker
[NYC Meetup] Docker at Nuxeo
Clocker - The Docker Cloud Maker
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

What's hot (20)

PDF
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
PPTX
Oscon London 2016 - Docker from Development to Production
PDF
On demand-block-storage-for-docker
PPTX
Devoxx France 2015 - The Docker Orchestration Ecosystem on Azure
PDF
NAVER Ceph Storage on ssd for Container
PPTX
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
PDF
cephfs with openstack manila based on bluestore and erasure code
PPTX
Deploying Windows Containers on Windows Server 2016
PDF
Plug-ins: Building, Shipping, Storing, and Running - Nandhini Santhanam and T...
PPTX
Deploying applications to Windows Server 2016 and Windows Containers
PPTX
Docker Introductory workshop
PPTX
Real World Lessons on the Pain Points of Node.JS Application
PPTX
KVM and docker LXC Benchmarking with OpenStack
PDF
A Hands-on Introduction to Docker
PPTX
Running .NET on Docker
PDF
Docker Basics & Alfresco Content Services
PDF
Introduction to Docker and deployment and Azure
PPTX
Docker and the Container Ecosystem
PPTX
Real World Experience of Running Docker in Development and Production
PDF
Introduction to docker security
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
Oscon London 2016 - Docker from Development to Production
On demand-block-storage-for-docker
Devoxx France 2015 - The Docker Orchestration Ecosystem on Azure
NAVER Ceph Storage on ssd for Container
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
cephfs with openstack manila based on bluestore and erasure code
Deploying Windows Containers on Windows Server 2016
Plug-ins: Building, Shipping, Storing, and Running - Nandhini Santhanam and T...
Deploying applications to Windows Server 2016 and Windows Containers
Docker Introductory workshop
Real World Lessons on the Pain Points of Node.JS Application
KVM and docker LXC Benchmarking with OpenStack
A Hands-on Introduction to Docker
Running .NET on Docker
Docker Basics & Alfresco Content Services
Introduction to Docker and deployment and Azure
Docker and the Container Ecosystem
Real World Experience of Running Docker in Development and Production
Introduction to docker security
Ad

Viewers also liked (6)

PPT
Презентация
PPT
Mr&ueh数据库方面
PPTX
4 高阳 淘宝主站cgroup资源控制实践
PPTX
Web security-–-everything-we-know-is-wrong-eoin-keary
PDF
SXSW 2016 takeaways
Презентация
Mr&ueh数据库方面
4 高阳 淘宝主站cgroup资源控制实践
Web security-–-everything-we-know-is-wrong-eoin-keary
SXSW 2016 takeaways
Ad

Similar to Docker在豆瓣的实践 刘天伟-20160709 (20)

PPTX
Docker Starter Pack
PPTX
Docker for developers z java
PPTX
PDF
Docker tips
PDF
Docker as an every day work tool
PDF
Check the version with fixes. Link in description
PDF
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
PDF
Challenges of container configuration
PDF
Docker 0.11 at MaxCDN meetup in Los Angeles
PDF
Learning Docker with Thomas
PDF
Introduction to Docker
PDF
Real-World Docker: 10 Things We've Learned
PDF
Docker presentation | Paris Docker Meetup
PDF
Victor Vieux at Docker Paris Meetup #1
PDF
手把手帶你學Docker 03042017
PDF
Docker for developers
PDF
What’s New in Docker - Victor Vieux, Docker
PDF
DCA. certificate slide Session 2
PDF
時代在變 Docker 要會:台北 Docker 一日入門篇
PDF
手把手帶你學 Docker 入門篇
Docker Starter Pack
Docker for developers z java
Docker tips
Docker as an every day work tool
Check the version with fixes. Link in description
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
Challenges of container configuration
Docker 0.11 at MaxCDN meetup in Los Angeles
Learning Docker with Thomas
Introduction to Docker
Real-World Docker: 10 Things We've Learned
Docker presentation | Paris Docker Meetup
Victor Vieux at Docker Paris Meetup #1
手把手帶你學Docker 03042017
Docker for developers
What’s New in Docker - Victor Vieux, Docker
DCA. certificate slide Session 2
時代在變 Docker 要會:台北 Docker 一日入門篇
手把手帶你學 Docker 入門篇

More from Tianwei Liu (8)

PPTX
2021 ee大会-旷视ai产品背后的研发效能工具建设
PDF
2020 gops-旷视城市大脑私有云平台实践-刘天伟
PDF
豆瓣Paa s平台 dae - 2017
PDF
DAE 新变化介绍
PPT
Kmeans in-hadoop
PPT
Hadoop introduction 2
PPT
Hadoop introduction
PPT
2021 ee大会-旷视ai产品背后的研发效能工具建设
2020 gops-旷视城市大脑私有云平台实践-刘天伟
豆瓣Paa s平台 dae - 2017
DAE 新变化介绍
Kmeans in-hadoop
Hadoop introduction 2
Hadoop introduction

Recently uploaded (20)

PPT
Project quality management in manufacturing
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
OOP with Java - Java Introduction (Basics)
PDF
PPT on Performance Review to get promotions
DOCX
573137875-Attendance-Management-System-original
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
web development for engineering and engineering
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Geodesy 1.pptx...............................................
PDF
Well-logging-methods_new................
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Project quality management in manufacturing
Arduino robotics embedded978-1-4302-3184-4.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
OOP with Java - Java Introduction (Basics)
PPT on Performance Review to get promotions
573137875-Attendance-Management-System-original
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Foundation to blockchain - A guide to Blockchain Tech
web development for engineering and engineering
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Geodesy 1.pptx...............................................
Well-logging-methods_new................
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...

Docker在豆瓣的实践 刘天伟-20160709

  • 3. Docker • DAE App • App docker image • DAE Python2.7, Python3, Golang • online/qaci/sandbox/prelease/dev • container • Docker
  • 4. • 2014 Q4: DAE Docker App • 2015 Q1: App • 2015 Q2: App Docker • 2015 Q4: QACI/Prelease Docker • 2016.06 - : Mesos + Marathon
  • 5. (1) • (400+ APP) • web, service(pidl/thrift) • DAE App cron, daemon, mq worker, remoteshell, app-admin • QACI container docker image • Prelease/Sandbox container docker image • Docker pidlproxy, dpark, scribe-sink, syslog-ng, thrift-router, dnasmasq ...
  • 6. (2) • • 100 200-400 docker image build • container 370 • 400+ • 7500 + • Prelease/Sandbox 200+
  • 7. Douban App Engine For Docker
  • 8. • container web service container container • container • Image DAE • Dev QACI Prelease Sandbox Online
  • 9. DAE • PaaS Python Golang 400+ App • Web, PIDL Service, Thrift Service, Cron, Daemon, MQ, Runscript, Admin, Dpark, QACI, Prelease, Sandbox... App MySQL, Beansdb, Memcahce, MQ, MFS, CDN, Redis... Proj A Proj B Proj C $ dae create $ dae serve $ dae test $ dae deploy App Auto Scale Load Balancer Node Balance Elastic Pool Prelease Sandbox Profile
  • 10. DAE-Docker Cron MQ Worker DaemonDaemonDaemon DaemonMQ Worker M S S zookeeper Mesos Marathon+ MQ: Beanstalkd New! Gunicorn: web._admin websocket- runscript - remoteshell - dbshell online offline http(s) LVS Nginx(lb) Nginx Gateway douban service thrift dae_thrift_ router pidl pidlproxy- client pidlproxy- server Router Layer unix domain socket Node Gate Docker Container Gunicorn- sync/async - multi-instances - master-worker puppet:conf mfs:permdir volume monitor/sa agent bridge/host App Node DAE API (python/golang) Auto Scale Distributed Trace Orchestration waylifebeansdb/mysql/mc/mq/redis/graphite... Bridge/Deploy Logs Resource Layer dev Vagrant Container DAE-SDK Docker Compose Container App-Test Jenkins mysql redis mc scribe beansdb Prelease Sandbox Golang Gevent daes
  • 11. DAE CI/CD Github/Code pull request merged review test + pylint prelease/sandbox Make Archive Image Build Image Push App Node1 App Node2 App NodeN docker pull Build Static Jenkins:QACI app.yaml chk hook trigger deploy Auto Stage0 Stage Deploy Deploy Rolling Update cfg update container restart selftest Image Cached Rollback No Yes update conf irc/slack/email notify end Regi stry
  • 13. 1. : CentOS 6.5 vs Gentoo • Centos 6.5 (2014.9) • Docker ( Gentoo) • Docker 1.2 Ubuntu/Centos • CentOS6.5 Gentoo • CentOS 6.5, Linux 2.6 -> Docker Daemon crash, Kernal Panic • DAE / -> Gentoo binpkg CentOS RPM • CentOS 2.6 Python 2.6 -> Python2.7 hack link • Gentoo • Gentoo Linux kernel 3.18.10(overlayfs merged)
  • 14. 2. Docker (1) • Docker 1.2.0 / 1.3.2 : -> • Docker 1.4.1: production ready • zombie container (container 1 docker daemon container docker run container name DAE container ) • zombie container -> kill docker run process -> rename linkgraphdb -> cleanup container files
  • 15. 2. Docker (2) • Docker 1.5.0 DAE • : push/pull Docker Registry V1 • image pre-build pre-pull ( ) • Docker 1.7.0: Docker • : docker daemon docker daemon 7-8G container • + docker daemon
  • 16. 2. Docker (3) • Docker 1.8.1 6 • 1 : container /etc/hosts net=host container /etc/hosts /etc/hosts container • container /etc/hosts container hosts /var/ lib/container/${cid}/hosts `mount --bind` container namespace net=host : • volume /var/run/nscd lookup cache • /var/lib/docker/${cid}/hosts inode container
  • 17. 2. Docker (4) • Docker 1.8.1 6 • 2 : volume-from data container data container volume container app • data container ready • 3: docker registry v2 push image buffering disk, image partent image id • Docker 1.10.1 • : `Removal In Progress` container container name • docker rename • Docker 1.10.3 + docker registry v2 (2016.2 ) push/pull
  • 18. 3. Docker Registry v2 • distribution: docker >1.10 push/pull • • docker.douban : build push • dev.docker.douban : • distribution api, DAE app Image • nginx upstream round robin push image `digest invalid: provided digest did not match uploaded content` mfs layer size • nginx ip_hash • distribution sentry load balancer distribution distribution distribution mossefs: Imageredis:cache
  • 19. 4. Docker (1): dm vs overlay • DeviceMapper • 2014.09 ~ 2015.06 • • build image 400+ App 100 build 200-400 build • • 1. docker daemon : ` --storage-opt dm.blkdiscard=false --storage-opt dm.mountopt=nodiscard` --> kernel crash rm image pool • 2. /var/lib/docker/devicemapper/data `direct-lvm` -> image build 180s -> 120s
  • 20. 4. Docker (2): dm vs overlay • ref: http://developerblog.redhat.com/2014/09/30/overview-storage-scalability-docker/
  • 21. 4. Docker (3): dm vs overlay • Overlay • 2015.06 - overlay2 • • 1. AUFS Linux upstream AUFS • 2. Overlay AUFS Linux 3.18 COW docker image • • /var/lib/docker/overlay lvm Ext4 • build 180s -> 120s -> 100s
  • 22. 4. Docker (4): dm vs overlay • Overlay • inode ; build image , `too many links` --> docker 1.12 + kernel 4.0 + overlay2 • • 1. base image hard link kernal links • 2. linux ext4: `#define EXT4_LINK_MAX 65000` • docker overlay overlay container - low-id: image id - uppper: container - work: overlay - merged: container , mount-bind image overlay image - image - Linux 7 copy regular file hard link.
  • 24. 5. DAE-Docker Image (2) • DAE-Python App • sys-req.txt: gentoo binpkg • pip-req.txt : python pip requirements sys-req.txt pip-req.txt
  • 25. 6. Docker Build (1) • 400+ App 100 build image 200-400 build • • 1. App Image 4GB+, app 180s , `maintainers: xxx@douban.com` 40s • 2. Dockerfile layer, merge RUN: 180s -> 40s • 3. Dockerfile Docker container run + commit : 40s -> 8s
  • 26. 6. Docker Build (2) • 95% layer diff layer diff docker build Gentoo Image portage + runtime portage emerge binpkg, python app run-build Dockerfile volume Docker run + volume + commit Image : 40s -> 8s Image : 4.0GB -> 1.7GB
  • 27. 6. Docker Build (3) • • 1. gentoo_with_portage portage docker container • 2. dockerfile docker run + commit docker build docker run volume gentoo_with_portage container container portage emerge binpkg • • 1. Image • 2. gentoo_with_portage container • 3. Dockerfile • 4. volume-from container `mount --bind` container gentoo_with_portage volume list - /usr/portage/ - /etc/portage/ - /var/lib/layman/ - /var/cache/edb/ - /usr/libexec/gcc/ - /usr/share/include/ - /usr/x86_64-pc-linux-gnu/ - /lib64/modules/ - /lib64/firmware/ - /usr/lib64/gcc/x86_64-pc-linux-gnu/
  • 28. 7. • : • • 1. puppet • 2. ossetup app image /var/dae/app/xxx/ • 3. volume container • - volume inode container
  • 29. 8. moosefs fuse (1) • : DAE app permdir mfs( fuse ) mfs volume container mfs- mount ( mfs master ) container mfs `Transport endpoint is not connected` container • • 1. docker volume mfs inode 1 mfsmount mfs /proc/self/mountinfo container /etc/self/mountinfo
  • 30. 8. moosefs fuse (2) • • 2. docker volume linux `mount --bind ` • 3. Linux shared subtrees mount namespace mount umount • • 1. /fuse mount point : `mount --bind /fuse /fuse` • 2. /fuse mount mode shared mount `mount --make-shared /fuse` • 3. mfs mount /fuse/mfs • 4. container `-v /fuse:/fuse:shared` , shared /fuse mount namespace container mount namespace mount/umount , mfsmount container
  • 31. 9. container • : cadvisor( ) -> dae-monitor-agent • • 1. docker ps/inspect/exec container docker dameon docker daemon • 2. docker api • cgroups: cpu/mem/network/blkio • docker container • /var/lib/docker/container/${cid}/hostconfig.json • /var/run/docker/*/${cid}/state.json daemon-agent container-agent oom-agent monitor data upload redis mc graphite DAE Monitor Aggregator API Icinga2 sentry email - version/info - daemon process - image storage - dm cpu/mem - mem/cpu/blkio - network - image version - fuse mount dae-monitor-agent
  • 32. 10. container log • DAE Python: • monkey patch: logger handler stdout/stderr -> ScribeHandler , container log- driver=none • , DAE-go • container syslog-driver + syslog-ng + scribe/mfs app-container --log-driver=syslog --log-opt syslog-address=tcp://127.0.0.1:9614 --log-opt tag=‘scribe@dae_applog/container’ --log-opt tag='/fuse/dfs/permdirs/daegrade/test.log' syslog-ng-container - 9614 syslog-ng - tag `scribe@` python scribe mod for syslog-ng, log scribe-buffer - tag `/fuse` log mfs mfs scribe-buffer scribe-sink
  • 33. 11. maintainance • image container(exited/stopped/dead) • image docker rmi -v -v volume-from • docker daemon `-H 0.0.0.0:4243` tls • Docker Daemon daemontools supervisor docker daemon • docker daemon