Shukhratbek Mamadaliev

Why Docker?

RELEASED

2013

GitHub stars

+ 32 000

Dockerized apps in the Docker HUB

+ 500 000

 

22.03.2017

Third party projects using Docker

+ 100 000

 

22.03.2017

Docker container downloads

8 billion

 

22.03.2017

Docker employees

270

Docker's estimated value

$1 billion

 

22.03.2017

What is Docker?

  • Lightweight, open, secure platform
  • Simplify building, shipping, running apps
  • Shipping container system for code
  • Runs natively on Linux or Windows Server
  • Runs on Windows or Mac Development machines (with a virtual machine)
  • Relies on "images" and "containers"

The role of Images and Containers

Example: Ubuntu with Node.js and application code

Created by using an image. Runs your application.

Image

A read-only template composed of layered filesystems used to share common files and create Docker container instances.

Container

An isolated and secured shipping container created from and image that can be run, started, stopped, moved and deleted.

Where does Docker run?

Docker Containers vs VM

Docker Benefits

(for Web Deveoplers)

Accelerate Developer Onboarding

Eliminate App Conflicts

Environment Consistency

Ship Software Faster

Docker Tools

Docker Toolbox

Provides image and container tools

Virtual Machine (for Windows/Mac)

Works on Windows, Mac, Linux

 

https://www.docker.com/products/docker-toolbox

Docker Toolbox Tools

Docker Client

Docker Client Overview

docker pull [image name]
docker run [image name]
docker images
docker ps

Key Docker Client Commands

Docker Machine

Docker Machine Overview

docker-machine ls
docker-machine start [machine name]
docker-machine stop [machine name]
docker-machine env [machine name]
docker-machine ip [machine name]

docker-machine status [machine name]

Key Docker Machine Commands

Docker Commands Review

docker pull [image name]
docker images
docker rmi [image ID]

Key Docker Client Image Commands

docker run [image name]
docker ps–a
docker rm [container ID]

Key Docker Client
Container Commands

Kitematic

Dockerfile

Dockerfile and Images

  • Text file used to build Docker images
  • Contains build instructions
  • Instructions create intermediate image that can be cached to speed up future builds
  • Used with "docker build" command

Dockerfile Overview

Key Dockerfile Instructions

Dockerfile Example

FROM node
MAINTAINER Shukhratbek
COPY . /var/www
WORKDIR /var/www
RUN npm install
EXPOSE 8080
ENTRYPOINT ["node", "server.js"]

Docker Compose

Docker Compose Manages Your Application Lifecycle

Docker Compose Features

Manages the whole application lifecycle:

  • Start, stop and rebuild services
  • View the status of running services
  • Stream the log output of running services
  • Run a one-off command on a service

The Need for Docker Compose

Docker Compose Workflow

The Role of the Docker Compose File

Key Service Configuration Options

docker-compose.yml Example

version: '2'
services:

    node:
        build:
            context: .
            dockerfile: node.dockerfile
        networks: -nodeapp-network

    mongodb:
        image: mongo
        networks: -nodeapp-network

    networks: 
        nodeapp-network
        driver: bridge

docker-compose.yml Example

docker-compose build
docker-compose up
docker-compose down
docker-compose logs
docker-compose ps
docker-compose stop
docker-compose start
docker-compose rm

Thank You!

Docker

By Shuhratbek Mamadaliyev

Docker

  • 1,016