Docker 101 Talk

What is

What is Docker ?

Docker is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of operating-system-level virtualization on Linux.

Wikipedia Definition

What is Docker ?

We can say light-weighted virtual machine.

Simply..

What is Docker ?

3 years ago

VIRTUAL MACHINEs

traditional VIRTUAL MACHINEs

VIRTUAL MACHINEs

VIRTUAL MACHINEs

REUSABLE IMAGES

VIRTUAL MACHINEs

REUSABLE IMAGES

SNAPSHOTS

VIRTUAL MACHINEs

REUSABLE IMAGES

SNAPSHOTS

Isolated Env

 

""too heavy""

Docker containers

Docker containers

Docker containers

VM

Docker

Docker is based on LXC (Linux Containers) which allows

it to isolate containers from each other.

 

LXC use mainly two Linux Kernel features to acheave it :

 

  • Namespaces (Isolation of resources)
  • Cgroups (Isolation of resource usage, as CPU/RAM)

Linux Containers

Programmatically speaking, if an image is a class, then a container would be an instance of this class.

 

So, you can launch multiple containers for the same image (multiple instances).

docker ps command lists all running containers :

Linux Containers

LXC =

OS-level virtualization for running multiple isolated Linux systems 

"LINUX CONTAINERS"

cgroups =

Linux kernel feature that limits and isolates the resource usage

(CPU, disk I/O, network, etc.)

"CONTROL GROUPS"

AUFs =

Filesystem which is based on images where every modification is a diff from the previous one (Like commits in git)

"Adv. multi layered Unification FS"

What is the Benefit of Docker ?

Configuration Free

containers include the minimal runtime requirements of the application, reducing their size and allowing them to be deployed quickly.

Portability across machines

an application and all its dependencies can be bundled into a single container that is independent from the host version of Linux kernel, platform distribution, or deployment model. This container can be transfered to another machine that runs Docker, and executed there without compatibility issues.

Version control and component reuse

 you can track successive versions of a container, inspect differences, or roll-back to previous versions. Containers reuse components from the preceding layers, which makes them noticeably lightweight.

Sharing 

you can use a remote repository to share your container with others. 

HOW TO INSTALL ?

HOW TO INSTALL ?

http://docs.docker.com/installation

HOW TO INSTALL ?

http://docs.docker.com/installation

Docker HUB

Over 1.2B Pulls

from Docker Hub

5.6M

65

240K

Pulls per Day

Pulls per Second

Repositories on

Docker Hub

Docker Pull

docker pull ubuntu
docker pull ubuntu(:16.04)

Docker images

docker images

REPOSITORY                             TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu                                 latest              91e54dfb1179        16 minutes ago      188.4 MB
hello-world                            latest              af340544ed62        4 minutes ago       960 B

Docker run 

docker run -it ubuntu

image

container

Docker ps

docker ps -a

CONTAINER ID        IMAGE                         COMMAND                  CREATED             STATUS              PORTS                         NAMES
396fa752515e        ekkinox/image2                "/bin/bash"              20 minutes ago      Up 20 minutes                                     high_panini
aa60196275a3        ekkinox/image1                "/bin/bash"              29 minutes ago      Up 29 minutes                                     reverent_fermi
c7f259822acb        ubuntu:16.04                  "/bin/bash"              36 minutes ago      Up 36 minutes                                     awesome_elion
70ef83fa7097        ubuntu:14.04                  "/bin/bash"              37 minutes ago      Up 37 minutes                                     silly_mclean
698cd8bd50fe        nazarpc/phpmyadmin            "/home/entrypoint.sh"    17 hours ago        Up 17 hours         0.0.0.0:1234->80/tcp          doclersfbasicworkshop_phpmyadmin_1
4c5dd41b5a55        doclersfbasicworkshop_nginx   "nginx -g 'daemon off"   18 hours ago        Up 18 hours         0.0.0.0:80->80/tcp, 443/tcp   doclersfbasicworkshop_nginx_1
e58a4384d27a        mysql:5.6                     "docker-entrypoint.sh"   18 hours ago        Up 18 hours         0.0.0.0:3306->3306/tcp        doclersfbasicworkshop_db_1
faf8aba5cd3c        doclersfbasicworkshop_php     "php-fpm"                18 hours ago        Up 18 hours         9000/tcp                      doclersfbasicworkshop_php_1

image

container

Docker commit

docker commit high_panini test_image

image

container

Docker push

docker push test_image

image

container

Docker push

Dockerfile

A Dockerfile is a recipe of what the image will be :

FROM ubuntu:16.04

RUN mkdir -p /home/test
$ docker build -t test_image .

To build an image from this Dockerfile :

Demo

 

Use Case ;

Must know docker tech knowledge

Cloud IDE (Code Anywhere/Cloud9/CodeEnvy)

CORE OS

Microservice

Thanks

Docker

By Satoshi Goto