2
Most read
15
Most read
Introduction to Docker Containerization
What is Docker ?
● System level virtualisation
technology.
● Produces Lightweight virtual
machines.
● Isolate processes from the host
environment (fs isolation, net
isolation, id isolation).
Docker VS VMs ?
Docker
Virtual Machine
Why Docker ?
● Package applications and their dependencies
in one portable abstract unit.
● Shortens deployment time and effort.
● Ease application scaling on a very large
compute domain.
● New perspectives : Micro-services based
architecture.
Docker Ecosystem
Creating the first Docker Container
● Pull the Ubuntu image from the registry.
$ docker image pull ubuntu
● Start a container based on the Ubuntu image
$ docker container run -it –-name ubuntu ubuntu /bin/sh
Listing images and containers
● List images
$ docker images
$ docker image ls
● List running containers
$ docker ps
$ docker container ls
● List all containers
$ docker ps -a
$ docker container ls -a
Start in detached mode
● Add -d option to docker run
$ docker run -dit –-name ubuntu ubuntu /bin/sh
● To leave container without exiting it
CTRL + P + Q
● To connect the terminal to the detached container
$ docker attach {id} | {NAME}
Networking
● Default mode is bridge : All containers
and host are connected to a virtual
switch in the same subnet 172.17.0.0/16
● List network drivers
$ docker network ls
● Show information of a network driver
$ docker network inspect bridge
Deploy a real application
● We will deploy Flask application
● Start from a base image of Ubuntu
with Python and Flask installed
● Create a new image and add our
custom application.
Dockerfile
● It is a text file that contains a sequence of
instruction to build an image from an existing
one.
● Build the image with
$ docker build -t <tag>
● Launch the container
$ docker run -d –-name app <tag>
Micro-services and scaling
● What if we have multiple services and
we want to automate the process of
deployment ?
● Or What if we want to scale up our
application with ease ?
Docker-compose
● Docker-compose is a mean to describe
the deployment of multiple
containers/services with one single
yml file.
● It eases the scaling up of an
application.
Docker-compose
Docker-compose
● Bring up the services with
$ docker-compose up
●
Describe you services with docker-compose.yml
●
Three web applications
●
One nginx reverse proxy

Docker Introduction

  • 1.
    Introduction to DockerContainerization
  • 2.
    What is Docker? ● System level virtualisation technology. ● Produces Lightweight virtual machines. ● Isolate processes from the host environment (fs isolation, net isolation, id isolation).
  • 3.
    Docker VS VMs? Docker Virtual Machine
  • 4.
    Why Docker ? ●Package applications and their dependencies in one portable abstract unit. ● Shortens deployment time and effort. ● Ease application scaling on a very large compute domain. ● New perspectives : Micro-services based architecture.
  • 5.
  • 6.
    Creating the firstDocker Container ● Pull the Ubuntu image from the registry. $ docker image pull ubuntu ● Start a container based on the Ubuntu image $ docker container run -it –-name ubuntu ubuntu /bin/sh
  • 7.
    Listing images andcontainers ● List images $ docker images $ docker image ls ● List running containers $ docker ps $ docker container ls ● List all containers $ docker ps -a $ docker container ls -a
  • 8.
    Start in detachedmode ● Add -d option to docker run $ docker run -dit –-name ubuntu ubuntu /bin/sh ● To leave container without exiting it CTRL + P + Q ● To connect the terminal to the detached container $ docker attach {id} | {NAME}
  • 9.
    Networking ● Default modeis bridge : All containers and host are connected to a virtual switch in the same subnet 172.17.0.0/16 ● List network drivers $ docker network ls ● Show information of a network driver $ docker network inspect bridge
  • 10.
    Deploy a realapplication ● We will deploy Flask application ● Start from a base image of Ubuntu with Python and Flask installed ● Create a new image and add our custom application.
  • 11.
    Dockerfile ● It isa text file that contains a sequence of instruction to build an image from an existing one. ● Build the image with $ docker build -t <tag> ● Launch the container $ docker run -d –-name app <tag>
  • 12.
    Micro-services and scaling ●What if we have multiple services and we want to automate the process of deployment ? ● Or What if we want to scale up our application with ease ?
  • 13.
    Docker-compose ● Docker-compose isa mean to describe the deployment of multiple containers/services with one single yml file. ● It eases the scaling up of an application.
  • 14.
  • 15.
    Docker-compose ● Bring upthe services with $ docker-compose up ● Describe you services with docker-compose.yml ● Three web applications ● One nginx reverse proxy