Docker and coreos20141020b

28
Docker & CoreOS a study note Richard Kuo

description

Introduction to Docker and CoreOS with 2 mindmaps.

Transcript of Docker and coreos20141020b

Page 1: Docker and coreos20141020b

 Docker  &  CoreOS    a  study  note  

Richard Kuo

Page 2: Docker and coreos20141020b

Agenda  •  Review  of  Docker,  demo  –  Pull,  build,  Docker  container  repo  

•  Overview  of  CoreOS,  demo    –  Build,  install  container,  destroy/rejoin  host  

•  Use  cases  and  potenDal  architecture  •  Discussions  

10/20/14   2  CreaDve  Common-­‐SA,  NC  

Page 3: Docker and coreos20141020b

It  will  be  nice  to  have  computer  resources…  

•   General  –  Agile,  fault  tolerant,  HA    –  New  resource  joins  pool  automaDcally  in-­‐out,  uDlizaDon  -­‐  release  

resources  for  other  to  use  –  User  friendly,  reasonable  learn  curve  to  use  it,  and  low  maintenance  –  Scalable  

•  SoPware  –  Configurable  auto  update,  increment,  transparent  –  Run  mulDple  versions  of  app  at  the  same  Dme  –  Across  physical  boundary  –  Self-­‐content,  defensive,  not  effected  by  other  apps  

10/20/14   3  CreaDve  Common-­‐SA,  NC  

Page 4: Docker and coreos20141020b
Page 5: Docker and coreos20141020b

VirtualizaDon  ExecuDon  Environment  (VE)  

10/20/14   CreaDve  Common-­‐SA,  NC   5  

Page 6: Docker and coreos20141020b

Docker  •  Virtualize  host  OS  (mainly  Linux).  •  Standard  format  to  package  the  applicaDon  with  its  dependency.  •  Isolated  environment  for  program  execuDon.  •  Has  its  own  IP  Address.  •  Has  version  control,  like  git.  •  Can  pull/push  Docker  container  images  from  public  or  private  

repository.  •  Can  assemble  mulDple  containers  to  form  a  more  complicate  

applicaDon,  like  Lego.  

10/20/14   6  CreaDve  Common-­‐SA,  NC  

Page 7: Docker and coreos20141020b

File  Layers  in  Container    

10/20/14   CreaDve  Common-­‐SA,  NC   7  

Page 8: Docker and coreos20141020b

Why  do  we  care?  •  Beaer  use  of  computer  resources,  IBM  report.  •  Open  Source  and  supports  all  major  OS  (Linux,  MacOS  and  

Windows).      •  Can  be  on  many  devices,  from  Raspberry  Pi,  Android  device,  laptop,  

server  to  Data  Center.  

 •  Game  Changer,  Awesome!  Opportuni;es!  

10/20/14   8  CreaDve  Common-­‐SA,  NC  

Page 9: Docker and coreos20141020b

10/20/14   CreaDve  Common-­‐SA,  NC,  BY   9  

Page 10: Docker and coreos20141020b

DEMO  

10/20/14   CreaDve  Common-­‐SA,  NC   10  

Page 11: Docker and coreos20141020b
Page 12: Docker and coreos20141020b

It  is  Alpha!    There  are  beta  and  stable  channels  too.  Image  credit  hap://quoteko.com/stork-­‐boy.html    

10/20/14   12  CreaDve  Common-­‐SA,  NC  

Page 13: Docker and coreos20141020b

CoreOS  •  CoreOS  is  a  minimal  Linux  OS,  was  originally  based  on  

Gentoo.  •  Linux  Kernel  +  Docker  Containers.    •  Built  for  running  HA  clusters.  •  Updates,  patches  applies  automaDcally  (configurable).    •  Uses  systemd,  has  3  main  components:  

–   fleet:  cluster  service  management    –   etcd:  distributed  key-­‐value  store  –   docker:  container  

10/20/14   13  CreaDve  Common-­‐SA,  NC  

Page 14: Docker and coreos20141020b

Why  CoreOS?  •  Designed  for  massive  server  deployments.    •  Support  Docker  container  out  of  box.  •  Support  cloud  plamorm    

–  Digital  Ocean  –  OpenStack  –  Google  Compute  Engine    –  Amazon  EC2  –  Rackspace  Cloud    –  Brightbox  Cloud    

•  Available  on  Linux,  Mac  and  Windows.  

10/20/14   14  CreaDve  Common-­‐SA,  NC  

Page 15: Docker and coreos20141020b

10/20/14   CreaDve  Common-­‐SA,  NC,  BY   15  

Page 16: Docker and coreos20141020b

Update  •  If  there  is  an  update  available  it  is  

downloaded  and  installed  to  root  B.  To  ensure  we  don’t  disrupt  your  applicaDon,  we  rate  limit  the  disk  and  network  I/O  this  process  is  allowed  to  use  with  Linux  cgroups.  

•  Using  this  dual-­‐root  scheme  is  an  improvement  on  the  exisDng  workflow  of  yum  or  apt-­‐get.  Using  these  tools  during  upgrading  has  been  known  to  cause  the  package  manager  to  force  daemons  to  use  new  libraries  or  move  configuraDon  files  around.  With  CoreOS,  a  system  update  is  an  atomic  operaDon  that  can  be  rolled  back.  

10/20/14   CreaDve  Common-­‐SA,  NC   16  

Page 17: Docker and coreos20141020b

Systemd  haps://en.wikipedia.org/wiki/Systemd    

•  System  management  daemon    

•  Services,  Dmers,  and  one-­‐off  jobs    

•  Logging  through  journal,  support  json  

10/20/14   CreaDve  Common-­‐SA,  NC   17  

Page 18: Docker and coreos20141020b

Fleet  •  Cluster-­‐level  service  management    •  Schedules  jobs  across  cluster    •  Reschedules  units  on  failure    

10/20/14   CreaDve  Common-­‐SA,  NC   18  

Page 19: Docker and coreos20141020b

etcd  •  etcd  is  a  distributed  key  value  

store.    •  Shared  configuraDon,  

applicaDons  can  read  and  write  data  into  etcd.  

•  Distributed  locking.  

•  etcd  uses  RaP  protocol,  gracefully  handles  master  elecDon  during  network  parDDons  and  the  loss  of  the  current  master.  

10/20/14   CreaDve  Common-­‐SA,  NC,  BY   19  

Page 20: Docker and coreos20141020b

Docker  •  Only  packaging  method  in  

CoreOS  •  Container  is  self  contain  •  Isolated  from  other  

applicaDons    •  Less  overhead  than  VMs    

10/20/14   CreaDve  Common-­‐SA,  NC,  BY   20  

Page 21: Docker and coreos20141020b

DEMO  

10/20/14   CreaDve  Common-­‐SA,  NC   21  

Page 22: Docker and coreos20141020b

Lessons  Learnt  and  ToDo  •  Docker  and  CoreOS  offer  new  architecture  design  opDons  for  applicaDons,  plamorm  and  data  centers.  

•  They  allow  more  efficient  app  design,  test,    deployment  and  workflows  for  developers.  

•  New  programming  language  and  design  paradigms.  

10/20/14   22  CreaDve  Common-­‐SA,  NC  

Page 23: Docker and coreos20141020b

Architecture  OpDons  

10/20/14   CreaDve  Common-­‐SA,  NC,  BY   23  

Page 24: Docker and coreos20141020b

BACKUP  SLIDES  

10/20/14   CreaDve  Common-­‐SA,  NC   24  

Page 25: Docker and coreos20141020b

From  LXC  to  libcontainer  •  Move  from  using  LXC  to  

libcontainer  as  default  at  release  0.9  –  Standardize  interface  with  Linux,  can  

be  controlled  as  expected.  –  Joint  efforts.  –  Cross-­‐plamorm,  in  Windows  too.  –  Large  momentum  behind  Docker  

technology.    

10/20/14   CreaDve  Common-­‐SA,  NC   25  

Page 26: Docker and coreos20141020b

Cloudy  Performance:  Steady  State  Packing  hap://www.slideshare.net/dotCloud/performance-­‐characterisDcs-­‐of-­‐tradiDonal-­‐v-­‐ms-­‐vs-­‐docker-­‐containers    

10/20/14   26  

0  20  40  60  80  

1   9   17  

25  

33  

41  

49  

57  

65  

73  

81  

89  

97  

105  

113  

121  

129  

137  

145  

153  

161  

169  

177  

185  

193  

201  

209  

217  

225  

233  

241  

249  

257  

265  

273  

281  

289  

297  

305  

313  

321  

CPU  Usage  In

 Percent  

Time  

Docker:  Compute  Node  CPU  (full  test  dura;on)  

usr  

sys  

Averages  

–    0.54  –    0.17  

0  20  40  60  80  

1   9   17  

25  

33  

41  

49  

57  

65  

73  

81  

89  

97  

105  

113  

121  

129  

137  

145  

153  

161  

169  

177  

185  

193  

201  

209  

217  

225  

233  

241  

249  

257  

265  

273  

281  

289  

297  

305  

313  

321  

329  

337  

345  

CPU  Usage  In

 Percent  

Time  

KVM:  Compute  Node  CPU  (full  test  dura;on)  

usr  

sys  

Averages  

–    7.64  –    1.4  

CreaDve  Common-­‐SA,  NC  

Page 27: Docker and coreos20141020b

Cloudy  Performance:  Steady  State  Packing  

10/20/14   27  

-­‐1  

4  

9  

14  

1   6   11  

16  

21  

26  

31  

36  

41  

46  

51  

56  

61  

66  

71  

76  

81  

86  

91  

96  

101  

106  

111  

116  

121  

126  

131  

136  

141  

146  

151  

156  

161  

166  

171  

176  

181  

186  

191  

196  

201  

206  

211  

CPU  Usage  In

 Percent  

Time  (31s  –  243s)  

Docker:  Compute  Node  Steady-­‐State  CPU  (segment:  31s  –  243s)  

usr  

sys  

-­‐1  

4  

9  

14  

1   6   11  

16  

21  

26  

31  

36  

41  

46  

51  

56  

61  

66  

71  

76  

81  

86  

91  

96  

101  

106  

111  

116  

121  

126  

131  

136  

141  

146  

151  

156  

161  

166  

171  

176  

181  

186  

191  

196  

201  

206  

211  

CPU  Usage  In

 Percent  

Time  (95s  -­‐  307s)  

KVM:  Compute  Node  Steady-­‐State  CPU  (segment:  95s  –  307s)  

usr  

sys  

Averages  

–    0.2  –    0.03  

Averages  

–    1.91  –    0.36  

31  seconds  243  seconds  

95  seconds  307  seconds  

CreaDve  Common-­‐SA,  NC  

Page 28: Docker and coreos20141020b

Cloudy  Performance:  Steady  State  Packing  

10/20/14   28  

0.00E+00  

1.00E+09  

2.00E+09  

3.00E+09  

4.00E+09  

5.00E+09  

6.00E+09  

7.00E+09  

1   10  

19  

28  

37  

46  

55  

64  

73  

82  

91  

100  

109  

118  

127  

136  

145  

154  

163  

172  

181  

190  

199  

208  

217  

226  

235  

244  

253  

262  

271  

280  

289  

298  

307  

316  

325  

334  

Mem

ory  Used  

Axis  Title  

Docker  /  KVM:  Compute  Node  Used  Memory  (Overlay)  

kvm  

docker  

docker  Delta  734  MB  Per  VM  49  MB  KVM  Delta  4387  MB  Per  VM  292  MB  

CreaDve  Common-­‐SA,  NC