SlideShare a Scribd company logo
1 of 45
Download to read offline
Introduc)on	
  to
Harun Yardımcı
h_yardimci /in/harunyardimci
harun.yardimci@gmail.com
40.990022, 29.107436
hyardimci@ebay.com
https://about.me/harun.yardimci
AGENDA
~ 1 HOUR
IMMUTABLE INFRASTRUCTURE
DOCKER
IMAGES AND CONTAINERS
HUB & REGISTRY
BUILD & PULL
ORCHESTRATION
MACHINE
SWARM
COMPOSE
DEPLOYMENTS
MONITORING
“I know the solution is Docker, but I am not sure of
the problem.”
Immutable Infrastructure
Deployments
Environment Inconsistency
Developer Onboarding
Resources
Isolation
Security
Fast Shipment
Quickly Scale
Immutable	
  Servers	
  are	
  like	
  Legos:	
  rebuild	
  and	
  
replace	
  instead	
  of	
  repairing	
  them.
OS v1
App v1
OS v1
App v1
ac)veac)ve
OS v1
App v2
ac)ve
OS v1
App v1
inac)ve
OS v1
App v2
ac)ve
OS v2
App v2
ac)ve
OS v1
App v2
inac)ve
OS v2
App v2
ac)ve
OS v1
App v1
inac)ve
Patch	
  
Applica)on
Patch	
  OS
Build
ImmutableMutable
Inac)ve	
  once	
  will	
  be	
  dropped.
&
That is Enough!
BUT..
Meet the Moby Dock
Yes!	
  	
  
This	
  whale	
  has	
  a	
  name.
Open	
  pla(orm	
  for	
  building,	
  shipping	
  and	
  
running	
  distributed	
  applica5ons.
What	
  is	
  Docker?
Ship	
  Faster	
  and	
  Easier	
  
Applica5on	
  Portability	
  
Infrastructure	
  Flexibility	
  
Scalable
How	
  it	
  will	
  help?
VMs are the same!
Virtual	
  Machine Container
not
^
Architecture Overview
Client Server Architecture
&
+
Next couple of slides contains bash
commands and terminal outputs.
There is no need to read them all.
	
  	
  _	
  	
  	
  _	
  _____	
  ____	
  	
  ____	
  	
  	
  	
  	
  	
  	
  	
  _	
  	
  	
  	
  _	
  	
  	
  	
  	
  _____	
  ____	
  _____	
  _	
  	
  
	
  |	
  	
  |	
  |	
  ____|	
  	
  _	
  |	
  	
  _	
  	
  	
  	
  	
  	
  	
  /	
  	
  	
  |	
  |	
  	
  	
  |	
  ____|	
  	
  _	
  _	
  	
  	
  _|	
  |	
  
	
  |	
  	
  |	
  |	
  	
  _|	
  |	
  |_)	
  |	
  |	
  |	
  |	
  	
  	
  	
  /	
  _	
  	
  |	
  |	
  	
  	
  |	
  	
  _|	
  |	
  |_)	
  ||	
  |	
  |	
  |	
  
	
  |	
  |	
  	
  |	
  |___|	
  	
  _	
  <|	
  |_|	
  |	
  	
  	
  /	
  ___	
  |	
  |___|	
  |___|	
  	
  _	
  <	
  |	
  |	
  |_|	
  
	
  |_|	
  _|_____|_|	
  _____/	
  	
  	
  /_/	
  	
  	
  ______|_____|_|	
  _|_|	
  (_)
	
  	
  _	
  	
  	
  _	
  _____	
  ____	
  	
  ____	
  	
  	
  	
  	
  	
  	
  	
  _	
  	
  	
  	
  _	
  	
  	
  	
  	
  _____	
  ____	
  _____	
  _	
  	
  
	
  |	
  	
  |	
  |	
  ____|	
  	
  _	
  |	
  	
  _	
  	
  	
  	
  	
  	
  	
  /	
  	
  	
  |	
  |	
  	
  	
  |	
  ____|	
  	
  _	
  _	
  	
  	
  _|	
  |	
  
	
  |	
  	
  |	
  |	
  	
  _|	
  |	
  |_)	
  |	
  |	
  |	
  |	
  	
  	
  	
  /	
  _	
  	
  |	
  |	
  	
  	
  |	
  	
  _|	
  |	
  |_)	
  ||	
  |	
  |	
  |	
  
	
  |	
  |	
  	
  |	
  |___|	
  	
  _	
  <|	
  |_|	
  |	
  	
  	
  /	
  ___	
  |	
  |___|	
  |___|	
  	
  _	
  <	
  |	
  |	
  |_|	
  
	
  |_|	
  _|_____|_|	
  _____/	
  	
  	
  /_/	
  	
  	
  ______|_____|_|	
  _|_|	
  (_)
Docker Terminology
Image
Container
Dockerfile
Build
Registry
Images and Containers
[root@localhost01	
  ~]#	
  docker	
  images	
  
REPOSITORY	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  TAG	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IMAGE	
  ID	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  CREATED	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  VIRTUAL	
  SIZE	
  
my-­‐registry.net:5000/gg-­‐jenkins	
  	
  	
  	
  	
  	
  1.609.2	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  45d86b4e7cb2	
  	
  	
  	
  	
  	
  	
  	
  5	
  days	
  ago	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1.036	
  GB	
  
my-­‐registry.net:5000/gg-­‐ac5vemq	
  	
  	
  5.11.1	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ea995e1e0547	
  	
  	
  	
  	
  	
  	
  	
  11	
  days	
  ago	
  	
  	
  	
  	
  	
  	
  	
  	
  917.8	
  MB	
  
my-­‐registry.net:5000/gg-­‐ac5vemq	
  	
  	
  latest	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ea995e1e0547	
  	
  	
  	
  	
  	
  	
  	
  11	
  days	
  ago	
  	
  	
  	
  	
  	
  	
  	
  	
  917.8	
  MB	
  
harunyardimci/ac5vemq	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  latest	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ea995e1e0547	
  	
  	
  	
  	
  	
  	
  	
  11	
  days	
  ago	
  	
  	
  	
  	
  	
  	
  	
  	
  917.8	
  MB	
  
harunyardimci/ac5vemq	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  5.11.1	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ea995e1e0547	
  	
  	
  	
  	
  	
  	
  	
  11	
  days	
  ago	
  	
  	
  	
  	
  	
  	
  	
  	
  917.8	
  MB	
  
jenkins	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1.625.1	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0c79d0a394dc	
  	
  	
  	
  	
  	
  	
  	
  3	
  weeks	
  ago	
  	
  	
  	
  	
  	
  	
  	
  887.9	
  MB
[root@localhost01	
  ~]#	
  docker	
  ps	
  
CONTAINER	
  ID	
  	
  	
  	
  	
  	
  	
  	
  IMAGE	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  COMMAND	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  CREATED	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  STATUS	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  PORTS	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NAMES
List	
  of	
  Running	
  Containers
List	
  of	
  Images
Run a Container
docker	
  	
  	
  	
  	
  	
  	
  run	
  	
  	
  	
  	
  	
  	
  jenkins
run	
  =	
  start
[root@localhost01	
  ~]#	
  docker	
  ps	
  
CONTAINER	
  ID	
  	
  	
  	
  	
  	
  	
  	
  IMAGE	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  COMMAND	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  CREATED	
  	
  	
  	
  	
  	
  	
  	
  	
  STATUS	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  PORTS	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NAMES	
  
327a0bcc9fda	
  	
  	
  	
  	
  	
  	
  	
  jenkins:latest	
  	
  	
  	
  	
  “sh	
  /usr/java/start.sh”	
  	
  	
  3	
  days	
  ago	
  	
  	
  	
  	
  	
  Up	
  2	
  seconds	
  	
  	
  	
  	
  5000/tcp	
  	
  	
  	
  	
  	
  berserk_wozniak
}
Name	
  of	
  the	
  image	
  to	
  
load	
  into	
  container
}
will	
  be	
  some	
  parameters
docker	
  	
  	
  stop	
  	
  	
  327a0bcc9fda	
  
docker	
  	
  	
  start	
  	
  	
  327a0bcc9fda
We	
  could	
  use	
  
this	
  name	
  here
Run a Container
docker	
  run	
  -­‐i	
  -­‐t	
  -­‐d	
  	
  
	
  	
  	
  	
  	
  -­‐-­‐name	
  my-­‐jenkins-­‐master	
  	
  
	
  	
  	
  	
  	
  -­‐p	
  8080:5000	
  	
  	
  
	
  	
  	
  	
  	
  	
  jenkins:1.625.1
run	
  =	
  start
[root@localhost01	
  ~]#	
  docker	
  ps	
  
CONTAINER	
  ID	
  	
  	
  	
  	
  	
  	
  	
  IMAGE	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  COMMAND	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  CREATED	
  	
  	
  	
  	
  	
  	
  	
  	
  STATUS	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  PORTS	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NAMES	
  
327a0bcc9fda	
  	
  	
  	
  	
  	
  	
  	
  jenkins:1.625.1	
  	
  	
  “sh	
  /usr/java/start.sh”	
  	
  	
  2	
  days	
  ago	
  	
  	
  	
  	
  	
  Up	
  2	
  seconds	
  	
  	
  	
  	
  0.0.0.0:8080-­‐>5000/tcp	
  	
  	
  	
  	
  	
  my-­‐jenkins-­‐master
docker	
  	
  	
  stop	
  	
  	
  my-­‐jenkins-­‐master	
  
docker	
  	
  	
  start	
  	
  	
  my-­‐jenkins-­‐master
Remove Container & Image
[root@localhost01	
  ~]#	
  docker	
  ps	
  
CONTAINER	
  ID	
  	
  	
  	
  	
  	
  	
  	
  IMAGE	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  COMMAND	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  CREATED	
  	
  	
  	
  	
  	
  	
  	
  	
  STATUS	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  PORTS	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NAMES	
  
327a0bcc9fda	
  	
  	
  	
  	
  	
  	
  	
  jenkins:1.6.25.1	
  	
  	
  “sh	
  /usr/java/start.sh”	
  	
  	
  2	
  days	
  ago	
  	
  	
  	
  	
  	
  Up	
  2	
  seconds	
  	
  	
  	
  	
  0.0.0.0:8080-­‐>5000/tcp	
  	
  	
  	
  	
  	
  my-­‐jenkins-­‐master
[root@localhost01	
  ~]#	
  docker	
  images	
  
REPOSITORY	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  TAG	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IMAGE	
  ID	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  CREATED	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  VIRTUAL	
  SIZE	
  
my-­‐registry.net:5000/gg-­‐jenkins	
  	
  	
  	
  	
  	
  1.609.2	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  45d86b4e7cb2	
  	
  	
  	
  	
  	
  	
  	
  5	
  days	
  ago	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1.036	
  GB	
  
my-­‐registry.net:5000/gg-­‐ac5vemq	
  	
  	
  5.11.1	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ea995e1e0547	
  	
  	
  	
  	
  	
  	
  	
  11	
  days	
  ago	
  	
  	
  	
  	
  	
  	
  	
  	
  917.8	
  MB	
  
my-­‐registry.net:5000/gg-­‐ac5vemq	
  	
  	
  latest	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ea995e1e0547	
  	
  	
  	
  	
  	
  	
  	
  11	
  days	
  ago	
  	
  	
  	
  	
  	
  	
  	
  	
  917.8	
  MB	
  
harunyardimci/ac5vemq	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  latest	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ea995e1e0547	
  	
  	
  	
  	
  	
  	
  	
  11	
  days	
  ago	
  	
  	
  	
  	
  	
  	
  	
  	
  917.8	
  MB	
  
harunyardimci/ac5vemq	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  5.11.1	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ea995e1e0547	
  	
  	
  	
  	
  	
  	
  	
  11	
  days	
  ago	
  	
  	
  	
  	
  	
  	
  	
  	
  917.8	
  MB	
  
jenkins	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  1.625.1	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  0c79d0a394dc	
  	
  	
  	
  	
  	
  	
  	
  3	
  weeks	
  ago	
  	
  	
  	
  	
  	
  	
  	
  887.9	
  MB
docker	
  	
  rmi	
  	
  jenkins	
  
docker	
  	
  rmi	
  	
  0c79d0a394dc	
  
docker	
  rmi	
  	
  
	
  	
  	
  	
  	
  `docker	
  images	
  	
  
	
  	
  	
  	
  	
  -­‐q	
  -­‐f	
  "dangling=true"`
docker	
  	
  rm	
  	
  my-­‐jenkins-­‐master	
  
docker	
  	
  rm	
  	
  327a0bcc9fda	
  
docker	
  rm	
  `docker	
  ps	
  -­‐aq`
docker	
  rm docker	
  rmi
Where can I find an Image
	
  	
  -­‐	
  download	
  exis)ng	
  
-­‐	
  build	
  your	
  own
hkps://hub.docker.com/
• GitHub	
  or	
  BitBucket	
  Integra5on	
  
• Automated	
  Build	
  
• Web	
  Hooks	
  
• Public	
  and	
  Private	
  Repos	
  
• Lots	
  of	
  official	
  Images
Docker	
  Hub
Where can I find an Image
Dockerfile
	
  	
  -­‐	
  download	
  exis5ng	
  
-­‐	
  build	
  your	
  own
#	
  comment	
  
INSTRUCTION	
  arguments
FROM	
   sets  the  Base  Image  for  subsequent  instruc5ons
RUN will  execute  any  commands  in  a  new  layer  on  top  of  the  current  image  and  commit  the  results
CMD provide  defaults  for  an  execu5ng  container
ENTRYPOINT allows  you  to  configure  a  container  that  will  run  as  an  executable
EXPOSE will  listen  on  the  specified  network  ports  at  run5me
ENV sets  the  environment  variable  <key>  to  the  value  <value>
ADD copies  new  files,  directories  or  remote  file  URLs  and  adds  them  to  the  filesystem  of  container
COPY copies  new  files  or  directories  and  adds  them  to  the  filesystem  of  the  container
VOLUME creates  a  mount  point  with  the  specified  name
USER	
   sets  the  user  name  or  UID  to  use  when  running  the  image  and  for  any  instruc5ons
Dockerfile Example
#	
  Node.js	
  Example	
  
#	
  Image	
  will	
  be	
  based	
  on	
  Centos6	
  
FROM	
  	
  centos:centos6	
  
#	
  Enable	
  EPEL	
  for	
  Node.js	
  
RUN	
  	
  rpm	
  -­‐Uvh	
  hkp://download.fedoraproject.org/pub/epel/6/i386/
epel-­‐release-­‐6-­‐8.noarch.rpm	
  
#	
  Install	
  Node.js	
  and	
  npm	
  
RUN	
  	
  yum	
  install	
  -­‐y	
  npm	
  
#	
  Bundle	
  app	
  source	
  
COPY	
  .	
  /src	
  
#	
  Install	
  app	
  dependencies	
  
RUN	
  cd	
  /src;	
  npm	
  install	
  
#	
  Map	
  the	
  port	
  8080	
  
EXPOSE	
  	
  8080	
  
#	
  Start	
  the	
  app	
  
CMD	
  ["node",	
  "/src/index.js"]
package.json
{	
  
	
  	
  "name":	
  "docker-­‐centos-­‐hello",	
  
	
  	
  "private":	
  true,	
  
	
  	
  "version":	
  "0.0.1",	
  
	
  	
  "descrip)on":	
  "Node.js	
  Hello	
  world	
  using	
  docker",	
  
	
  	
  	
  "dependencies":	
  {	
  
	
  	
  	
  	
  	
  	
  "express":	
  "3.2.4"	
  
	
  	
  }	
  
}
var	
  express	
  =	
  require('express');	
  
//	
  Constants	
  
var	
  PORT	
  =	
  8080;	
  
//	
  App	
  
var	
  app	
  =	
  express();	
  
app.get('/',	
  func)on	
  (req,	
  res)	
  {	
  
	
  	
  	
  	
  res.send('Hello	
  worldn');	
  
});	
  
app.listen(PORT);	
  
console.log('Running	
  on	
  hnp://localhost:'	
  +	
  PORT);
index.js
Dockerfile
Build The Image[root@localhost01	
  ~]#	
  docker	
  build	
  -­‐t	
  gg-­‐node-­‐example	
  .	
  
Sending	
  build	
  context	
  to	
  Docker	
  daemon	
  200.2	
  kB	
  
Sending	
  build	
  context	
  to	
  Docker	
  daemon	
  
Step	
  0	
  :	
  FROM	
  centos:centos6	
  
Pulling	
  repository	
  centos	
  
a005304e4e74:	
  Download	
  complete	
  
….	
  spin	
  ….	
  
Status:	
  Downloaded	
  newer	
  image	
  for	
  centos:centos6	
  
	
  -­‐-­‐-­‐>	
  a005304e4e74	
  
Step	
  1	
  :	
  RUN	
  rpm	
  -­‐Uvh	
  hkp://download.fedoraproject.org/pub/epel/6/i386/epel-­‐release-­‐6-­‐8.noarch.rpm	
  
	
  -­‐-­‐-­‐>	
  Running	
  in	
  bf9df3009d99	
  
Retrieving	
  hkp://download.fedoraproject.org/pub/epel/6/i386/epel-­‐release-­‐6-­‐8.noarch.rpm	
  
	
  -­‐-­‐-­‐>	
  e3cef724d749	
  
Removing	
  intermediate	
  container	
  bf9df3009d99	
  
Step	
  2	
  :	
  RUN	
  yum	
  install	
  -­‐y	
  npm	
  
	
  -­‐-­‐-­‐>	
  Running	
  in	
  53833526eb72	
  
Setng	
  up	
  Install	
  Process	
  
Resolving	
  Dependencies	
  
Complete!	
  
	
  -­‐-­‐-­‐>	
  c2f62ff5335d	
  
Removing	
  intermediate	
  container	
  53833526eb72	
  
Step	
  3	
  :	
  COPY	
  .	
  /src	
  
	
  -­‐-­‐-­‐>	
  865de2a7ad61	
  
Removing	
  intermediate	
  container	
  e837a9c1038d	
  
Step	
  4	
  :	
  RUN	
  cd	
  /src;	
  npm	
  install	
  
	
  -­‐-­‐-­‐>	
  Running	
  in	
  7898163aaa6b	
  
….	
  spin	
  ….	
  
Step	
  5	
  :	
  EXPOSE	
  8080	
  
	
  -­‐-­‐-­‐>	
  Running	
  in	
  86560a6429a6	
  
	
  -­‐-­‐-­‐>	
  82d48b2e1d36	
  
Removing	
  intermediate	
  container	
  86560a6429a6	
  
Step	
  6	
  :	
  CMD	
  node	
  /src/index.js	
  
	
  -­‐-­‐-­‐>	
  Running	
  in	
  67e03c4ee83e	
  
	
  -­‐-­‐-­‐>	
  41c16d218d70	
  
Removing	
  intermediate	
  container	
  67e03c4ee83e	
  
Successfully	
  built	
  41c16d218d70
Build The Image
[root@localhost01	
  ~]#	
  docker	
  images	
  
REPOSITORY	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  TAG	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  IMAGE	
  ID	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  CREATED	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  VIRTUAL	
  SIZE	
  
centos	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  centos6	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  539c0211cd76	
  	
  	
  	
  	
  	
  	
  	
  5	
  seconds	
  ago	
  	
  	
  	
  	
  203.1	
  MB	
  
gg-­‐node-­‐example	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  latest	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  d64d3505b0d2	
  	
  	
  	
  	
  	
  	
  2	
  hours	
  ago	
  	
  	
  	
  	
  	
  	
  	
  	
  539.3	
  MB
Second	
  Time
[root@localhost01	
  ~]#	
  docker	
  build	
  -­‐t	
  gg-­‐node-­‐example	
  .	
  
Sending	
  build	
  context	
  to	
  Docker	
  daemon	
  202.2	
  kB	
  
Sending	
  build	
  context	
  to	
  Docker	
  daemon	
  
Step	
  0	
  :	
  FROM	
  centos:centos6	
  
	
  -­‐-­‐-­‐>	
  a005304e4e74	
  
Step	
  1	
  :	
  RUN	
  rpm	
  -­‐Uvh	
  hkp://download.fedoraproject.org/pub/epel/6/i386/epel-­‐release-­‐6-­‐8.noarch.rpm	
  
	
  -­‐-­‐-­‐>	
  Using	
  cache	
  
	
  -­‐-­‐-­‐>	
  e3cef724d749	
  
Step	
  2	
  :	
  RUN	
  yum	
  install	
  -­‐y	
  npm	
  
	
  -­‐-­‐-­‐>	
  Using	
  cache	
  
	
  -­‐-­‐-­‐>	
  c2f62ff5335d	
  
Step	
  3	
  :	
  COPY	
  .	
  /src	
  
	
  -­‐-­‐-­‐>	
  31caf3a92acb	
  
Removing	
  intermediate	
  container	
  db10d432aa91	
  
Step	
  4	
  :	
  RUN	
  cd	
  /src;	
  npm	
  install	
  
	
  -­‐-­‐-­‐>	
  Running	
  in	
  9d4wd824d6b	
  
Step	
  5	
  :	
  EXPOSE	
  8080	
  
	
  -­‐-­‐-­‐>	
  Running	
  in	
  86560a6429a6	
  
	
  -­‐-­‐-­‐>	
  82d48b2e1d36	
  
Removing	
  intermediate	
  container	
  86560a6429a6	
  
Step	
  6	
  :	
  CMD	
  node	
  /src/index.js	
  
	
  -­‐-­‐-­‐>	
  Running	
  in	
  67e03c4ee83e	
  
	
  -­‐-­‐-­‐>	
  41c16d218d70	
  
Removing	
  intermediate	
  container	
  67e03c4ee83e	
  
Successfully	
  built	
  41c16d218d70
Hub and Registry
[root@localhost01	
  ~]#	
  docker	
  push	
  harunyardimci/ac)vemq	
  
The	
  push	
  refers	
  to	
  a	
  repository	
  [harunyardimci/ac5vemq]	
  (len:	
  1)	
  
ea995e1e0547:	
  Image	
  push	
  failed	
  
Please	
  login	
  prior	
  to	
  push:	
  
Username:	
  harunyardimci	
  
Password:	
  
Email:	
  email@myemail.com	
  
WARNING:	
  login	
  creden5als	
  saved	
  in	
  /root/.docker/config.json	
  
Login	
  Succeeded	
  
The	
  push	
  refers	
  to	
  a	
  repository	
  [harunyardimci/ac5vemq]	
  (len:	
  1)	
  
ea995e1e0547:	
  Image	
  already	
  exists	
  
a01e3f658b16:	
  Image	
  already	
  exists	
  
8209bd534a23:	
  Image	
  successfully	
  pushed	
  
61abcd2c1997:	
  Image	
  successfully	
  pushed	
  
47271e138907:	
  Image	
  already	
  exists	
  
9d39128059aa:	
  Image	
  successfully	
  pushed	
  
ad6b675a1518:	
  Image	
  already	
  exists	
  
49d630d58a4b:	
  Image	
  successfully	
  pushed	
  
b4cb24b0365b:	
  Image	
  already	
  exists	
  
49ebfec495e1:	
  Image	
  successfully	
  pushed	
  
bw63b0f4db1:	
  Image	
  successfully	
  pushed	
  
2262501f7b5a:	
  Image	
  already	
  exists	
  
a594f78c2a03:	
  Image	
  successfully	
  pushed	
  
682b997ad926:	
  Image	
  successfully	
  pushed	
  
607e965985c1:	
  Image	
  successfully	
  pushed	
  
1ff9f26f09w:	
  Image	
  successfully	
  pushed	
  
9a61b6b1315e:	
  Image	
  already	
  exists	
  
902b87aaaec9:	
  Image	
  successfully	
  pushed	
  
Digest:	
  sha256:349339cbb0d44af01b2822efede02df3f377f6fce774489dba2266847a193416
Private Registryour
own
Commit	
  and	
  Push	
  
Changes	
  as	
  Normal
Build	
  the	
  Code	
  
and	
  Create	
  Docker	
  
Image	
  with	
  a	
  New	
  
Tag	
  (Version)
Pull	
  Changes Push	
  Image
Store	
  Docker	
  Images
Private Registryour
own
Pull an Image
[root@localhost01	
  ~]#	
  docker	
  pull	
  my-­‐registry.net:5000/ac)vemq
[root@localhost01	
  ~]#	
  docker	
  pull	
  harunyardimci/ac)vemq
Pull	
  From	
  Docker	
  Hub
Pull	
  From	
  Private	
  Registry
Use	
  your	
  username	
  in	
  docker	
  hub	
  
Use	
  private	
  registry	
  hostname	
  and	
  
port	
  (and	
  username	
  if	
  
authen5ca5on	
  enabled)	
  
Pull an Image
[root@localhost01	
  ~]#	
  docker	
  pull	
  ubuntu	
  
Pulling	
  repository	
  ubuntu	
  
b7de3133ff98:	
  Pulling	
  dependent	
  layers	
  
5cc9e91966f7:	
  Pulling	
  fs	
  layer	
  
511136ea3c5a:	
  Download	
  complete	
  
ef52w1fe610:	
  Download	
  complete	
  
f5f2fe7ac31e:	
  Download	
  complete	
  
be55w7f26a5:	
  Download	
  complete	
  
3f42f9df3610:	
  Download	
  complete	
  
.	
  .	
  .	
  
Status:	
  Downloaded	
  newer	
  image	
  for	
  ubuntu	
  
Other Commands
commit	
  
cp	
  
create	
  
exec	
  
export	
  
import	
  
info	
  
inspect	
  
logs	
  
port	
  
push	
  
stats	
  
tag	
  
top
Orchestration
Docker Machine
beta
allows	
  you	
  to	
  provision	
  Docker	
  on	
  
virtual	
  machines	
  that	
  reside	
  either	
  on	
  
your	
  local	
  system	
  or	
  on	
  a	
  cloud	
  provider
$	
  docker-­‐machine	
  create	
  -­‐d	
  virtualbox	
  dev
$	
  docker-­‐machine	
  create	
  -­‐d	
  digitalocean	
  -­‐-­‐digitalocean-­‐
access-­‐token=secret
AWS,	
  Digital	
  Ocean,	
  Google	
  Cloud	
  Pla(orm,	
  IBM	
  So|layer,	
  Microso|	
  Azure	
  
and	
  Hyper-­‐V,	
  OpenStack,	
  Rackspace,	
  VirtualBox,	
  VMware	
  Fusion®,	
  vCloud®	
  
Air™	
  and	
  vSphere®
Docker Machine
beta
$	
  docker-­‐machine	
  ls	
  
NAME	
  	
  	
  	
  	
  	
  ACTIVE	
  	
  	
  DRIVER	
  	
  	
  	
  	
  	
  	
  STATE	
  	
  	
  	
  	
  URL	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  SWARM	
  
default	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  virtualbox	
  	
  	
  Stopped	
  
dev-­‐env	
  	
  	
  	
  	
  	
  	
  	
  	
  virtualbox	
  	
  	
  Running	
  	
  	
  tcp://192.168.99.100:2376	
  
dev2	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  digitalocean	
  	
  	
  Stopped
$	
  docker-­‐machine	
  start	
  dev-­‐env	
  
Star5ng	
  VM...	
  
Started	
  machines	
  may	
  have	
  new	
  IP	
  addresses.	
  You	
  may	
  need	
  to	
  re-­‐run	
  the	
  `docker-­‐machine	
  env`	
  command.
$	
  docker-­‐machine	
  env	
  dev-­‐env	
  
export	
  DOCKER_TLS_VERIFY="1"	
  
export	
  DOCKER_HOST="tcp://192.168.99.100:2376"	
  
export	
  DOCKER_CERT_PATH="/Users/hyardimci/.docker/machine/machines/dev"	
  
export	
  DOCKER_MACHINE_NAME=“dev-­‐env"	
  
#	
  Run	
  this	
  command	
  to	
  configure	
  your	
  shell:	
  
#	
  eval	
  "$(docker-­‐machine	
  env	
  dev-­‐env)”
or	
  you	
  can	
  use	
  Docker	
  Quick	
  Start	
  Terminal
Docker Machine
beta
or	
  you	
  can	
  use	
  Docker	
  Quick	
  Start	
  Terminal
Docker Swarm
beta
allows	
  you	
  create	
  and	
  access	
  to	
  a	
  pool	
  
of	
  Docker	
  hosts	
  using	
  the	
  full	
  suite	
  of	
  
Docker	
  tools
$	
  docker	
  run	
  swarm	
  create
$	
  docker	
  run	
  -­‐d	
  swarm	
  join	
  -­‐-­‐addr=<node_ip:2375>	
  token://
cluster_id>
docker	
  run	
  -­‐d	
  -­‐p	
  <swarm_port>:2375	
  swarm	
  manage	
  
token://<cluster_id>
Docker Compose
beta
is	
  a	
  tool	
  for	
  defining	
  and	
  running	
  mul5-­‐
container	
  applica5ons	
  with	
  Docker.	
  
WORKDIR	
  /code	
  
ADD	
  requirements.txt	
  /code/	
  
RUN	
  pip	
  install	
  -­‐r	
  requirements.txt	
  
ADD	
  .	
  /code	
  
CMD	
  python	
  app.py
web:	
  
	
  	
  	
  	
  build:	
  .	
  
	
  	
  	
  	
  links:	
  
	
  	
  	
  	
  -­‐	
  db	
  
	
  	
  	
  	
  ports:	
  
	
  	
  	
  	
  -­‐	
  "8000:8000"	
  
db:	
  
	
  	
  	
  	
  image:	
  postgres
$	
  docker-­‐compose	
  up
Dockerfile compose.yml
• Docker	
  Client	
  
• Docker	
  Machine	
  
• Docker	
  Compose	
  (Mac	
  only)	
  
• Docker	
  Kitema5c	
  
• VirtualBox
Docker Toolbox
There	
  are	
  lots	
  of	
  more	
  tools..
CentOS	
  
Atomic	
  
Consul	
  
Terraform	
  	
  
Serf	
  
Cloudify	
  
Helios	
  
too	
  many	
  of	
  them	
  are	
  available..	
  
Ease Deployments w/ Docker
Canary Releasing Blue-Green Deployment
S1 S1 S1 S1
R R
S1 S1 S1 S1
S2 S2 S2 S2
Deploy  the  new  version  to  limited  
number  of  servers
Deploy  the  new  version  to  all  of  the  
servers  (or  provision  new  servers)
If  everything  is  OK,  then  switch  from  
router  to  new  servers
If  is  work    fine,  deploy  to  the  rest  of  
the  servers
Docker  can  easily  help  to  achieve  some  deployment  paJerns  such  as  
canary	
  releasing  and  blue-­‐green	
  deployment
Ease Deployments w/ Docker
Canary Releasing Blue-Green Deployment
S1 S2 S2 S2
R R
S1 S1 S1 S1
S2 S2 S2 S2
Deploy  the  new  version  to  limited  
number  of  servers
Deploy  the  new  version  to  all  of  the  
servers  (or  provision  new  servers)
If  everything  is  OK,  then  switch  from  
router  to  new  servers
If  is  work    fine,  deploy  to  the  rest  of  
the  servers
Docker  can  easily  help  to  achieve  some  deployment  paJerns  such  as  
canary	
  releasing  and  blue-­‐green	
  deployment
MonitoringHow	
  we	
  are	
  doing	
  it
MonitoringHow	
  we	
  are	
  doing	
  it
Any	
  Container cAdvisor	
  Container	
  
to	
  collect	
  metrics
InfluxDB	
  container	
  as	
  a	
  
cAdvisor	
  Backend	
  
Storage	
  Driver
Monitoring	
  tool	
  uses	
  
InfluxDB	
  as	
  a	
  data	
  source
Reminder
IMMUTABLE INFRASTRUCTURE
FABRIC AND PUPPET
DOCKER
IMAGES AND CONTAINERS
RUNNING A CONTAINER
REMOVE A CONTAINER OR A IMAGE
HUB & REGISTRY
BUILDING AN IMAGE
DOCKERFILE
PRIVATE REGISTRY
PULLING AN IMAGE
OTHER COMMANDS
ORCHESTRATION
MACHINE
SWARM
COMPOSE
DOCKER TOOLBOX
MESOS + KUBERNETES
DEPLOYMENTS
MONITORING
Thanks..
Questions?

More Related Content

What's hot

zookeeperProgrammers
zookeeperProgrammerszookeeperProgrammers
zookeeperProgrammers
Hiroshi Ono
 

What's hot (20)

Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with DockerShip your Scala code often and easy with Docker
Ship your Scala code often and easy with Docker
 
Build Automation 101
Build Automation 101Build Automation 101
Build Automation 101
 
Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and Containers
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Australian OpenStack User Group August 2012: Chef for OpenStack
Australian OpenStack User Group August 2012: Chef for OpenStackAustralian OpenStack User Group August 2012: Chef for OpenStack
Australian OpenStack User Group August 2012: Chef for OpenStack
 
IT Infrastructure Through The Public Network Challenges And Solutions
IT Infrastructure Through The Public Network   Challenges And SolutionsIT Infrastructure Through The Public Network   Challenges And Solutions
IT Infrastructure Through The Public Network Challenges And Solutions
 
Islands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof NetworksIslands: Puppet at Bulletproof Networks
Islands: Puppet at Bulletproof Networks
 
Guide to Node.js: Basic to Advanced
Guide to Node.js: Basic to AdvancedGuide to Node.js: Basic to Advanced
Guide to Node.js: Basic to Advanced
 
Fixing Growing Pains With Puppet Data Patterns
Fixing Growing Pains With Puppet Data PatternsFixing Growing Pains With Puppet Data Patterns
Fixing Growing Pains With Puppet Data Patterns
 
Kubernetes Boston — Custom High Availability of Kubernetes
Kubernetes Boston — Custom High Availability of KubernetesKubernetes Boston — Custom High Availability of Kubernetes
Kubernetes Boston — Custom High Availability of Kubernetes
 
Automated Java Deployments With Rpm
Automated Java Deployments With RpmAutomated Java Deployments With Rpm
Automated Java Deployments With Rpm
 
Intro to Docker for (Rails) Developers
Intro to Docker for (Rails) DevelopersIntro to Docker for (Rails) Developers
Intro to Docker for (Rails) Developers
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
Astricon 2017 Superpower of deployment tools
Astricon 2017 Superpower of deployment toolsAstricon 2017 Superpower of deployment tools
Astricon 2017 Superpower of deployment tools
 
Zookeeper Introduce
Zookeeper IntroduceZookeeper Introduce
Zookeeper Introduce
 
MySQL on AWS 101
MySQL on AWS 101MySQL on AWS 101
MySQL on AWS 101
 
Herd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration managementHerd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration management
 
zookeeperProgrammers
zookeeperProgrammerszookeeperProgrammers
zookeeperProgrammers
 

Viewers also liked

Docker Compose by Aanand Prasad
Docker Compose by Aanand Prasad Docker Compose by Aanand Prasad
Docker Compose by Aanand Prasad
Docker, Inc.
 

Viewers also liked (8)

Software Development Whats & Whys
Software Development Whats & Whys Software Development Whats & Whys
Software Development Whats & Whys
 
Webrazzi Online: Code - GittiGidiyor’a Teknik Bakış 2016
Webrazzi Online: Code - GittiGidiyor’a Teknik Bakış 2016Webrazzi Online: Code - GittiGidiyor’a Teknik Bakış 2016
Webrazzi Online: Code - GittiGidiyor’a Teknik Bakış 2016
 
Introduction to Mongodb
Introduction to MongodbIntroduction to Mongodb
Introduction to Mongodb
 
Lesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at ProntoLesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at Pronto
 
Microservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-dockerMicroservices blue-green-deployment-with-docker
Microservices blue-green-deployment-with-docker
 
Introduction to docker and docker compose
Introduction to docker and docker composeIntroduction to docker and docker compose
Introduction to docker and docker compose
 
Docker Compose by Aanand Prasad
Docker Compose by Aanand Prasad Docker Compose by Aanand Prasad
Docker Compose by Aanand Prasad
 
Docker 101 - Nov 2016
Docker 101 - Nov 2016Docker 101 - Nov 2016
Docker 101 - Nov 2016
 

Similar to Introduction to Docker

Thinking Inside the Container: A Continuous Delivery Story by Maxfield Stewart
Thinking Inside the Container: A Continuous Delivery Story by Maxfield Stewart Thinking Inside the Container: A Continuous Delivery Story by Maxfield Stewart
Thinking Inside the Container: A Continuous Delivery Story by Maxfield Stewart
Docker, Inc.
 
Shipping python project by docker
Shipping python project by dockerShipping python project by docker
Shipping python project by docker
Wei-Ting Kuo
 
AWS와 Docker Swarm을 이용한 쉽고 빠른 컨테이너 오케스트레이션 - AWS Summit Seoul 2017
AWS와 Docker Swarm을 이용한 쉽고 빠른 컨테이너 오케스트레이션 - AWS Summit Seoul 2017AWS와 Docker Swarm을 이용한 쉽고 빠른 컨테이너 오케스트레이션 - AWS Summit Seoul 2017
AWS와 Docker Swarm을 이용한 쉽고 빠른 컨테이너 오케스트레이션 - AWS Summit Seoul 2017
Amazon Web Services Korea
 

Similar to Introduction to Docker (20)

Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨
 
A Hands-on Introduction to Docker
A Hands-on Introduction to DockerA Hands-on Introduction to Docker
A Hands-on Introduction to Docker
 
Docker Demo @ IuK Seminar
Docker Demo @ IuK SeminarDocker Demo @ IuK Seminar
Docker Demo @ IuK Seminar
 
Docker orchestration v4
Docker orchestration v4Docker orchestration v4
Docker orchestration v4
 
Docker orchestration
Docker orchestrationDocker orchestration
Docker orchestration
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
.NET Developer Days - So many Docker platforms, so little time...
.NET Developer Days - So many Docker platforms, so little time....NET Developer Days - So many Docker platforms, so little time...
.NET Developer Days - So many Docker platforms, so little time...
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
 
Docker, the Future of DevOps
Docker, the Future of DevOpsDocker, the Future of DevOps
Docker, the Future of DevOps
 
Docker as an every day work tool
Docker as an every day work toolDocker as an every day work tool
Docker as an every day work tool
 
Nats meetup oct 2016 docker 112
Nats meetup oct 2016 docker 112Nats meetup oct 2016 docker 112
Nats meetup oct 2016 docker 112
 
What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16
What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16 What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16
What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16
 
Thinking Inside the Container: A Continuous Delivery Story by Maxfield Stewart
Thinking Inside the Container: A Continuous Delivery Story by Maxfield Stewart Thinking Inside the Container: A Continuous Delivery Story by Maxfield Stewart
Thinking Inside the Container: A Continuous Delivery Story by Maxfield Stewart
 
Shipping python project by docker
Shipping python project by dockerShipping python project by docker
Shipping python project by docker
 
Check the version with fixes. Link in description
Check the version with fixes. Link in descriptionCheck the version with fixes. Link in description
Check the version with fixes. Link in description
 
AWS와 Docker Swarm을 이용한 쉽고 빠른 컨테이너 오케스트레이션 - AWS Summit Seoul 2017
AWS와 Docker Swarm을 이용한 쉽고 빠른 컨테이너 오케스트레이션 - AWS Summit Seoul 2017AWS와 Docker Swarm을 이용한 쉽고 빠른 컨테이너 오케스트레이션 - AWS Summit Seoul 2017
AWS와 Docker Swarm을 이용한 쉽고 빠른 컨테이너 오케스트레이션 - AWS Summit Seoul 2017
 
MySQL on Docker - Containerizing the Dolphin
MySQL on Docker - Containerizing the DolphinMySQL on Docker - Containerizing the Dolphin
MySQL on Docker - Containerizing the Dolphin
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Streamline your development environment with docker
Streamline your development environment with dockerStreamline your development environment with docker
Streamline your development environment with docker
 

More from Harun Yardımcı (7)

"It Works On My Machine" Problem
"It Works On My Machine" Problem"It Works On My Machine" Problem
"It Works On My Machine" Problem
 
What you don't learn in the school
What you don't learn in the schoolWhat you don't learn in the school
What you don't learn in the school
 
CFEX 2014 - DAU
CFEX 2014 - DAUCFEX 2014 - DAU
CFEX 2014 - DAU
 
Scalability at Gittigidiyor
Scalability at GittigidiyorScalability at Gittigidiyor
Scalability at Gittigidiyor
 
Gittigidiyor.com'da Acik Kaynak Uygulamalar
Gittigidiyor.com'da Acik Kaynak UygulamalarGittigidiyor.com'da Acik Kaynak Uygulamalar
Gittigidiyor.com'da Acik Kaynak Uygulamalar
 
Git Branching Model
Git Branching ModelGit Branching Model
Git Branching Model
 
Mongodb workshop
Mongodb workshopMongodb workshop
Mongodb workshop
 

Recently uploaded

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Recently uploaded (20)

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 

Introduction to Docker

  • 2. Harun Yardımcı h_yardimci /in/harunyardimci harun.yardimci@gmail.com 40.990022, 29.107436 hyardimci@ebay.com https://about.me/harun.yardimci
  • 3. AGENDA ~ 1 HOUR IMMUTABLE INFRASTRUCTURE DOCKER IMAGES AND CONTAINERS HUB & REGISTRY BUILD & PULL ORCHESTRATION MACHINE SWARM COMPOSE DEPLOYMENTS MONITORING
  • 4. “I know the solution is Docker, but I am not sure of the problem.” Immutable Infrastructure Deployments Environment Inconsistency Developer Onboarding Resources Isolation Security Fast Shipment Quickly Scale
  • 5. Immutable  Servers  are  like  Legos:  rebuild  and   replace  instead  of  repairing  them.
  • 6. OS v1 App v1 OS v1 App v1 ac)veac)ve OS v1 App v2 ac)ve OS v1 App v1 inac)ve OS v1 App v2 ac)ve OS v2 App v2 ac)ve OS v1 App v2 inac)ve OS v2 App v2 ac)ve OS v1 App v1 inac)ve Patch   Applica)on Patch  OS Build ImmutableMutable Inac)ve  once  will  be  dropped.
  • 7.
  • 8. &
  • 10. Meet the Moby Dock Yes!     This  whale  has  a  name. Open  pla(orm  for  building,  shipping  and   running  distributed  applica5ons. What  is  Docker? Ship  Faster  and  Easier   Applica5on  Portability   Infrastructure  Flexibility   Scalable How  it  will  help?
  • 11. VMs are the same! Virtual  Machine Container not ^
  • 14. & +
  • 15. Next couple of slides contains bash commands and terminal outputs. There is no need to read them all.    _      _  _____  ____    ____                _        _          _____  ____  _____  _      |    |  |  ____|    _  |    _              /      |  |      |  ____|    _  _      _|  |    |    |  |    _|  |  |_)  |  |  |  |        /  _    |  |      |    _|  |  |_)  ||  |  |  |    |  |    |  |___|    _  <|  |_|  |      /  ___  |  |___|  |___|    _  <  |  |  |_|    |_|  _|_____|_|  _____/      /_/      ______|_____|_|  _|_|  (_)    _      _  _____  ____    ____                _        _          _____  ____  _____  _      |    |  |  ____|    _  |    _              /      |  |      |  ____|    _  _      _|  |    |    |  |    _|  |  |_)  |  |  |  |        /  _    |  |      |    _|  |  |_)  ||  |  |  |    |  |    |  |___|    _  <|  |_|  |      /  ___  |  |___|  |___|    _  <  |  |  |_|    |_|  _|_____|_|  _____/      /_/      ______|_____|_|  _|_|  (_)
  • 17. Images and Containers [root@localhost01  ~]#  docker  images   REPOSITORY                                                                                  TAG                                    IMAGE  ID                                  CREATED                          VIRTUAL  SIZE   my-­‐registry.net:5000/gg-­‐jenkins            1.609.2                        45d86b4e7cb2                5  days  ago                      1.036  GB   my-­‐registry.net:5000/gg-­‐ac5vemq      5.11.1                            ea995e1e0547                11  days  ago                  917.8  MB   my-­‐registry.net:5000/gg-­‐ac5vemq      latest                              ea995e1e0547                11  days  ago                  917.8  MB   harunyardimci/ac5vemq                                        latest                              ea995e1e0547                11  days  ago                  917.8  MB   harunyardimci/ac5vemq                                        5.11.1                            ea995e1e0547                11  days  ago                  917.8  MB   jenkins                                                                                                    1.625.1                          0c79d0a394dc                3  weeks  ago                887.9  MB [root@localhost01  ~]#  docker  ps   CONTAINER  ID                IMAGE                              COMMAND                          CREATED                          STATUS                            PORTS                              NAMES List  of  Running  Containers List  of  Images
  • 18. Run a Container docker              run              jenkins run  =  start [root@localhost01  ~]#  docker  ps   CONTAINER  ID                IMAGE                                  COMMAND                                          CREATED                  STATUS                                PORTS                    NAMES   327a0bcc9fda                jenkins:latest          “sh  /usr/java/start.sh”      3  days  ago            Up  2  seconds          5000/tcp            berserk_wozniak } Name  of  the  image  to   load  into  container } will  be  some  parameters docker      stop      327a0bcc9fda   docker      start      327a0bcc9fda We  could  use   this  name  here
  • 19. Run a Container docker  run  -­‐i  -­‐t  -­‐d              -­‐-­‐name  my-­‐jenkins-­‐master              -­‐p  8080:5000                  jenkins:1.625.1 run  =  start [root@localhost01  ~]#  docker  ps   CONTAINER  ID                IMAGE                                      COMMAND                                          CREATED                  STATUS                                PORTS                                                                          NAMES   327a0bcc9fda                jenkins:1.625.1      “sh  /usr/java/start.sh”      2  days  ago            Up  2  seconds          0.0.0.0:8080-­‐>5000/tcp            my-­‐jenkins-­‐master docker      stop      my-­‐jenkins-­‐master   docker      start      my-­‐jenkins-­‐master
  • 20. Remove Container & Image [root@localhost01  ~]#  docker  ps   CONTAINER  ID                IMAGE                                      COMMAND                                          CREATED                  STATUS                                PORTS                                                                          NAMES   327a0bcc9fda                jenkins:1.6.25.1      “sh  /usr/java/start.sh”      2  days  ago            Up  2  seconds          0.0.0.0:8080-­‐>5000/tcp            my-­‐jenkins-­‐master [root@localhost01  ~]#  docker  images   REPOSITORY                                                                                  TAG                                    IMAGE  ID                                  CREATED                          VIRTUAL  SIZE   my-­‐registry.net:5000/gg-­‐jenkins            1.609.2                        45d86b4e7cb2                5  days  ago                      1.036  GB   my-­‐registry.net:5000/gg-­‐ac5vemq      5.11.1                            ea995e1e0547                11  days  ago                  917.8  MB   my-­‐registry.net:5000/gg-­‐ac5vemq      latest                              ea995e1e0547                11  days  ago                  917.8  MB   harunyardimci/ac5vemq                                        latest                              ea995e1e0547                11  days  ago                  917.8  MB   harunyardimci/ac5vemq                                        5.11.1                            ea995e1e0547                11  days  ago                  917.8  MB   jenkins                                                                                                    1.625.1                          0c79d0a394dc                3  weeks  ago                887.9  MB docker    rmi    jenkins   docker    rmi    0c79d0a394dc   docker  rmi              `docker  images              -­‐q  -­‐f  "dangling=true"` docker    rm    my-­‐jenkins-­‐master   docker    rm    327a0bcc9fda   docker  rm  `docker  ps  -­‐aq` docker  rm docker  rmi
  • 21. Where can I find an Image    -­‐  download  exis)ng   -­‐  build  your  own hkps://hub.docker.com/ • GitHub  or  BitBucket  Integra5on   • Automated  Build   • Web  Hooks   • Public  and  Private  Repos   • Lots  of  official  Images Docker  Hub
  • 22. Where can I find an Image Dockerfile    -­‐  download  exis5ng   -­‐  build  your  own #  comment   INSTRUCTION  arguments FROM   sets  the  Base  Image  for  subsequent  instruc5ons RUN will  execute  any  commands  in  a  new  layer  on  top  of  the  current  image  and  commit  the  results CMD provide  defaults  for  an  execu5ng  container ENTRYPOINT allows  you  to  configure  a  container  that  will  run  as  an  executable EXPOSE will  listen  on  the  specified  network  ports  at  run5me ENV sets  the  environment  variable  <key>  to  the  value  <value> ADD copies  new  files,  directories  or  remote  file  URLs  and  adds  them  to  the  filesystem  of  container COPY copies  new  files  or  directories  and  adds  them  to  the  filesystem  of  the  container VOLUME creates  a  mount  point  with  the  specified  name USER   sets  the  user  name  or  UID  to  use  when  running  the  image  and  for  any  instruc5ons
  • 23. Dockerfile Example #  Node.js  Example   #  Image  will  be  based  on  Centos6   FROM    centos:centos6   #  Enable  EPEL  for  Node.js   RUN    rpm  -­‐Uvh  hkp://download.fedoraproject.org/pub/epel/6/i386/ epel-­‐release-­‐6-­‐8.noarch.rpm   #  Install  Node.js  and  npm   RUN    yum  install  -­‐y  npm   #  Bundle  app  source   COPY  .  /src   #  Install  app  dependencies   RUN  cd  /src;  npm  install   #  Map  the  port  8080   EXPOSE    8080   #  Start  the  app   CMD  ["node",  "/src/index.js"] package.json {      "name":  "docker-­‐centos-­‐hello",      "private":  true,      "version":  "0.0.1",      "descrip)on":  "Node.js  Hello  world  using  docker",        "dependencies":  {              "express":  "3.2.4"      }   } var  express  =  require('express');   //  Constants   var  PORT  =  8080;   //  App   var  app  =  express();   app.get('/',  func)on  (req,  res)  {          res.send('Hello  worldn');   });   app.listen(PORT);   console.log('Running  on  hnp://localhost:'  +  PORT); index.js Dockerfile
  • 24. Build The Image[root@localhost01  ~]#  docker  build  -­‐t  gg-­‐node-­‐example  .   Sending  build  context  to  Docker  daemon  200.2  kB   Sending  build  context  to  Docker  daemon   Step  0  :  FROM  centos:centos6   Pulling  repository  centos   a005304e4e74:  Download  complete   ….  spin  ….   Status:  Downloaded  newer  image  for  centos:centos6    -­‐-­‐-­‐>  a005304e4e74   Step  1  :  RUN  rpm  -­‐Uvh  hkp://download.fedoraproject.org/pub/epel/6/i386/epel-­‐release-­‐6-­‐8.noarch.rpm    -­‐-­‐-­‐>  Running  in  bf9df3009d99   Retrieving  hkp://download.fedoraproject.org/pub/epel/6/i386/epel-­‐release-­‐6-­‐8.noarch.rpm    -­‐-­‐-­‐>  e3cef724d749   Removing  intermediate  container  bf9df3009d99   Step  2  :  RUN  yum  install  -­‐y  npm    -­‐-­‐-­‐>  Running  in  53833526eb72   Setng  up  Install  Process   Resolving  Dependencies   Complete!    -­‐-­‐-­‐>  c2f62ff5335d   Removing  intermediate  container  53833526eb72   Step  3  :  COPY  .  /src    -­‐-­‐-­‐>  865de2a7ad61   Removing  intermediate  container  e837a9c1038d   Step  4  :  RUN  cd  /src;  npm  install    -­‐-­‐-­‐>  Running  in  7898163aaa6b   ….  spin  ….   Step  5  :  EXPOSE  8080    -­‐-­‐-­‐>  Running  in  86560a6429a6    -­‐-­‐-­‐>  82d48b2e1d36   Removing  intermediate  container  86560a6429a6   Step  6  :  CMD  node  /src/index.js    -­‐-­‐-­‐>  Running  in  67e03c4ee83e    -­‐-­‐-­‐>  41c16d218d70   Removing  intermediate  container  67e03c4ee83e   Successfully  built  41c16d218d70
  • 25. Build The Image [root@localhost01  ~]#  docker  images   REPOSITORY                                                                                  TAG                                    IMAGE  ID                                  CREATED                          VIRTUAL  SIZE   centos                                                                                                        centos6                    539c0211cd76                5  seconds  ago          203.1  MB   gg-­‐node-­‐example                                                                  latest                            d64d3505b0d2              2  hours  ago                  539.3  MB Second  Time [root@localhost01  ~]#  docker  build  -­‐t  gg-­‐node-­‐example  .   Sending  build  context  to  Docker  daemon  202.2  kB   Sending  build  context  to  Docker  daemon   Step  0  :  FROM  centos:centos6    -­‐-­‐-­‐>  a005304e4e74   Step  1  :  RUN  rpm  -­‐Uvh  hkp://download.fedoraproject.org/pub/epel/6/i386/epel-­‐release-­‐6-­‐8.noarch.rpm    -­‐-­‐-­‐>  Using  cache    -­‐-­‐-­‐>  e3cef724d749   Step  2  :  RUN  yum  install  -­‐y  npm    -­‐-­‐-­‐>  Using  cache    -­‐-­‐-­‐>  c2f62ff5335d   Step  3  :  COPY  .  /src    -­‐-­‐-­‐>  31caf3a92acb   Removing  intermediate  container  db10d432aa91   Step  4  :  RUN  cd  /src;  npm  install    -­‐-­‐-­‐>  Running  in  9d4wd824d6b   Step  5  :  EXPOSE  8080    -­‐-­‐-­‐>  Running  in  86560a6429a6    -­‐-­‐-­‐>  82d48b2e1d36   Removing  intermediate  container  86560a6429a6   Step  6  :  CMD  node  /src/index.js    -­‐-­‐-­‐>  Running  in  67e03c4ee83e    -­‐-­‐-­‐>  41c16d218d70   Removing  intermediate  container  67e03c4ee83e   Successfully  built  41c16d218d70
  • 26. Hub and Registry [root@localhost01  ~]#  docker  push  harunyardimci/ac)vemq   The  push  refers  to  a  repository  [harunyardimci/ac5vemq]  (len:  1)   ea995e1e0547:  Image  push  failed   Please  login  prior  to  push:   Username:  harunyardimci   Password:   Email:  email@myemail.com   WARNING:  login  creden5als  saved  in  /root/.docker/config.json   Login  Succeeded   The  push  refers  to  a  repository  [harunyardimci/ac5vemq]  (len:  1)   ea995e1e0547:  Image  already  exists   a01e3f658b16:  Image  already  exists   8209bd534a23:  Image  successfully  pushed   61abcd2c1997:  Image  successfully  pushed   47271e138907:  Image  already  exists   9d39128059aa:  Image  successfully  pushed   ad6b675a1518:  Image  already  exists   49d630d58a4b:  Image  successfully  pushed   b4cb24b0365b:  Image  already  exists   49ebfec495e1:  Image  successfully  pushed   bw63b0f4db1:  Image  successfully  pushed   2262501f7b5a:  Image  already  exists   a594f78c2a03:  Image  successfully  pushed   682b997ad926:  Image  successfully  pushed   607e965985c1:  Image  successfully  pushed   1ff9f26f09w:  Image  successfully  pushed   9a61b6b1315e:  Image  already  exists   902b87aaaec9:  Image  successfully  pushed   Digest:  sha256:349339cbb0d44af01b2822efede02df3f377f6fce774489dba2266847a193416
  • 27. Private Registryour own Commit  and  Push   Changes  as  Normal Build  the  Code   and  Create  Docker   Image  with  a  New   Tag  (Version) Pull  Changes Push  Image Store  Docker  Images
  • 29. Pull an Image [root@localhost01  ~]#  docker  pull  my-­‐registry.net:5000/ac)vemq [root@localhost01  ~]#  docker  pull  harunyardimci/ac)vemq Pull  From  Docker  Hub Pull  From  Private  Registry Use  your  username  in  docker  hub   Use  private  registry  hostname  and   port  (and  username  if   authen5ca5on  enabled)  
  • 30. Pull an Image [root@localhost01  ~]#  docker  pull  ubuntu   Pulling  repository  ubuntu   b7de3133ff98:  Pulling  dependent  layers   5cc9e91966f7:  Pulling  fs  layer   511136ea3c5a:  Download  complete   ef52w1fe610:  Download  complete   f5f2fe7ac31e:  Download  complete   be55w7f26a5:  Download  complete   3f42f9df3610:  Download  complete   .  .  .   Status:  Downloaded  newer  image  for  ubuntu  
  • 31. Other Commands commit   cp   create   exec   export   import   info   inspect   logs   port   push   stats   tag   top
  • 33. Docker Machine beta allows  you  to  provision  Docker  on   virtual  machines  that  reside  either  on   your  local  system  or  on  a  cloud  provider $  docker-­‐machine  create  -­‐d  virtualbox  dev $  docker-­‐machine  create  -­‐d  digitalocean  -­‐-­‐digitalocean-­‐ access-­‐token=secret AWS,  Digital  Ocean,  Google  Cloud  Pla(orm,  IBM  So|layer,  Microso|  Azure   and  Hyper-­‐V,  OpenStack,  Rackspace,  VirtualBox,  VMware  Fusion®,  vCloud®   Air™  and  vSphere®
  • 34. Docker Machine beta $  docker-­‐machine  ls   NAME            ACTIVE      DRIVER              STATE          URL                                                  SWARM   default                    virtualbox      Stopped   dev-­‐env                  virtualbox      Running      tcp://192.168.99.100:2376   dev2                            digitalocean      Stopped $  docker-­‐machine  start  dev-­‐env   Star5ng  VM...   Started  machines  may  have  new  IP  addresses.  You  may  need  to  re-­‐run  the  `docker-­‐machine  env`  command. $  docker-­‐machine  env  dev-­‐env   export  DOCKER_TLS_VERIFY="1"   export  DOCKER_HOST="tcp://192.168.99.100:2376"   export  DOCKER_CERT_PATH="/Users/hyardimci/.docker/machine/machines/dev"   export  DOCKER_MACHINE_NAME=“dev-­‐env"   #  Run  this  command  to  configure  your  shell:   #  eval  "$(docker-­‐machine  env  dev-­‐env)” or  you  can  use  Docker  Quick  Start  Terminal
  • 35. Docker Machine beta or  you  can  use  Docker  Quick  Start  Terminal
  • 36. Docker Swarm beta allows  you  create  and  access  to  a  pool   of  Docker  hosts  using  the  full  suite  of   Docker  tools $  docker  run  swarm  create $  docker  run  -­‐d  swarm  join  -­‐-­‐addr=<node_ip:2375>  token:// cluster_id> docker  run  -­‐d  -­‐p  <swarm_port>:2375  swarm  manage   token://<cluster_id>
  • 37. Docker Compose beta is  a  tool  for  defining  and  running  mul5-­‐ container  applica5ons  with  Docker.   WORKDIR  /code   ADD  requirements.txt  /code/   RUN  pip  install  -­‐r  requirements.txt   ADD  .  /code   CMD  python  app.py web:          build:  .          links:          -­‐  db          ports:          -­‐  "8000:8000"   db:          image:  postgres $  docker-­‐compose  up Dockerfile compose.yml
  • 38. • Docker  Client   • Docker  Machine   • Docker  Compose  (Mac  only)   • Docker  Kitema5c   • VirtualBox Docker Toolbox
  • 39. There  are  lots  of  more  tools.. CentOS   Atomic   Consul   Terraform     Serf   Cloudify   Helios   too  many  of  them  are  available..  
  • 40. Ease Deployments w/ Docker Canary Releasing Blue-Green Deployment S1 S1 S1 S1 R R S1 S1 S1 S1 S2 S2 S2 S2 Deploy  the  new  version  to  limited   number  of  servers Deploy  the  new  version  to  all  of  the   servers  (or  provision  new  servers) If  everything  is  OK,  then  switch  from   router  to  new  servers If  is  work    fine,  deploy  to  the  rest  of   the  servers Docker  can  easily  help  to  achieve  some  deployment  paJerns  such  as   canary  releasing  and  blue-­‐green  deployment
  • 41. Ease Deployments w/ Docker Canary Releasing Blue-Green Deployment S1 S2 S2 S2 R R S1 S1 S1 S1 S2 S2 S2 S2 Deploy  the  new  version  to  limited   number  of  servers Deploy  the  new  version  to  all  of  the   servers  (or  provision  new  servers) If  everything  is  OK,  then  switch  from   router  to  new  servers If  is  work    fine,  deploy  to  the  rest  of   the  servers Docker  can  easily  help  to  achieve  some  deployment  paJerns  such  as   canary  releasing  and  blue-­‐green  deployment
  • 42. MonitoringHow  we  are  doing  it
  • 43. MonitoringHow  we  are  doing  it Any  Container cAdvisor  Container   to  collect  metrics InfluxDB  container  as  a   cAdvisor  Backend   Storage  Driver Monitoring  tool  uses   InfluxDB  as  a  data  source
  • 44. Reminder IMMUTABLE INFRASTRUCTURE FABRIC AND PUPPET DOCKER IMAGES AND CONTAINERS RUNNING A CONTAINER REMOVE A CONTAINER OR A IMAGE HUB & REGISTRY BUILDING AN IMAGE DOCKERFILE PRIVATE REGISTRY PULLING AN IMAGE OTHER COMMANDS ORCHESTRATION MACHINE SWARM COMPOSE DOCKER TOOLBOX MESOS + KUBERNETES DEPLOYMENTS MONITORING