SlideShare uma empresa Scribd logo
1 de 27
-­ Abhishek Tomar	
  
Agenda
• Introduction	
  
• Docker	
  Components	
  
A. The	
  Docker	
  Client	
  and	
  Server	
  
B. Docker	
  Images	
  
C. Registries	
  
D. Docker	
  Containers	
  
• What	
  can	
  you	
  use	
  Docker	
  for?	
  
• Docker	
  Installation	
  
• Docker	
  User	
  Interface	
  
• Basic	
  Commands	
  
• Demo	
  
• Questions
Introduction	
  to	
  Docker
	
   	
  	
  	
  
	
   “Docker	
  is	
  an	
  open-­‐source	
  engine	
  that	
  automates	
  the	
  deployment	
  of	
  applications	
  into	
  	
  	
  	
  	
  	
  	
  
containers.	
  It	
  adds	
  an	
  application	
  deployment	
  engine	
  on	
  top	
  of	
  a	
  virtualised	
  container	
  
execution	
  environment.”	
  
	
   	
  	
  	
  
	
   It	
  was	
  written	
  by	
  the	
  team	
  at	
  Docker,	
  Inc	
  (formerly	
  dotCloud	
  Inc,	
  an	
  early	
  player	
  in	
  the	
  	
  	
  	
  	
  	
  	
  
Platform-­‐as-­‐a-­‐Service	
  (PAAS)	
  market),	
  and	
  released	
  by	
  them	
  under	
  the	
  Apache	
  2.0	
  
license.	
  
	
   	
  	
  	
  
Docker’s	
  Mission	
  is	
  to	
  provide
1. An	
  easy	
  and	
  lightweight	
  way	
  to	
  model	
  reality	
  	
  
	
   	
  	
   Docker	
  is	
  fast,	
  It	
  relies	
  on	
  copy-­‐on-­‐write	
  Model.	
  So,	
  that	
  making	
  changes	
  to	
  your	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  
application	
  is	
  also	
  incredibly	
  fast:	
  only	
  what	
  you	
  want	
  to	
  change	
  will	
  change.	
  	
  
2. A	
  logical	
  Segregation	
  of	
  Duties	
  
	
   	
  	
   With	
  Docker,	
  Developers	
  care	
  about	
  the	
  application	
  running	
  inside	
  the	
  containers,	
  and	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
   	
  
Operations	
  care	
  about	
  managing	
  the	
  containers.	
  
3. Fast,	
  efficient	
  development	
  life	
  cycle	
  
	
   	
  	
   Docker	
  aims	
  to	
  reduce	
  the	
  cycle	
  time	
  between	
  code	
  being	
  written	
  and	
  code	
  being	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  
tested,	
  deployed	
  and	
  used.	
  
4. Encourage	
  Service	
  Oriented	
  Architecture	
  
	
   	
  	
   Docker	
  encourage	
  service	
  oriented	
  architecture,	
  It	
  recommends	
  that	
  each	
  container	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  
run	
  a	
  single	
  application	
  or	
  Process.	
  
Docker	
  Components	
  :	
  The	
  Docker	
  Client	
  and	
  Server
Docker	
  is	
  a	
  client-­‐server	
  
application.	
  The	
  Docker	
  client	
  
talks	
  to	
  the	
  Docker	
  server	
  or	
  
daemon,	
  which,	
  in	
  turn,	
  does	
  
all	
  the	
  work.	
  Docker	
  ships	
  with	
  
a	
  command	
  line	
  client	
  binary,	
  
‘docker’(“it	
  is	
  a	
  single	
  binary,	
  
that	
  can	
  act	
  as	
  both	
  client	
  and	
  
server.	
  As	
  a	
  client,	
  it	
  passes	
  
request	
  to	
  the	
  Docker	
  daemon	
  
and	
  then	
  process	
  those	
  
requests	
  when	
  they	
  are	
  
returned.”)	
  as	
  well	
  as	
  a	
  full	
  
RESTful	
  API.
Docker	
  Components	
  :	
  Docker	
  Images
An	
  image	
  is	
  the	
  build	
  component	
  of	
  a	
  
container.	
  It	
  is	
  a	
  read-­‐only	
  template	
  from	
  
which	
  one	
  or	
  more	
  container	
  instances	
  
can	
  be	
  launched.	
  Conceptually,	
  it’s	
  
similar	
  to	
  an	
  AMI.	
  
For	
  downloading	
  a	
  image	
  from	
  public	
  
repo,	
  we	
  can	
  use	
  the	
  following	
  command	
  
:	
  
$docker pull ubuntu:12.10
7
Docker	
  Components	
  :	
  Docker	
  Images	
  
More	
  about	
  Docker	
  Images	
  :	
  
1. Docker	
  Images	
  stored	
  in	
  Docker	
  Hub	
  or	
  locally	
  
1. For	
  Docker	
  Hub	
  we	
  required	
  Docker	
  Hub	
  account	
  
2. Authenticating	
  Docker	
  	
  
Run	
  :	
  sudo docker login
This will create the $HOME/.dockercfg file.	
  
2. We	
  can	
  build	
  our	
  own	
  Images	
  
1.docker commit (This method is currently not recommended.)
2. docker build	
  With	
  a	
  Dockerfile
8
Docker	
  Components	
  :	
  Docker	
  Images	
  :	
  Dockerfile
Dockerfile	
  :	
  Dockerfile	
  uses	
  a	
  basic	
  DSL	
  with	
  instructions	
  for	
  building	
  Docker	
  
images.	
  
Sample	
  Dockerfile:	
  
# Version: 0.0.1
FROM ubuntu:14.04
MAINTAINER Abhishek Tomar “abhish.tomar@gmail.com”
RUN apt-get update
RUN apt-get install -y nginx
RUN echo ‘Hi, I am in your container’ > /usr/share/nginx/html/
index.html
EXPOSE 80
9
Docker	
  Components	
  :	
  Docker	
  Images	
  :	
  Dockerfile
Now	
  Docker	
  Execung	
  instrucon	
  workflow	
  :	
  
• Docker	
  runs	
  a	
  container	
  from	
  the	
  image.	
  
• An	
  instrucon	
  executes	
  and	
  makes	
  a	
  change	
  to	
  the	
  container.	
  
• Docker	
  runs	
  the	
  equivalent	
  of	
  “docker	
  commit”	
  to	
  commit	
  a	
  new	
  layer.	
  
• Docker	
  then	
  runs	
  a	
  new	
  container	
  from	
  this	
  new	
  image.	
  
• The	
  next	
  instrucon	
  in	
  the	
  file	
  is	
  executed,	
  and	
  the	
  process	
  repeats	
  unl	
  all	
  instrucons	
  
have	
  been	
  executed.	
  
Few	
  Commands	
  	
  :	
  
1. For	
  running	
  the	
  docker	
  with	
  docker	
  file	
  :	
  	
  
$ docker build .
1. Checking	
  the	
  history	
  :	
  
$ docker history <containeranme>
10
Docker	
  Components	
  :	
  Registries
	
   Registries	
  are	
  used	
  to	
  store	
  images.	
  Registries	
  can	
  be	
  local	
  or	
  remote.	
  When	
  
we	
  launch	
  a	
  container,	
  Docker	
  first	
  searches	
  the	
  local	
  registry	
  for	
  the	
  image.	
  If	
  it’s	
  
not	
  found	
  locally,	
  then	
  it	
  searches	
  a	
  public	
  remote	
  registry,	
  called	
  DockerHub.	
  If	
  
the	
  image	
  is	
  there,	
  Docker	
  downloads	
  it	
  to	
  the	
  local	
  registry	
  and	
  and	
  uses	
  it	
  to	
  
launch	
  the	
  container.	
  DockerHub	
  is	
  similar	
  to	
  Github,	
  in	
  that	
  we	
  can	
  create	
  both	
  
public	
  and	
  private	
  image	
  repositories.	
  This	
  makes	
  it	
  easy	
  to	
  distribute	
  images	
  
efficiently	
  and	
  securely.	
  
“Images live inside the repositories and repository lives on registry.”
Docker	
  Components	
  :	
  Containers
Containers	
  are	
  not	
  VM’s	
  :	
  Unlike	
  hypervisor	
  virtualization,	
  where	
  one	
  or	
  more	
  independent	
  
machines	
  run	
  virtually	
  on	
  physical	
  hardware	
  via	
  an	
  intermediation	
  layer,	
  containers	
  instead	
  
run	
  user	
  space	
  on	
  top	
  of	
  an	
  operating	
  system's	
  kernel.	
  
They	
  can	
  generally	
  only	
  run	
  the	
  same	
  or	
  a	
  similar	
  guest	
  operating	
  system	
  as	
  the	
  underlying	
  
hosts.	
  
And	
  a	
  Docker	
  Container	
  is	
  …	
  
1. An	
  Image	
  Format	
  
2. A	
  Set	
  of	
  standard	
  operations	
  
3. An	
  execution	
  environment	
  
What	
  can	
  you	
  use	
  Docker	
  for?
?
What	
  can	
  you	
  use	
  Docker	
  for?
Some	
  Small	
  Use	
  Cases:	
  
1. I	
  need	
  to	
  see	
  the	
  man	
  page	
  from	
  a	
  specific	
  version	
  of	
  RHEL,	
  CentOS	
  or	
  Fedora	
  
2. I	
  need	
  to	
  quickly	
  verify	
  the	
  command	
  line	
  options	
  of	
  a	
  program	
  
3. I	
  need	
  to	
  test	
  the	
  functionality	
  of	
  a	
  specific	
  version	
  of	
  software	
  
4. I	
  need	
  a	
  scratch	
  pad	
  that	
  is	
  NOT	
  my	
  system	
  
5. I	
  need	
  a	
  single	
  daemon	
  running,	
  and	
  I	
  don’t	
  care	
  what	
  distribution	
  of	
  Linux	
  it	
  runs	
  on	
  
(see	
  registry	
  below)
What	
  can	
  you	
  use	
  Docker	
  for?
Some	
  more	
  use	
  Cases	
  :	
  
1. Making	
  your	
  local	
  development	
  and	
  build	
  workflow	
  faster.	
  
2. Using	
  Docker	
  to	
  create	
  isolated	
  instances	
  to	
  run	
  tests.	
  
3. Building	
  a	
  multi-­‐user	
  Platform-­‐as-­‐a-­‐service(PAAS)	
  infrastructure.	
  
15
Docker	
  Installation
Requirements:	
  
1. Be	
  running	
  a	
  64-­‐bit	
  architecture	
  ($sudo	
  uname	
  -­‐a)	
  
2. Kernel	
  version	
  3.8	
  or	
  later	
  ($sudo	
  uname	
  -­‐a)	
  
3. Kernel	
  must	
  support	
  an	
  appropriate	
  storage	
  drive	
  ($sudo	
  grep	
  ‘device-­‐mapper’	
  /proc/
devices)	
  
4. cgroups	
  and	
  namespaces	
  kernel	
  features	
  must	
  be	
  supported	
  and	
  enabled.	
  
5. Check	
  curl	
  is	
  installed	
  or	
  not	
  ($which	
  curl)	
  
16
Docker	
  Installation	
  Cont.
#UpdaPng	
  the	
  ubuntu	
  
$ sudo apt-get update & apt-get upgrade
#	
  Installing	
  latest	
  version	
  of	
  Docker	
  
$ curl -sSL https://get.docker.io/ubuntu/ | sudo sh
#	
  Check	
  Whether	
  Docker	
  is	
  running	
  or	
  not	
  
$ docker -info
#	
  Docker	
  configuraPon	
  file:	
  
“/etc/default/docker”
By	
  default	
  Docker	
  will	
  run	
  on	
  socket,	
  if	
  you	
  need	
  to	
  change	
  it	
  to	
  ip	
  then	
  We	
  will	
  have	
  to	
  
change	
  the	
  DOCKER_OPTS	
  variable	
  in	
  configuraon	
  file.	
  
e.g.
DOCKER_OPTS="--host tcp://0.0.0.0:2375 -H unix://var/run/
docker.sock”
1717
Docker	
  User	
  Interface
There	
  are	
  few	
  Docker	
  user	
  interfaces	
  and	
  web	
  console	
  available	
  in	
  various	
  states	
  of	
  
development,	
  Some	
  of	
  the	
  are	
  listed	
  below.	
  
1)	
  Shipyard	
  -­‐	
  It	
  gives	
  you	
  the	
  ability	
  to	
  manage	
  Docker	
  resources,	
  including	
  containers,	
  
images,	
  hosts,	
  and	
  more	
  from	
  a	
  single	
  management	
  interface.	
  
2)	
  DockerUI	
  -­‐	
  It	
  is	
  a	
  web	
  interface	
  that	
  allows	
  you	
  to	
  a	
  interact	
  with	
  the	
  Docker	
  Remote	
  API.	
  
It’s	
  written	
  in	
  JAVA	
  Script	
  using	
  the	
  AngularJS	
  framework.	
  
3)	
  maDocker	
  -­‐	
  A	
  web	
  UI	
  written	
  in	
  NodeJS	
  and	
  Backbone	
  (in	
  early	
  stages	
  of	
  development.)
1818
Basic	
  Commands
19
1)	
  Running	
  a	
  Nginx	
  web	
  server	
  in	
  docker	
  container,	
  and	
  Access	
  it	
  from	
  
outside.	
  
Dockerfile	
  :	
  
# Version: 0.0.1
FROM ubuntu:14.04
MAINTAINER Abhishek Tomar
“abhish.tomar@gmail.com”
RUN apt-get update
RUN apt-get install -y nginx
RUN echo ‘Hi, I am in your container’ > /usr/
share/nginx/html/index.html
EXPOSE 80
Demo	
  &	
  Understanding	
  Dockerfile.
20
More	
  options	
  in	
  Docker	
  file:	
  
1. CMD	
  :	
  	
  It’s	
  similar	
  to	
  RUN	
  instruction	
  but	
  rather	
  than	
  running	
  the	
  
command	
  when	
  the	
  container	
  is	
  being	
  built,	
  it	
  will	
  specify	
  the	
  command	
  
to	
  run	
  when	
  the	
  container	
  is	
  launched.	
  For	
  Example	
  :	
  
In	
  docker run	
  command	
  :	
  
$sudo run -i -t abhishektomar/webserver /bin/
true
In	
  Dockerfile:	
  
CMD [“/bin/true”]
2. ENTRYPOINT	
  :	
  It’s	
  similar	
  to	
  CMD	
  but	
  the	
  difference	
  is	
  CMD	
  command	
  
instruction	
  you	
  can	
  override	
  by	
  docker run	
  command	
  but	
  in	
  
ENTRYPOINT	
  any	
  argument	
  passed	
  to	
  docker run	
  command	
  will	
  be	
  
passed	
  as	
  argument	
  	
  to	
  ENTRYPOINT	
  Command.	
  	
  
ENTRYPOINT [“/usr/sbin/nginx”]
$sudo run -i -t abhishektomar/webserver -g
“daemonoff;”
Demo	
  &	
  Understanding	
  Dockerfile.
21
3. WORKDIR	
  :	
  The	
  WORKDIR	
  instruction	
  set	
  the	
  work	
  directory	
  for	
  the	
  
container	
  and	
  the	
  ENTRYPOINT	
  and/or	
  CMD	
  to	
  be	
  executed	
  when	
  a	
  
container	
  is	
  launched	
  from	
  an	
  image.	
  
WORKDIR /opt/tomcat-qa/conf
RUN source vars
WORKDIR /opt/tomcat-qa/bin
ENTRYPOINT startup.sh
4. ENV	
  :	
  The	
  ENV	
  instruction	
  is	
  used	
  to	
  set	
  environment	
  variables	
  during	
  
the	
  image	
  build	
  process.	
  
ENV JAVA_HOME /usr/lib/jvm/java-6-sun/bin
RUN service tomcat7 start
5. USER	
  :	
  The	
  USER	
  specifies	
  a	
  user	
  that	
  the	
  image	
  should	
  be	
  run	
  as;	
  for	
  
example	
  :	
  
USER nginx
USER user:group
Demo	
  &	
  Understanding	
  Dockerfile.
22
6. VOLUME	
  :	
  The	
  VOLUME	
  instruction	
  adds	
  volumes	
  to	
  any	
  container	
  
created	
  from	
  the	
  image.	
  
1. Volumes	
  can	
  be	
  shared	
  and	
  reused	
  between	
  containers.	
  
2. A	
  container	
  doesn't	
  have	
  to	
  be	
  running	
  to	
  share	
  its	
  volumes.	
  
3. Change	
  to	
  a	
  volume	
  are	
  made	
  directly.	
  
4. Changes	
  to	
  a	
  volume	
  will	
  not	
  be	
  included	
  when	
  you	
  update	
  
an	
  image.	
  
5. Volume	
  persist	
  until	
  no	
  containers	
  use	
  them.	
  
Using	
  VOLUME	
  instruction	
  :	
  
VOLUME [“/mnt”] # we can also specify multiple VOLUMES
VOLUME [“/mnt”, “/data”]
7. ADD	
  :	
  The	
  ADD	
  instruction	
  adds	
  files	
  and	
  	
  directories	
  from	
  our	
  
build	
  environment	
  into	
  our	
  images;	
  For	
  example,	
  
ADD software.lic /opt/application/software.lic
In	
  the	
  above	
  example, ADD	
  instruction	
  will	
  copy	
  the	
  file	
  
software.lic	
  from	
  the	
  build	
  directory	
  to /opt/application/
software.lic in	
  the	
  image.
Demo	
  &	
  Understanding	
  Dockerfile.
23
8. COPY	
  :	
  The	
  COPY	
  instruction	
  is	
  closely	
  related	
  to	
  the	
  ADD	
  
instruction.	
  The	
  key	
  difference	
  is	
  that	
  the	
  COPY	
  instruction	
  is	
  purely	
  
focused	
  on	
  copying	
  	
  local	
  files	
  from	
  the	
  build	
  context	
  and	
  does	
  not	
  
have	
  an	
  extraction	
  or	
  decompression	
  capabilities.	
  
COPY cont.d /etc/apache2/
9. ONBUILD	
  :	
  The	
  ONBUILD	
  instruction	
  adds	
  triggers	
  to	
  images.	
  A	
  
trigger	
  is	
  executed	
  when	
  the	
  image	
  is	
  used	
  as	
  the	
  basis	
  of	
  another	
  
image.	
  
Demo	
  &	
  Understanding	
  Dockerfile.
24
2.	
  Using	
  Some	
  Docker	
  instructions	
  :	
  
Dockerfile	
  :	
  
FROM ubuntu:14.04
MAINTAINER Abhishek Tomar
"abhishek.tomar@intelligrape.com"
RUN apt-get update
RUN apt-get install -y apache2
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOCK_DIR /var/run/
ENV APACHE_PID_FILE /var/run/apache
ENV APACHE_LOG_DIR /var/log/apache2
ONBUILD ADD . /var/www/
EXPOSE 80
ENTRYPOINT ["/usr/sbin/apache2"]
CMD ["-D", "FOREGROUND"]
Demo	
  &	
  Understanding	
  Dockerfile.
25
3.	
  Understanding	
  ONBUILD	
  instruction:	
  
Dockerfile	
  :	
  
FROM abhishek/apache-webserver
MAINTAINER Abhishek Tomar
"abhishek.tomar@intelligrape.com"
ENV APPLICATION_NAME webapp
ENV ENVIORNMENT development
Demo	
  &	
  Understanding	
  Dockerfile.
26
1.	
  You	
  can	
  only	
  specify	
  CMD	
  instrucon	
  once	
  in	
  the	
  Docker	
  files,	
  if	
  mulple	
  specified	
  last	
  one	
  is	
  used.	
  
2.	
  If	
  required	
  at	
  runme,	
  you	
  can	
  override	
  the	
  ENTRYPOINT	
  instrucon	
  using	
  the	
  docker	
  run	
  command	
  
with	
  —ENTRYPOINT	
  flag.	
  
3.	
  You	
  can	
  override	
  the	
  working	
  directory	
  at	
  runme	
  with	
  the	
  -­‐w	
  flag.	
  
4.	
  For	
  override	
  docker	
  env	
  you	
  can	
  use	
  -­‐e	
  flag.	
  
5.	
  At	
  runme	
  you	
  can	
  use	
  -­‐u	
  flag	
  to	
  override	
  the	
  user,	
  if	
  you	
  are	
  not	
  specifying	
  any	
  user	
  than	
  default	
  user	
  
would	
  be	
  root.	
  
6.	
  ADD	
  :	
  has	
  some	
  special	
  magic	
  for	
  taking	
  care	
  of	
  local	
  tar	
  archive	
  is	
  specified	
  as	
  the	
  source	
  file,	
  the	
  
Docker	
  will	
  automacally	
  unpack	
  it	
  for	
  you:	
  
ADD	
  lateste.tar.gz	
  /opt/latest/	
  
7.	
  COPY	
  :	
  The	
  source	
  of	
  the	
  files	
  must	
  be	
  the	
  path	
  to	
  a	
  file	
  or	
  directory	
  relave	
  to	
  the	
  build	
  context,	
  the	
  
local	
  source	
  directory	
  in	
  which	
  your	
  Dockerfile	
  resides.
Dockerfile	
  Tips	
  :
27
4.	
  We	
  will	
  be	
  creating	
  a	
  infrastructure	
  and	
  hosting	
  a	
  Wordpress	
  site	
  on	
  
Docker.	
  
—	
  Create	
  A	
  MySQL	
  Docker	
  Instance	
  
—	
  Create	
  A	
  Web	
  Server	
  Docker	
  Instance	
  
Demo	
  

Mais conteúdo relacionado

Mais procurados

Docker and the Container Ecosystem
Docker and the Container EcosystemDocker and the Container Ecosystem
Docker and the Container Ecosystempsconnolly
 
Containerization and Docker
Containerization and DockerContainerization and Docker
Containerization and DockerMegha Bansal
 
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...Simplilearn
 
docker installation and basics
docker installation and basicsdocker installation and basics
docker installation and basicsWalid Ashraf
 
Docker for developers
Docker for developersDocker for developers
Docker for developersandrzejsydor
 
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...Lucas Jellema
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerLuong Vo
 
Docker Understanding, What is Docker? Why Docker? How do I containerize somet...
Docker Understanding, What is Docker? Why Docker? How do I containerize somet...Docker Understanding, What is Docker? Why Docker? How do I containerize somet...
Docker Understanding, What is Docker? Why Docker? How do I containerize somet...Yogesh Wadile
 
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12dotCloud
 
Docker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken CochraneDocker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken CochranedotCloud
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshopRuncy Oommen
 
Devoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Devoxx France 2015 - The Docker Orchestration Ecosystem on AzureDevoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Devoxx France 2015 - The Docker Orchestration Ecosystem on AzurePatrick Chanezon
 

Mais procurados (20)

Docker, LinuX Container
Docker, LinuX ContainerDocker, LinuX Container
Docker, LinuX Container
 
Introduction To Docker
Introduction To  DockerIntroduction To  Docker
Introduction To Docker
 
Docker and the Container Ecosystem
Docker and the Container EcosystemDocker and the Container Ecosystem
Docker and the Container Ecosystem
 
Containerization and Docker
Containerization and DockerContainerization and Docker
Containerization and Docker
 
Dockerfile
Dockerfile Dockerfile
Dockerfile
 
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
 
Docker @ Atlogys
Docker @ AtlogysDocker @ Atlogys
Docker @ Atlogys
 
docker installation and basics
docker installation and basicsdocker installation and basics
docker installation and basics
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
 
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
Java Developer Intro to Environment Management with Vagrant, Puppet, and Dock...
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Docker
DockerDocker
Docker
 
Docker Understanding, What is Docker? Why Docker? How do I containerize somet...
Docker Understanding, What is Docker? Why Docker? How do I containerize somet...Docker Understanding, What is Docker? Why Docker? How do I containerize somet...
Docker Understanding, What is Docker? Why Docker? How do I containerize somet...
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
 
Docker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken CochraneDocker at Djangocon 2013 | Talk by Ken Cochrane
Docker at Djangocon 2013 | Talk by Ken Cochrane
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
 
Devoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Devoxx France 2015 - The Docker Orchestration Ecosystem on AzureDevoxx France 2015 - The Docker Orchestration Ecosystem on Azure
Devoxx France 2015 - The Docker Orchestration Ecosystem on Azure
 
Docker by Example - Quiz
Docker by Example - QuizDocker by Example - Quiz
Docker by Example - Quiz
 

Semelhante a Docker

Docker interview Questions-2.pdf
Docker interview Questions-2.pdfDocker interview Questions-2.pdf
Docker interview Questions-2.pdfYogeshwaran R
 
Docker on azure
Docker on azureDocker on azure
Docker on azureAnuraj P
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with DockerGeeta Vinnakota
 
Docker-Presentation.pptx
Docker-Presentation.pptxDocker-Presentation.pptx
Docker-Presentation.pptxVipobav
 
Docker interview Questions-1.pdf
Docker interview Questions-1.pdfDocker interview Questions-1.pdf
Docker interview Questions-1.pdfYogeshwaran R
 
Virtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesVirtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesabhishek chawla
 
Learning Dockers - Step by Step
Learning Dockers - Step by StepLearning Dockers - Step by Step
Learning Dockers - Step by StepAdnan Siddiqi
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)Gourav Varma
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)Kalkey
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)Gourav Varma
 
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...Puppet
 

Semelhante a Docker (20)

Docker interview Questions-2.pdf
Docker interview Questions-2.pdfDocker interview Questions-2.pdf
Docker interview Questions-2.pdf
 
Docker on azure
Docker on azureDocker on azure
Docker on azure
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with Docker
 
Containerization using docker and its applications
Containerization using docker and its applicationsContainerization using docker and its applications
Containerization using docker and its applications
 
Containerization using docker and its applications
Containerization using docker and its applicationsContainerization using docker and its applications
Containerization using docker and its applications
 
Docker slides
Docker slidesDocker slides
Docker slides
 
Docker for Developers
Docker for DevelopersDocker for Developers
Docker for Developers
 
Docker-Presentation.pptx
Docker-Presentation.pptxDocker-Presentation.pptx
Docker-Presentation.pptx
 
Docker interview Questions-1.pdf
Docker interview Questions-1.pdfDocker interview Questions-1.pdf
Docker interview Questions-1.pdf
 
Virtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management servicesVirtualization, Containers, Docker and scalable container management services
Virtualization, Containers, Docker and scalable container management services
 
Learning Dockers - Step by Step
Learning Dockers - Step by StepLearning Dockers - Step by Step
Learning Dockers - Step by Step
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)
 
Let's dockerize
Let's dockerizeLet's dockerize
Let's dockerize
 
Docker introduction - Part 1
Docker introduction - Part 1Docker introduction - Part 1
Docker introduction - Part 1
 
Docker
DockerDocker
Docker
 
Docker Kubernetes Istio
Docker Kubernetes IstioDocker Kubernetes Istio
Docker Kubernetes Istio
 
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
 
Introduction to container based virtualization with docker
Introduction to container based virtualization with dockerIntroduction to container based virtualization with docker
Introduction to container based virtualization with docker
 

Último

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 

Último (20)

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Docker

  • 2. Agenda • Introduction   • Docker  Components   A. The  Docker  Client  and  Server   B. Docker  Images   C. Registries   D. Docker  Containers   • What  can  you  use  Docker  for?   • Docker  Installation   • Docker  User  Interface   • Basic  Commands   • Demo   • Questions
  • 3. Introduction  to  Docker           “Docker  is  an  open-­‐source  engine  that  automates  the  deployment  of  applications  into               containers.  It  adds  an  application  deployment  engine  on  top  of  a  virtualised  container   execution  environment.”             It  was  written  by  the  team  at  Docker,  Inc  (formerly  dotCloud  Inc,  an  early  player  in  the               Platform-­‐as-­‐a-­‐Service  (PAAS)  market),  and  released  by  them  under  the  Apache  2.0   license.          
  • 4. Docker’s  Mission  is  to  provide 1. An  easy  and  lightweight  way  to  model  reality           Docker  is  fast,  It  relies  on  copy-­‐on-­‐write  Model.  So,  that  making  changes  to  your                               application  is  also  incredibly  fast:  only  what  you  want  to  change  will  change.     2. A  logical  Segregation  of  Duties         With  Docker,  Developers  care  about  the  application  running  inside  the  containers,  and                                   Operations  care  about  managing  the  containers.   3. Fast,  efficient  development  life  cycle         Docker  aims  to  reduce  the  cycle  time  between  code  being  written  and  code  being                               tested,  deployed  and  used.   4. Encourage  Service  Oriented  Architecture         Docker  encourage  service  oriented  architecture,  It  recommends  that  each  container                               run  a  single  application  or  Process.  
  • 5. Docker  Components  :  The  Docker  Client  and  Server Docker  is  a  client-­‐server   application.  The  Docker  client   talks  to  the  Docker  server  or   daemon,  which,  in  turn,  does   all  the  work.  Docker  ships  with   a  command  line  client  binary,   ‘docker’(“it  is  a  single  binary,   that  can  act  as  both  client  and   server.  As  a  client,  it  passes   request  to  the  Docker  daemon   and  then  process  those   requests  when  they  are   returned.”)  as  well  as  a  full   RESTful  API.
  • 6. Docker  Components  :  Docker  Images An  image  is  the  build  component  of  a   container.  It  is  a  read-­‐only  template  from   which  one  or  more  container  instances   can  be  launched.  Conceptually,  it’s   similar  to  an  AMI.   For  downloading  a  image  from  public   repo,  we  can  use  the  following  command   :   $docker pull ubuntu:12.10
  • 7. 7 Docker  Components  :  Docker  Images   More  about  Docker  Images  :   1. Docker  Images  stored  in  Docker  Hub  or  locally   1. For  Docker  Hub  we  required  Docker  Hub  account   2. Authenticating  Docker     Run  :  sudo docker login This will create the $HOME/.dockercfg file.   2. We  can  build  our  own  Images   1.docker commit (This method is currently not recommended.) 2. docker build  With  a  Dockerfile
  • 8. 8 Docker  Components  :  Docker  Images  :  Dockerfile Dockerfile  :  Dockerfile  uses  a  basic  DSL  with  instructions  for  building  Docker   images.   Sample  Dockerfile:   # Version: 0.0.1 FROM ubuntu:14.04 MAINTAINER Abhishek Tomar “abhish.tomar@gmail.com” RUN apt-get update RUN apt-get install -y nginx RUN echo ‘Hi, I am in your container’ > /usr/share/nginx/html/ index.html EXPOSE 80
  • 9. 9 Docker  Components  :  Docker  Images  :  Dockerfile Now  Docker  Execung  instrucon  workflow  :   • Docker  runs  a  container  from  the  image.   • An  instrucon  executes  and  makes  a  change  to  the  container.   • Docker  runs  the  equivalent  of  “docker  commit”  to  commit  a  new  layer.   • Docker  then  runs  a  new  container  from  this  new  image.   • The  next  instrucon  in  the  file  is  executed,  and  the  process  repeats  unl  all  instrucons   have  been  executed.   Few  Commands    :   1. For  running  the  docker  with  docker  file  :     $ docker build . 1. Checking  the  history  :   $ docker history <containeranme>
  • 10. 10 Docker  Components  :  Registries   Registries  are  used  to  store  images.  Registries  can  be  local  or  remote.  When   we  launch  a  container,  Docker  first  searches  the  local  registry  for  the  image.  If  it’s   not  found  locally,  then  it  searches  a  public  remote  registry,  called  DockerHub.  If   the  image  is  there,  Docker  downloads  it  to  the  local  registry  and  and  uses  it  to   launch  the  container.  DockerHub  is  similar  to  Github,  in  that  we  can  create  both   public  and  private  image  repositories.  This  makes  it  easy  to  distribute  images   efficiently  and  securely.   “Images live inside the repositories and repository lives on registry.”
  • 11. Docker  Components  :  Containers Containers  are  not  VM’s  :  Unlike  hypervisor  virtualization,  where  one  or  more  independent   machines  run  virtually  on  physical  hardware  via  an  intermediation  layer,  containers  instead   run  user  space  on  top  of  an  operating  system's  kernel.   They  can  generally  only  run  the  same  or  a  similar  guest  operating  system  as  the  underlying   hosts.   And  a  Docker  Container  is  …   1. An  Image  Format   2. A  Set  of  standard  operations   3. An  execution  environment  
  • 12. What  can  you  use  Docker  for? ?
  • 13. What  can  you  use  Docker  for? Some  Small  Use  Cases:   1. I  need  to  see  the  man  page  from  a  specific  version  of  RHEL,  CentOS  or  Fedora   2. I  need  to  quickly  verify  the  command  line  options  of  a  program   3. I  need  to  test  the  functionality  of  a  specific  version  of  software   4. I  need  a  scratch  pad  that  is  NOT  my  system   5. I  need  a  single  daemon  running,  and  I  don’t  care  what  distribution  of  Linux  it  runs  on   (see  registry  below)
  • 14. What  can  you  use  Docker  for? Some  more  use  Cases  :   1. Making  your  local  development  and  build  workflow  faster.   2. Using  Docker  to  create  isolated  instances  to  run  tests.   3. Building  a  multi-­‐user  Platform-­‐as-­‐a-­‐service(PAAS)  infrastructure.  
  • 15. 15 Docker  Installation Requirements:   1. Be  running  a  64-­‐bit  architecture  ($sudo  uname  -­‐a)   2. Kernel  version  3.8  or  later  ($sudo  uname  -­‐a)   3. Kernel  must  support  an  appropriate  storage  drive  ($sudo  grep  ‘device-­‐mapper’  /proc/ devices)   4. cgroups  and  namespaces  kernel  features  must  be  supported  and  enabled.   5. Check  curl  is  installed  or  not  ($which  curl)  
  • 16. 16 Docker  Installation  Cont. #UpdaPng  the  ubuntu   $ sudo apt-get update & apt-get upgrade #  Installing  latest  version  of  Docker   $ curl -sSL https://get.docker.io/ubuntu/ | sudo sh #  Check  Whether  Docker  is  running  or  not   $ docker -info #  Docker  configuraPon  file:   “/etc/default/docker” By  default  Docker  will  run  on  socket,  if  you  need  to  change  it  to  ip  then  We  will  have  to   change  the  DOCKER_OPTS  variable  in  configuraon  file.   e.g. DOCKER_OPTS="--host tcp://0.0.0.0:2375 -H unix://var/run/ docker.sock”
  • 17. 1717 Docker  User  Interface There  are  few  Docker  user  interfaces  and  web  console  available  in  various  states  of   development,  Some  of  the  are  listed  below.   1)  Shipyard  -­‐  It  gives  you  the  ability  to  manage  Docker  resources,  including  containers,   images,  hosts,  and  more  from  a  single  management  interface.   2)  DockerUI  -­‐  It  is  a  web  interface  that  allows  you  to  a  interact  with  the  Docker  Remote  API.   It’s  written  in  JAVA  Script  using  the  AngularJS  framework.   3)  maDocker  -­‐  A  web  UI  written  in  NodeJS  and  Backbone  (in  early  stages  of  development.)
  • 19. 19 1)  Running  a  Nginx  web  server  in  docker  container,  and  Access  it  from   outside.   Dockerfile  :   # Version: 0.0.1 FROM ubuntu:14.04 MAINTAINER Abhishek Tomar “abhish.tomar@gmail.com” RUN apt-get update RUN apt-get install -y nginx RUN echo ‘Hi, I am in your container’ > /usr/ share/nginx/html/index.html EXPOSE 80 Demo  &  Understanding  Dockerfile.
  • 20. 20 More  options  in  Docker  file:   1. CMD  :    It’s  similar  to  RUN  instruction  but  rather  than  running  the   command  when  the  container  is  being  built,  it  will  specify  the  command   to  run  when  the  container  is  launched.  For  Example  :   In  docker run  command  :   $sudo run -i -t abhishektomar/webserver /bin/ true In  Dockerfile:   CMD [“/bin/true”] 2. ENTRYPOINT  :  It’s  similar  to  CMD  but  the  difference  is  CMD  command   instruction  you  can  override  by  docker run  command  but  in   ENTRYPOINT  any  argument  passed  to  docker run  command  will  be   passed  as  argument    to  ENTRYPOINT  Command.     ENTRYPOINT [“/usr/sbin/nginx”] $sudo run -i -t abhishektomar/webserver -g “daemonoff;” Demo  &  Understanding  Dockerfile.
  • 21. 21 3. WORKDIR  :  The  WORKDIR  instruction  set  the  work  directory  for  the   container  and  the  ENTRYPOINT  and/or  CMD  to  be  executed  when  a   container  is  launched  from  an  image.   WORKDIR /opt/tomcat-qa/conf RUN source vars WORKDIR /opt/tomcat-qa/bin ENTRYPOINT startup.sh 4. ENV  :  The  ENV  instruction  is  used  to  set  environment  variables  during   the  image  build  process.   ENV JAVA_HOME /usr/lib/jvm/java-6-sun/bin RUN service tomcat7 start 5. USER  :  The  USER  specifies  a  user  that  the  image  should  be  run  as;  for   example  :   USER nginx USER user:group Demo  &  Understanding  Dockerfile.
  • 22. 22 6. VOLUME  :  The  VOLUME  instruction  adds  volumes  to  any  container   created  from  the  image.   1. Volumes  can  be  shared  and  reused  between  containers.   2. A  container  doesn't  have  to  be  running  to  share  its  volumes.   3. Change  to  a  volume  are  made  directly.   4. Changes  to  a  volume  will  not  be  included  when  you  update   an  image.   5. Volume  persist  until  no  containers  use  them.   Using  VOLUME  instruction  :   VOLUME [“/mnt”] # we can also specify multiple VOLUMES VOLUME [“/mnt”, “/data”] 7. ADD  :  The  ADD  instruction  adds  files  and    directories  from  our   build  environment  into  our  images;  For  example,   ADD software.lic /opt/application/software.lic In  the  above  example, ADD  instruction  will  copy  the  file   software.lic  from  the  build  directory  to /opt/application/ software.lic in  the  image. Demo  &  Understanding  Dockerfile.
  • 23. 23 8. COPY  :  The  COPY  instruction  is  closely  related  to  the  ADD   instruction.  The  key  difference  is  that  the  COPY  instruction  is  purely   focused  on  copying    local  files  from  the  build  context  and  does  not   have  an  extraction  or  decompression  capabilities.   COPY cont.d /etc/apache2/ 9. ONBUILD  :  The  ONBUILD  instruction  adds  triggers  to  images.  A   trigger  is  executed  when  the  image  is  used  as  the  basis  of  another   image.   Demo  &  Understanding  Dockerfile.
  • 24. 24 2.  Using  Some  Docker  instructions  :   Dockerfile  :   FROM ubuntu:14.04 MAINTAINER Abhishek Tomar "abhishek.tomar@intelligrape.com" RUN apt-get update RUN apt-get install -y apache2 ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data ENV APACHE_LOCK_DIR /var/run/ ENV APACHE_PID_FILE /var/run/apache ENV APACHE_LOG_DIR /var/log/apache2 ONBUILD ADD . /var/www/ EXPOSE 80 ENTRYPOINT ["/usr/sbin/apache2"] CMD ["-D", "FOREGROUND"] Demo  &  Understanding  Dockerfile.
  • 25. 25 3.  Understanding  ONBUILD  instruction:   Dockerfile  :   FROM abhishek/apache-webserver MAINTAINER Abhishek Tomar "abhishek.tomar@intelligrape.com" ENV APPLICATION_NAME webapp ENV ENVIORNMENT development Demo  &  Understanding  Dockerfile.
  • 26. 26 1.  You  can  only  specify  CMD  instrucon  once  in  the  Docker  files,  if  mulple  specified  last  one  is  used.   2.  If  required  at  runme,  you  can  override  the  ENTRYPOINT  instrucon  using  the  docker  run  command   with  —ENTRYPOINT  flag.   3.  You  can  override  the  working  directory  at  runme  with  the  -­‐w  flag.   4.  For  override  docker  env  you  can  use  -­‐e  flag.   5.  At  runme  you  can  use  -­‐u  flag  to  override  the  user,  if  you  are  not  specifying  any  user  than  default  user   would  be  root.   6.  ADD  :  has  some  special  magic  for  taking  care  of  local  tar  archive  is  specified  as  the  source  file,  the   Docker  will  automacally  unpack  it  for  you:   ADD  lateste.tar.gz  /opt/latest/   7.  COPY  :  The  source  of  the  files  must  be  the  path  to  a  file  or  directory  relave  to  the  build  context,  the   local  source  directory  in  which  your  Dockerfile  resides. Dockerfile  Tips  :
  • 27. 27 4.  We  will  be  creating  a  infrastructure  and  hosting  a  Wordpress  site  on   Docker.   —  Create  A  MySQL  Docker  Instance   —  Create  A  Web  Server  Docker  Instance   Demo