SlideShare a Scribd company logo
1
Giới thiệu Đóc cờ CI/CD
LongTV
2
Agenda
● Giới thiệu đóc cờ
● Đóc cờ cơ bản
● Đóc cờ cô lập
● Đóc cờ đại chiến Hypervisor
● Đóc cờ CI/CD
● Chốt sổ
3
Agenda
● Giới thiệu đóc cờ
● Đóc cờ cơ bản
● Đóc cờ cô lập
● Đóc cờ đại chiến Hypervisor
● Đóc cờ CI/CD
● Chốt sổ
4
Giới thiệu Docker
● Open source project
● Giúp đóng gói ứng dụng vào
container để shipping và run
ứng dụng dễ dàng và tiện
lợi hơn, ko phụ thuộc vào
môi trường.
● Mô tả về docker:
Nhẹ và nhanh
5
Lịch sử
● Solomon Hykes phát triển Docker tại
Pháp, ở cty dotCloud (cty về PaaS)
● Release Open source 03/2013
● 13/03/2014 nghỉ LXC và chơi
libcontainer
● 05/2016 đã có nhiều cty là main
contributor cho Docker: Cisco, Google,
Huawei, IBM, Microsoft, Red Hat,...
6
Project on Github
https://github.com/docker/docker
7
Độ phát triển
8
Giao lưu Docker tại Việt Nam
● Docker Hà Nội:
https://www.meetup.com/Docker-Hanoi/
● Docker Sài Gòn:
https://www.meetup.com/Docker-Saigon/
9
10
Agenda
● Giới thiệu đóc cờ
● Đóc cờ cơ bản
● Đóc cờ cô lập
● Đóc cờ đại chiến Hypervisor
● Đóc cờ CI/CD
● Chốt sổ
11
Docker basic
1. Docker Engine
2. Docker image
3. Docker container
4. Dockerfile
5. Docker Hub
6. Docker Cloud
7. Docker orchestration
12
Docker Engine
● Docker bao gồm:
○ Docker Engine: bộ open source mô phỏng
hoá container kết hợp với tools để build và
run container.
○ Docker Hub: SaaS để quản lý application
stacks.
13
Docker Engine
1. Docker daemon
2. REST API
3. CLI
14
Docker Image
15
● Được xây dựng lên từ các
layer
● Docker sử dụng union file
systems để tạo nên docker
image => giúp việc build
image trở nên nhanh hơn.
● Mỗi instruction sẽ tạo ra 1
layer của image.
● Các image được share trên
Docker Hub
Container?
16
Container là gì
A container image is a lightweight,
stand-alone, executable package of a
piece of software that includes everything
needed to run it: code, runtime, system
tools, system libraries, settings
17
Docker container
● Docker container được tạo ra từ images
● Cách tạo 1 container về cơ bản là dùng
command docker run:
$ sudo docker run -i -t ubuntu /bin/bash
○ CLI tương tác vs Docker daemon qua REST API để
tạo container từ image (sẽ pull image về nếu ko có
trong local)
○ Docker daemon sẽ thiết lập network, mount volume ,
○ Mỗi container được isolate trong các name spaces
riêng biệt.
18
Dockerfile
● Là text file chứa các instructions để build ra
một image.
● Cú pháp build image
docker build -t test/myapp .
● Các instruction phổ biến:
○ FROM <image_name>: base image
○ ADD
○ COPY
○ RUN
○ CMD
○ ENTRY_POINT
○ ...
19
Ví dụ Dockerfile
FROM ubuntu:latest
MAINTAINER Long Ta "longtv@runsystem.net"
RUN apt-get update
RUN apt-get install -y python python-pip wget
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["hello.py"]
20
Docker Hub
● Cloud-based registry service để quản lý
image, build image và có link đến Docker
Cloud để deploy container.
● Features:
○ Image repositories
○ Automated Builds
○ Webhooks
○ Organizations
○ Integration with Github vs Bitbucket
22
https://hub.docker.com/
Docker Cloud
● Là hosted registry service, hỗ trợ quản lý
infrastructure và quản lý application
lifecycle features để automate deploying
● Features:
○ Manage Builds and Images
○ Manage Infrastructure (Standard Mode)
○ Manage Nodes and Apps (Standard Mode)
○ Manage Swarms (Beta Swarm Mode)
23
Docker Cloud
● Đang hỗ trợ các Cloud Provider:
○ AWS
○ Digital Ocean
○ Microsoft Azure
○ SoftLayer
○ Packet
● Hỗ trợ linking đến các version control sau:
○ Github
○ Bitbucket
24
Docker orchestration
● From Docker
○ Docker compose
○ Docker machine
○ Docker swarm
● From 3rd party
○ Kubernetes
○
26
27
Docker compose
● Tool để quản lý nhiều container cùng lúc
● Features:
○ Tạo nhiều isolated environments trên cùng
1 host.
○ Bảo tồn các volumes khi start, stop các
containers.
○ Chỉ tạo lại container khi có thay đổi (
docker-compose.yml)
○ Thiết lập các biến môi trường.
28
Compse file
version: '2'
services:
web:
build: .
ports:
- "${EXTERNAL_PORT}:5000"
volumes:
- .:/code
redis:
image: "redis:alpine"
29
30
Docker machine
● Tool giúp install docker engine trên virtual host
và quản lý các virtual host thông qua command
docker-machine
● Công năng:
1. Giúp chạy docker trên những hệ điều hành Window
or Mac cũ
2. Chạy docker command remoce tới docker host.
31
Docker machine
32
Docker machine
33
Tạo virtual host với
Virtualbox
● Command
docker-machine create --driver virtualbox node-01
● Các option cho Virtualbox:
--virtualbox-memory
--virtualbox-cpu-count
--virtualbox-disk-size
--virtualbox-host-dns-resolver
…
● Chọi vào host
eval $(docker-machine env node-01)
34
Tạo virtual host của Conoha
1. Export các thông tin để xác thực
export OS_USERNAME=<api_username>
export OS_TENANT_ID=<tenant_id>
export OS_PASSWORD=<api_password>
export OS_AUTH_URL=https://identity.tyo1.conoha.io/v2.0
export OS_REGION_NAME=tyo1
2. Tạo máy ảo
docker-machine create 
-d openstack 
--openstack-flavor-name g-1gb 
--openstack-image-name vmi-ubuntu-16.04-amd64-unified 
--openstack-sec-groups "default,gncs-ipv4-all" 
--openstack-sec-groups "default,gncs-ipv4-all" 
co-01
35
37
Docker swarm
● Managing nhiều docker host (cluster)
● Feature:
○ Cluster management integrated with Docker Engine
○ Decentralized design
○ Declarative service model
○ Scaling
○ Desired state reconciliation
○ Multi-host networking
○ Service discovery
○ Load balancing
○ Secure by default
○ Rolling updates
38
Docker swarm
39
Docker swarm scheduling
● Swarm mode deploy sử dụng:
$docker service create --name my_web --replicas 3 nginx
● Swarm deploy service bằng cách scheduling các tasks
○ Task: là slot để đặt container
○ Nếu task tạch thì xóa task đi và tạo ra task mới ( reschedule )
○ Khi một service deploy mà ko có node vào available thì service sẽ rơi
vào trạng thái pending cho đến khi task được thực thi hết (có thể
pending mãi mãi)
● Scheduling strategies: flag --strategy
○ spread(default): dựa trên số lượng containter ( kể cả đã stop)
○ Binpack: hấp diêm thằng node còn available
○ Random: táng bừa
● Deloy mode:
○ replicated: tạo số lượng bản sao
○ global: deploy trên tất cả các node (ví dụ log,...)
40
Binpack vs Spread
41
Docker swarm scheduling
Deploy service in Swarm mode
42
Services, tasks, and containers Tasks and scheduling
Raft Consensus Algorithm
● Thuật toán đồng thuận để quản lý replicated log,
swarm dùng để quản lý global cluster state.
● Mỗi node sẽ có 3 state: Follower, Candidate,
Leader
● Hỗ trợ:
Leader Election Replicated Log
43
Node manager failover
44
Với N node sẽ hanlde failover được cho (N-1)/2 node tạch
Swarm mode security
TLS : can’t disable
45
Docker Cloud
● Là hosted registry service, hỗ trợ quản lý
infrastructure và quản lý application
lifecycle features để automate deploying
● Features:
○ Manage Builds and Images
○ Manage Infrastructure (Standard Mode)
○ Manage Nodes and Apps (Standard Mode)
○ Manage Swarms (Beta Swarm Mode)
47
Docker Cloud
● Đang hỗ trợ các Cloud Provider:
○ AWS
○ Digital Ocean
○ Microsoft Azure
○ SoftLayer
○ Packet
● Hỗ trợ linking đến các version control sau:
○ Github
○ Bitbucket
● Swarm mode (beta)
48
50
Agenda
● Giới thiệu đóc cờ
● Đóc cờ cơ bản
● Đóc cờ cô lập
● Đóc cờ đại chiến Hypervisor
● Đóc cờ CI/CD
● Chốt sổ
51
52
Docker Isolation
Cgroups
● Là feature của Linux Kernel cho phép
limit, theo dõi, quản lý sử dụng resources
của “collection of processes”
● Cgroups giúp quản lý các resources: cpu,
memory, devices, ns … ( còn gọi là sub
system)
53
Cgroups
Docker sử dụng cgroups để quản lý resoures cho các
container: CPU, Memory, IO
54
docker run -it --cpus=".5" --memory="300m" ubuntu /bin/bash
50% CPU
300Mb memory and
600Mb Swap
Namespaces
● Là feature của Linux kernel, ra đời để hỗ trợ
cho công nghệ container. ( cung cấp isolated
secure environment)
● Từ Linux kernel 2.6.24 Linux hỗ trợ 6 loại
namespace:
55
Namespaces
Các process chạy
inside namespace
chỉ tương tác được
vs các process bên
trong namespace đó
và ko thể tương tác
outside cũng như
sang namespace
khác ( container
khác)
56
Namespaces
Mỗi chú inside namespace là 1 cái j đó
outside namespace
57
OUTSIDE
INSIDE
58
Agenda
● Giới thiệu đóc cờ
● Đóc cờ cơ bản
● Đóc cờ cô lập
● Đóc cờ đại chiến Hypervisor
● Đóc cờ CI/CD
● Chốt sổ
59
Docker đại chiến Hypervisor
60
61
Hypervisor là gì
A hypervisor or virtual machine monitor
(VMM) is computer software, firmware, or
hardware, that creates and runs virtual
machines. A computer on which a hypervisor
runs one or more virtual machines is called a
host machine, and each virtual machine is
called a guest machine.
https://en.wikipedia.org/wiki/Hypervisor
Hypervisor?
1. Native(bare metal): Chạy trực tiếp trên hardware của host
machine. Xen, Oracle VM Server for SPARC, Oracle VM
Server for x86, Microsoft Hyper-V and VMware ESX/ESXi.
2. Hosted: Chạy phía trên OS của host machine. VMware
Workstation, VMware Player, VirtualBox, Parallels Desktop
for Mac and QEMU
62
Docker có phải VM ko?
63
In computing, a virtual machine (VM) is an emulation of a computer system.
Virtual machines are based on computer architectures and provide
functionality of a physical computer. Their implementations may involve
specialized hardware, software, or a combination.
https://en.wikipedia.org/wiki/Virtual_machine
Docker container khiến ta “cảm giác” như là
đang dùng VM vậy.
- Có thể ssh vào container
- Có thể run các CLI của OS
- Không gian riêng bên trong container
- ...
Docker vs Hypervisor
64
Containers are an abstraction at
the app layer that packages code
and dependencies together.
Virtual machines (VMs) are an
abstraction of physical hardware
turning one server into many
servers
Docker vs Hypervisor
65
Docker Hypervisor
Ảo hóa OS trở lên Ảo hóa phần cứng (hardware) trở lên
Nhẹ + start nhanh Nặng + start (boot) chậm
Slow provisioning Real-time provisioning and scalability
Native performance Limited performance
Secure kém hơn Secure tốt hơn
Process-level isolation Fully isolated
Sử dụng resources hiệu quả hơn Sử dụng resouces lãng phí
Docker cưỡi Hypervisor
66
67
Agenda
● Giới thiệu đóc cờ
● Đóc cờ cơ bản
● Đóc cờ cô lập
● Đóc cờ đại chiến Hypervisor
● Đóc cờ CI/CD
● Chốt sổ
68
69
Docker CI/CD
● CI: Continuous Integration là development practice yêu cầu
các developers phải tích hợp(integrate) code vào shared
repository vài lần 1 ngày: mỗi thay đổi đều được test =
automated build để phát hiện sai sót.
● CD-Continuous Delivery: ốp tất cả những j thay
đổi (new feature, hotfix,...) vào phiên bản production (ko
deploy luôn)
● CD-Continuous Deployment: bước tiếp theo
của Continuous Delivery là deploy luôn vào production
CI
70
Continuous
Delivery/Deployment
71
CI/CD with Docker
72
Docker CI/CD in
Microservices
73
Docker CI/CD with Travis CI
sudo: required
language: ruby
services:
- docker
before_install:
- docker pull carlad/sinatra
- docker run -d -p 127.0.0.1:80:4567
carlad/sinatra /bin/sh -c "cd
/root/sinatra; bundle exec foreman start;"
- docker ps -a
- docker run carlad/sinatra /bin/sh -c "cd
/root/sinatra; bundle exec rake test"
script:
- bundle exec rake test
74
Docker CI/CD with CircleCI
75
CI/CD giúp gì?
● Speed: tăng tốc phát triển sản phẩm
● Quality: tăng chất lượng cho sảm phẩm
● Capacity and Scale: cho phép big team
cùng theo 1 dự án.
● Cost: giảm cost meeting và management
● Focus: team member ko bị lẫn lộn nhiều
task cùng lúc
● Clarity: giảm stress
76
Tôi đã gói xôi như thế nào
● Thử thách với những project đã làm
1. Jarvis: ko dùng Docker Orchestration
○ Chỉ dùng docker bình thường.
2. CallDB:
○ dùng cả 3 công cụ Orchestration
○ Dùng CI/CD: bitbucket, DockerHub, Jenkins.
77
Jarvis
78
CallDB
79
database serviceapp service
CallDB
80
MySQL
web service
NGINX
PHP_FPM
PHP_FPM
mynet (overlay network)
82
Agenda
● Giới thiệu đóc cờ
● Đóc cờ cơ bản
● Đóc cờ cô lập
● Đóc cờ đại chiến Hypervisor
● Đóc cờ CI/CD
● Chốt sổ
83
84
Chốt hạ
● Docker hay:
➽ Thống nhất môi trường
➽ Deploy nhẹ nhàng, Scale đơn giản, hiệu quả
➽ Càng ngày càng có nhiều Infrastructure service
(IaaS, PaaS) lớn hỗ trợ container
➽ Cộng đồng lớn
➽ Cách nhìn khác về service infrastructure
➽ Phù hợp với kiến trúc Microservice đang hưng thịnh
● Docker dở:
➽ Việc viết Dockerfile đối với Infrastructure phức tạp
rất phức tạp.
➽ Chuyển giao từ VM sang Container cần phải tìm
hiểu rất nhiều để ứng dụng trên production
85

More Related Content

What's hot

Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Hero
fazalraja
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)
Gourav Varma
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker Compose
Ajeet Singh Raina
 
Getting started with Docker
Getting started with DockerGetting started with Docker
Getting started with Docker
Ravindu Fernando
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
Sparkbit
 
Podman, Buildah, and Quarkus - The Latest in Linux Containers Technologies
Podman, Buildah, and Quarkus - The Latest in Linux Containers Technologies Podman, Buildah, and Quarkus - The Latest in Linux Containers Technologies
Podman, Buildah, and Quarkus - The Latest in Linux Containers Technologies
Daniel Oh
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
DuckDuckGo
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
Phuc Nguyen
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
Aditya Konarde
 
Docker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker SlidesDocker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker Slides
Docker, Inc.
 
Docker basics
Docker basicsDocker basics
Docker basics
AmanSoni129
 
Introduction to Docker - VIT Campus
Introduction to Docker - VIT CampusIntroduction to Docker - VIT Campus
Introduction to Docker - VIT Campus
Ajeet Singh Raina
 
A Hands-On Introduction To Docker Containers.pdf
A Hands-On Introduction To Docker Containers.pdfA Hands-On Introduction To Docker Containers.pdf
A Hands-On Introduction To Docker Containers.pdf
Edith Puclla
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
Peng Xiao
 
Introduction to Docker - 2017
Introduction to Docker - 2017Introduction to Docker - 2017
Introduction to Docker - 2017
Docker, Inc.
 
What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...
What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...
What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...
Simplilearn
 
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Edureka!
 
Introduction to docker and docker compose
Introduction to docker and docker composeIntroduction to docker and docker compose
Introduction to docker and docker compose
Lalatendu Mohanty
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
Luong Vo
 
Docker intro
Docker introDocker intro
Docker intro
Oleg Z
 

What's hot (20)

Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Hero
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker Compose
 
Getting started with Docker
Getting started with DockerGetting started with Docker
Getting started with Docker
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Podman, Buildah, and Quarkus - The Latest in Linux Containers Technologies
Podman, Buildah, and Quarkus - The Latest in Linux Containers Technologies Podman, Buildah, and Quarkus - The Latest in Linux Containers Technologies
Podman, Buildah, and Quarkus - The Latest in Linux Containers Technologies
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Docker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker SlidesDocker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker Slides
 
Docker basics
Docker basicsDocker basics
Docker basics
 
Introduction to Docker - VIT Campus
Introduction to Docker - VIT CampusIntroduction to Docker - VIT Campus
Introduction to Docker - VIT Campus
 
A Hands-On Introduction To Docker Containers.pdf
A Hands-On Introduction To Docker Containers.pdfA Hands-On Introduction To Docker Containers.pdf
A Hands-On Introduction To Docker Containers.pdf
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Introduction to Docker - 2017
Introduction to Docker - 2017Introduction to Docker - 2017
Introduction to Docker - 2017
 
What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...
What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...
What Is Docker? | What Is Docker And How It Works? | Docker Tutorial For Begi...
 
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
 
Introduction to docker and docker compose
Introduction to docker and docker composeIntroduction to docker and docker compose
Introduction to docker and docker compose
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Docker intro
Docker introDocker intro
Docker intro
 

Similar to Giới thiệu docker và ứng dụng trong ci-cd

Docker Overview
Docker OverviewDocker Overview
Docker Overview
Thinh Duc
 
Introduce docker
Introduce dockerIntroduce docker
Introduce docker
Robin Huy
 
Giải pháp xây dựng đám mây riêng cho doanh nghiệp vừa và nhỏ
Giải pháp xây dựng đám mây riêng cho doanh nghiệp vừa và nhỏGiải pháp xây dựng đám mây riêng cho doanh nghiệp vừa và nhỏ
Giải pháp xây dựng đám mây riêng cho doanh nghiệp vừa và nhỏ
AiTi Education
 
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong...[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong...
DevDay.org
 
Hướng dẫn sử dụng CocoaPods trong dự án iOS hoặc MacOSX
Hướng dẫn sử dụng CocoaPods trong dự án iOS hoặc MacOSXHướng dẫn sử dụng CocoaPods trong dự án iOS hoặc MacOSX
Hướng dẫn sử dụng CocoaPods trong dự án iOS hoặc MacOSX
TechMaster Vietnam
 
DockerDay2015: Introduction to Dockerfile
DockerDay2015: Introduction to DockerfileDockerDay2015: Introduction to Dockerfile
DockerDay2015: Introduction to Dockerfile
Docker-Hanoi
 
Present.pptx
Present.pptxPresent.pptx
Present.pptx
NguynTng43670
 
Trần Anh Khoa - Kautilya và Powershell trong kỹ thuật tấn công tiếp cận
Trần Anh Khoa - Kautilya và Powershelltrong kỹ thuật tấn công tiếp cậnTrần Anh Khoa - Kautilya và Powershelltrong kỹ thuật tấn công tiếp cận
Trần Anh Khoa - Kautilya và Powershell trong kỹ thuật tấn công tiếp cận
Security Bootcamp
 
Tran Minh Thai Bai Giang Vc
Tran Minh Thai   Bai Giang VcTran Minh Thai   Bai Giang Vc
Tran Minh Thai Bai Giang VcNhat Thien
 
tài liệu Mã nguồn mở 02 sudung
tài liệu Mã nguồn mở  02 sudungtài liệu Mã nguồn mở  02 sudung
tài liệu Mã nguồn mở 02 sudung
Thuyet Nguyen
 
Embedded beta2 new
Embedded beta2 newEmbedded beta2 new
Embedded beta2 new
Nguyễn Anh
 
Linux thietlaphethongmangubunt-45879
Linux thietlaphethongmangubunt-45879Linux thietlaphethongmangubunt-45879
Linux thietlaphethongmangubunt-45879Son Giap
 
Linux Network Administration (LPI-1,LPI-2)
Linux Network Administration (LPI-1,LPI-2)Linux Network Administration (LPI-1,LPI-2)
Linux Network Administration (LPI-1,LPI-2)
laonap166
 
Tiểu Luận Tìm Hiểu NS2 Và Demo
Tiểu Luận Tìm Hiểu NS2 Và Demo Tiểu Luận Tìm Hiểu NS2 Và Demo
Tiểu Luận Tìm Hiểu NS2 Và Demo
nataliej4
 
Sử dụng Linux
Sử dụng LinuxSử dụng Linux
Sử dụng Linux
Hanh Nguyễn Văn
 
Quản lý hyper p1
Quản lý hyper p1Quản lý hyper p1
Quản lý hyper p1
laonap166
 
Ao hoa voi vSphere
Ao hoa voi vSphereAo hoa voi vSphere
Ao hoa voi vSphere
Lecturer
 
mp_hag_slide_android_2321.pptx
mp_hag_slide_android_2321.pptxmp_hag_slide_android_2321.pptx
mp_hag_slide_android_2321.pptx
KhngNguyn81
 
Lập trình background job bằng azurequeue và webjob sử dụng azure storage emul...
Lập trình background job bằng azurequeue và webjob sử dụng azure storage emul...Lập trình background job bằng azurequeue và webjob sử dụng azure storage emul...
Lập trình background job bằng azurequeue và webjob sử dụng azure storage emul...
VKhang Yang
 

Similar to Giới thiệu docker và ứng dụng trong ci-cd (20)

Docker Overview
Docker OverviewDocker Overview
Docker Overview
 
Introduce docker
Introduce dockerIntroduce docker
Introduce docker
 
Giải pháp xây dựng đám mây riêng cho doanh nghiệp vừa và nhỏ
Giải pháp xây dựng đám mây riêng cho doanh nghiệp vừa và nhỏGiải pháp xây dựng đám mây riêng cho doanh nghiệp vừa và nhỏ
Giải pháp xây dựng đám mây riêng cho doanh nghiệp vừa và nhỏ
 
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong...[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong...
 
Hướng dẫn sử dụng CocoaPods trong dự án iOS hoặc MacOSX
Hướng dẫn sử dụng CocoaPods trong dự án iOS hoặc MacOSXHướng dẫn sử dụng CocoaPods trong dự án iOS hoặc MacOSX
Hướng dẫn sử dụng CocoaPods trong dự án iOS hoặc MacOSX
 
DockerDay2015: Introduction to Dockerfile
DockerDay2015: Introduction to DockerfileDockerDay2015: Introduction to Dockerfile
DockerDay2015: Introduction to Dockerfile
 
Present.pptx
Present.pptxPresent.pptx
Present.pptx
 
Trần Anh Khoa - Kautilya và Powershell trong kỹ thuật tấn công tiếp cận
Trần Anh Khoa - Kautilya và Powershelltrong kỹ thuật tấn công tiếp cậnTrần Anh Khoa - Kautilya và Powershelltrong kỹ thuật tấn công tiếp cận
Trần Anh Khoa - Kautilya và Powershell trong kỹ thuật tấn công tiếp cận
 
Lập trình android
Lập trình androidLập trình android
Lập trình android
 
Tran Minh Thai Bai Giang Vc
Tran Minh Thai   Bai Giang VcTran Minh Thai   Bai Giang Vc
Tran Minh Thai Bai Giang Vc
 
tài liệu Mã nguồn mở 02 sudung
tài liệu Mã nguồn mở  02 sudungtài liệu Mã nguồn mở  02 sudung
tài liệu Mã nguồn mở 02 sudung
 
Embedded beta2 new
Embedded beta2 newEmbedded beta2 new
Embedded beta2 new
 
Linux thietlaphethongmangubunt-45879
Linux thietlaphethongmangubunt-45879Linux thietlaphethongmangubunt-45879
Linux thietlaphethongmangubunt-45879
 
Linux Network Administration (LPI-1,LPI-2)
Linux Network Administration (LPI-1,LPI-2)Linux Network Administration (LPI-1,LPI-2)
Linux Network Administration (LPI-1,LPI-2)
 
Tiểu Luận Tìm Hiểu NS2 Và Demo
Tiểu Luận Tìm Hiểu NS2 Và Demo Tiểu Luận Tìm Hiểu NS2 Và Demo
Tiểu Luận Tìm Hiểu NS2 Và Demo
 
Sử dụng Linux
Sử dụng LinuxSử dụng Linux
Sử dụng Linux
 
Quản lý hyper p1
Quản lý hyper p1Quản lý hyper p1
Quản lý hyper p1
 
Ao hoa voi vSphere
Ao hoa voi vSphereAo hoa voi vSphere
Ao hoa voi vSphere
 
mp_hag_slide_android_2321.pptx
mp_hag_slide_android_2321.pptxmp_hag_slide_android_2321.pptx
mp_hag_slide_android_2321.pptx
 
Lập trình background job bằng azurequeue và webjob sử dụng azure storage emul...
Lập trình background job bằng azurequeue và webjob sử dụng azure storage emul...Lập trình background job bằng azurequeue và webjob sử dụng azure storage emul...
Lập trình background job bằng azurequeue và webjob sử dụng azure storage emul...
 

More from GMO-Z.com Vietnam Lab Center

高負荷に耐えうるWebApplication Serverの作り方
高負荷に耐えうるWebApplication Serverの作り方高負荷に耐えうるWebApplication Serverの作り方
高負荷に耐えうるWebApplication Serverの作り方
GMO-Z.com Vietnam Lab Center
 
Phương pháp và chiến lược đối ứng tải trong Web Application Server
Phương pháp và chiến lược đối ứng tải trong Web Application ServerPhương pháp và chiến lược đối ứng tải trong Web Application Server
Phương pháp và chiến lược đối ứng tải trong Web Application Server
GMO-Z.com Vietnam Lab Center
 
Ứng dụng NLP vào việc xác định ý muốn người dùng (Intent Detection) và sửa lỗ...
Ứng dụng NLP vào việc xác định ý muốn người dùng (Intent Detection) và sửa lỗ...Ứng dụng NLP vào việc xác định ý muốn người dùng (Intent Detection) và sửa lỗ...
Ứng dụng NLP vào việc xác định ý muốn người dùng (Intent Detection) và sửa lỗ...
GMO-Z.com Vietnam Lab Center
 
Tìm hiểu và triển khai ứng dụng Web với Kubernetes
Tìm hiểu và triển khai ứng dụng Web với KubernetesTìm hiểu và triển khai ứng dụng Web với Kubernetes
Tìm hiểu và triển khai ứng dụng Web với Kubernetes
GMO-Z.com Vietnam Lab Center
 
Xây dựng hệ thống quản lý sân bóng sử dụng Yii Framework
Xây dựng hệ thống quản lý sân bóng sử dụng Yii FrameworkXây dựng hệ thống quản lý sân bóng sử dụng Yii Framework
Xây dựng hệ thống quản lý sân bóng sử dụng Yii Framework
GMO-Z.com Vietnam Lab Center
 
Nhận biết giao dịch lừa đảo sử dụng học máy
Nhận biết giao dịch lừa đảo sử dụng học máyNhận biết giao dịch lừa đảo sử dụng học máy
Nhận biết giao dịch lừa đảo sử dụng học máy
GMO-Z.com Vietnam Lab Center
 
Hệ thống giám sát nhận diện khuôn mặt
Hệ thống giám sát nhận diện khuôn mặtHệ thống giám sát nhận diện khuôn mặt
Hệ thống giám sát nhận diện khuôn mặt
GMO-Z.com Vietnam Lab Center
 
Image Style Transfer
Image Style TransferImage Style Transfer
Image Style Transfer
GMO-Z.com Vietnam Lab Center
 
Optimizing MySQL queries
Optimizing MySQL queriesOptimizing MySQL queries
Optimizing MySQL queries
GMO-Z.com Vietnam Lab Center
 
Surveillance on slam technology
Surveillance on slam technologySurveillance on slam technology
Surveillance on slam technology
GMO-Z.com Vietnam Lab Center
 
Blockchain & Smart Contract - Bắt đầu như thế nào và các ứng dụng
Blockchain & Smart Contract - Bắt đầu như thế nào và các ứng dụngBlockchain & Smart Contract - Bắt đầu như thế nào và các ứng dụng
Blockchain & Smart Contract - Bắt đầu như thế nào và các ứng dụng
GMO-Z.com Vietnam Lab Center
 
Giới thiệu Embulk
Giới thiệu Embulk Giới thiệu Embulk
Giới thiệu Embulk
GMO-Z.com Vietnam Lab Center
 
Tài liệu giới thiệu công ty GMO-Z.com Vietnam Lab Center
Tài liệu giới thiệu công ty GMO-Z.com Vietnam Lab CenterTài liệu giới thiệu công ty GMO-Z.com Vietnam Lab Center
Tài liệu giới thiệu công ty GMO-Z.com Vietnam Lab Center
GMO-Z.com Vietnam Lab Center
 
Chia se Agile
Chia se AgileChia se Agile
Agile retrospective
Agile retrospectiveAgile retrospective
Agile retrospective
GMO-Z.com Vietnam Lab Center
 
Giới thiệu Agile + Scrum
Giới thiệu Agile + ScrumGiới thiệu Agile + Scrum
Giới thiệu Agile + Scrum
GMO-Z.com Vietnam Lab Center
 
Create android app can send SMS and Email by React Natice
Create android app can send SMS and Email by React NaticeCreate android app can send SMS and Email by React Natice
Create android app can send SMS and Email by React Natice
GMO-Z.com Vietnam Lab Center
 
Introduce React Native
Introduce React NativeIntroduce React Native
Introduce React Native
GMO-Z.com Vietnam Lab Center
 
Spark tuning
Spark tuningSpark tuning

More from GMO-Z.com Vietnam Lab Center (20)

高負荷に耐えうるWebApplication Serverの作り方
高負荷に耐えうるWebApplication Serverの作り方高負荷に耐えうるWebApplication Serverの作り方
高負荷に耐えうるWebApplication Serverの作り方
 
Phương pháp và chiến lược đối ứng tải trong Web Application Server
Phương pháp và chiến lược đối ứng tải trong Web Application ServerPhương pháp và chiến lược đối ứng tải trong Web Application Server
Phương pháp và chiến lược đối ứng tải trong Web Application Server
 
Ứng dụng NLP vào việc xác định ý muốn người dùng (Intent Detection) và sửa lỗ...
Ứng dụng NLP vào việc xác định ý muốn người dùng (Intent Detection) và sửa lỗ...Ứng dụng NLP vào việc xác định ý muốn người dùng (Intent Detection) và sửa lỗ...
Ứng dụng NLP vào việc xác định ý muốn người dùng (Intent Detection) và sửa lỗ...
 
Tìm hiểu và triển khai ứng dụng Web với Kubernetes
Tìm hiểu và triển khai ứng dụng Web với KubernetesTìm hiểu và triển khai ứng dụng Web với Kubernetes
Tìm hiểu và triển khai ứng dụng Web với Kubernetes
 
Xây dựng hệ thống quản lý sân bóng sử dụng Yii Framework
Xây dựng hệ thống quản lý sân bóng sử dụng Yii FrameworkXây dựng hệ thống quản lý sân bóng sử dụng Yii Framework
Xây dựng hệ thống quản lý sân bóng sử dụng Yii Framework
 
Nhận biết giao dịch lừa đảo sử dụng học máy
Nhận biết giao dịch lừa đảo sử dụng học máyNhận biết giao dịch lừa đảo sử dụng học máy
Nhận biết giao dịch lừa đảo sử dụng học máy
 
Hệ thống giám sát nhận diện khuôn mặt
Hệ thống giám sát nhận diện khuôn mặtHệ thống giám sát nhận diện khuôn mặt
Hệ thống giám sát nhận diện khuôn mặt
 
Image Style Transfer
Image Style TransferImage Style Transfer
Image Style Transfer
 
Optimizing MySQL queries
Optimizing MySQL queriesOptimizing MySQL queries
Optimizing MySQL queries
 
Surveillance on slam technology
Surveillance on slam technologySurveillance on slam technology
Surveillance on slam technology
 
Blockchain & Smart Contract - Bắt đầu như thế nào và các ứng dụng
Blockchain & Smart Contract - Bắt đầu như thế nào và các ứng dụngBlockchain & Smart Contract - Bắt đầu như thế nào và các ứng dụng
Blockchain & Smart Contract - Bắt đầu như thế nào và các ứng dụng
 
Giới thiệu Embulk
Giới thiệu Embulk Giới thiệu Embulk
Giới thiệu Embulk
 
Tài liệu giới thiệu công ty GMO-Z.com Vietnam Lab Center
Tài liệu giới thiệu công ty GMO-Z.com Vietnam Lab CenterTài liệu giới thiệu công ty GMO-Z.com Vietnam Lab Center
Tài liệu giới thiệu công ty GMO-Z.com Vietnam Lab Center
 
Chia se Agile
Chia se AgileChia se Agile
Chia se Agile
 
Agile retrospective
Agile retrospectiveAgile retrospective
Agile retrospective
 
Giới thiệu Agile + Scrum
Giới thiệu Agile + ScrumGiới thiệu Agile + Scrum
Giới thiệu Agile + Scrum
 
Create android app can send SMS and Email by React Natice
Create android app can send SMS and Email by React NaticeCreate android app can send SMS and Email by React Natice
Create android app can send SMS and Email by React Natice
 
Introduce React Native
Introduce React NativeIntroduce React Native
Introduce React Native
 
Spark tuning
Spark tuningSpark tuning
Spark tuning
 
Git in real product
Git in real productGit in real product
Git in real product
 

Giới thiệu docker và ứng dụng trong ci-cd

  • 1. 1 Giới thiệu Đóc cờ CI/CD LongTV
  • 2. 2
  • 3. Agenda ● Giới thiệu đóc cờ ● Đóc cờ cơ bản ● Đóc cờ cô lập ● Đóc cờ đại chiến Hypervisor ● Đóc cờ CI/CD ● Chốt sổ 3
  • 4. Agenda ● Giới thiệu đóc cờ ● Đóc cờ cơ bản ● Đóc cờ cô lập ● Đóc cờ đại chiến Hypervisor ● Đóc cờ CI/CD ● Chốt sổ 4
  • 5. Giới thiệu Docker ● Open source project ● Giúp đóng gói ứng dụng vào container để shipping và run ứng dụng dễ dàng và tiện lợi hơn, ko phụ thuộc vào môi trường. ● Mô tả về docker: Nhẹ và nhanh 5
  • 6. Lịch sử ● Solomon Hykes phát triển Docker tại Pháp, ở cty dotCloud (cty về PaaS) ● Release Open source 03/2013 ● 13/03/2014 nghỉ LXC và chơi libcontainer ● 05/2016 đã có nhiều cty là main contributor cho Docker: Cisco, Google, Huawei, IBM, Microsoft, Red Hat,... 6
  • 9. Giao lưu Docker tại Việt Nam ● Docker Hà Nội: https://www.meetup.com/Docker-Hanoi/ ● Docker Sài Gòn: https://www.meetup.com/Docker-Saigon/ 9
  • 10. 10
  • 11. Agenda ● Giới thiệu đóc cờ ● Đóc cờ cơ bản ● Đóc cờ cô lập ● Đóc cờ đại chiến Hypervisor ● Đóc cờ CI/CD ● Chốt sổ 11
  • 12. Docker basic 1. Docker Engine 2. Docker image 3. Docker container 4. Dockerfile 5. Docker Hub 6. Docker Cloud 7. Docker orchestration 12
  • 13. Docker Engine ● Docker bao gồm: ○ Docker Engine: bộ open source mô phỏng hoá container kết hợp với tools để build và run container. ○ Docker Hub: SaaS để quản lý application stacks. 13
  • 14. Docker Engine 1. Docker daemon 2. REST API 3. CLI 14
  • 15. Docker Image 15 ● Được xây dựng lên từ các layer ● Docker sử dụng union file systems để tạo nên docker image => giúp việc build image trở nên nhanh hơn. ● Mỗi instruction sẽ tạo ra 1 layer của image. ● Các image được share trên Docker Hub
  • 17. Container là gì A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings 17
  • 18. Docker container ● Docker container được tạo ra từ images ● Cách tạo 1 container về cơ bản là dùng command docker run: $ sudo docker run -i -t ubuntu /bin/bash ○ CLI tương tác vs Docker daemon qua REST API để tạo container từ image (sẽ pull image về nếu ko có trong local) ○ Docker daemon sẽ thiết lập network, mount volume , ○ Mỗi container được isolate trong các name spaces riêng biệt. 18
  • 19. Dockerfile ● Là text file chứa các instructions để build ra một image. ● Cú pháp build image docker build -t test/myapp . ● Các instruction phổ biến: ○ FROM <image_name>: base image ○ ADD ○ COPY ○ RUN ○ CMD ○ ENTRY_POINT ○ ... 19
  • 20. Ví dụ Dockerfile FROM ubuntu:latest MAINTAINER Long Ta "longtv@runsystem.net" RUN apt-get update RUN apt-get install -y python python-pip wget COPY . /app WORKDIR /app RUN pip install -r requirements.txt ENTRYPOINT ["python"] CMD ["hello.py"] 20
  • 21.
  • 22. Docker Hub ● Cloud-based registry service để quản lý image, build image và có link đến Docker Cloud để deploy container. ● Features: ○ Image repositories ○ Automated Builds ○ Webhooks ○ Organizations ○ Integration with Github vs Bitbucket 22 https://hub.docker.com/
  • 23. Docker Cloud ● Là hosted registry service, hỗ trợ quản lý infrastructure và quản lý application lifecycle features để automate deploying ● Features: ○ Manage Builds and Images ○ Manage Infrastructure (Standard Mode) ○ Manage Nodes and Apps (Standard Mode) ○ Manage Swarms (Beta Swarm Mode) 23
  • 24. Docker Cloud ● Đang hỗ trợ các Cloud Provider: ○ AWS ○ Digital Ocean ○ Microsoft Azure ○ SoftLayer ○ Packet ● Hỗ trợ linking đến các version control sau: ○ Github ○ Bitbucket 24
  • 25.
  • 26. Docker orchestration ● From Docker ○ Docker compose ○ Docker machine ○ Docker swarm ● From 3rd party ○ Kubernetes ○ 26
  • 27. 27
  • 28. Docker compose ● Tool để quản lý nhiều container cùng lúc ● Features: ○ Tạo nhiều isolated environments trên cùng 1 host. ○ Bảo tồn các volumes khi start, stop các containers. ○ Chỉ tạo lại container khi có thay đổi ( docker-compose.yml) ○ Thiết lập các biến môi trường. 28
  • 29. Compse file version: '2' services: web: build: . ports: - "${EXTERNAL_PORT}:5000" volumes: - .:/code redis: image: "redis:alpine" 29
  • 30. 30
  • 31. Docker machine ● Tool giúp install docker engine trên virtual host và quản lý các virtual host thông qua command docker-machine ● Công năng: 1. Giúp chạy docker trên những hệ điều hành Window or Mac cũ 2. Chạy docker command remoce tới docker host. 31
  • 34. Tạo virtual host với Virtualbox ● Command docker-machine create --driver virtualbox node-01 ● Các option cho Virtualbox: --virtualbox-memory --virtualbox-cpu-count --virtualbox-disk-size --virtualbox-host-dns-resolver … ● Chọi vào host eval $(docker-machine env node-01) 34
  • 35. Tạo virtual host của Conoha 1. Export các thông tin để xác thực export OS_USERNAME=<api_username> export OS_TENANT_ID=<tenant_id> export OS_PASSWORD=<api_password> export OS_AUTH_URL=https://identity.tyo1.conoha.io/v2.0 export OS_REGION_NAME=tyo1 2. Tạo máy ảo docker-machine create -d openstack --openstack-flavor-name g-1gb --openstack-image-name vmi-ubuntu-16.04-amd64-unified --openstack-sec-groups "default,gncs-ipv4-all" --openstack-sec-groups "default,gncs-ipv4-all" co-01 35
  • 36.
  • 37. 37
  • 38. Docker swarm ● Managing nhiều docker host (cluster) ● Feature: ○ Cluster management integrated with Docker Engine ○ Decentralized design ○ Declarative service model ○ Scaling ○ Desired state reconciliation ○ Multi-host networking ○ Service discovery ○ Load balancing ○ Secure by default ○ Rolling updates 38
  • 40. Docker swarm scheduling ● Swarm mode deploy sử dụng: $docker service create --name my_web --replicas 3 nginx ● Swarm deploy service bằng cách scheduling các tasks ○ Task: là slot để đặt container ○ Nếu task tạch thì xóa task đi và tạo ra task mới ( reschedule ) ○ Khi một service deploy mà ko có node vào available thì service sẽ rơi vào trạng thái pending cho đến khi task được thực thi hết (có thể pending mãi mãi) ● Scheduling strategies: flag --strategy ○ spread(default): dựa trên số lượng containter ( kể cả đã stop) ○ Binpack: hấp diêm thằng node còn available ○ Random: táng bừa ● Deloy mode: ○ replicated: tạo số lượng bản sao ○ global: deploy trên tất cả các node (ví dụ log,...) 40
  • 42. Docker swarm scheduling Deploy service in Swarm mode 42 Services, tasks, and containers Tasks and scheduling
  • 43. Raft Consensus Algorithm ● Thuật toán đồng thuận để quản lý replicated log, swarm dùng để quản lý global cluster state. ● Mỗi node sẽ có 3 state: Follower, Candidate, Leader ● Hỗ trợ: Leader Election Replicated Log 43
  • 44. Node manager failover 44 Với N node sẽ hanlde failover được cho (N-1)/2 node tạch
  • 45. Swarm mode security TLS : can’t disable 45
  • 46.
  • 47. Docker Cloud ● Là hosted registry service, hỗ trợ quản lý infrastructure và quản lý application lifecycle features để automate deploying ● Features: ○ Manage Builds and Images ○ Manage Infrastructure (Standard Mode) ○ Manage Nodes and Apps (Standard Mode) ○ Manage Swarms (Beta Swarm Mode) 47
  • 48. Docker Cloud ● Đang hỗ trợ các Cloud Provider: ○ AWS ○ Digital Ocean ○ Microsoft Azure ○ SoftLayer ○ Packet ● Hỗ trợ linking đến các version control sau: ○ Github ○ Bitbucket ● Swarm mode (beta) 48
  • 49.
  • 50. 50
  • 51. Agenda ● Giới thiệu đóc cờ ● Đóc cờ cơ bản ● Đóc cờ cô lập ● Đóc cờ đại chiến Hypervisor ● Đóc cờ CI/CD ● Chốt sổ 51
  • 53. Cgroups ● Là feature của Linux Kernel cho phép limit, theo dõi, quản lý sử dụng resources của “collection of processes” ● Cgroups giúp quản lý các resources: cpu, memory, devices, ns … ( còn gọi là sub system) 53
  • 54. Cgroups Docker sử dụng cgroups để quản lý resoures cho các container: CPU, Memory, IO 54 docker run -it --cpus=".5" --memory="300m" ubuntu /bin/bash 50% CPU 300Mb memory and 600Mb Swap
  • 55. Namespaces ● Là feature của Linux kernel, ra đời để hỗ trợ cho công nghệ container. ( cung cấp isolated secure environment) ● Từ Linux kernel 2.6.24 Linux hỗ trợ 6 loại namespace: 55
  • 56. Namespaces Các process chạy inside namespace chỉ tương tác được vs các process bên trong namespace đó và ko thể tương tác outside cũng như sang namespace khác ( container khác) 56
  • 57. Namespaces Mỗi chú inside namespace là 1 cái j đó outside namespace 57 OUTSIDE INSIDE
  • 58. 58
  • 59. Agenda ● Giới thiệu đóc cờ ● Đóc cờ cơ bản ● Đóc cờ cô lập ● Đóc cờ đại chiến Hypervisor ● Đóc cờ CI/CD ● Chốt sổ 59
  • 60. Docker đại chiến Hypervisor 60
  • 61. 61 Hypervisor là gì A hypervisor or virtual machine monitor (VMM) is computer software, firmware, or hardware, that creates and runs virtual machines. A computer on which a hypervisor runs one or more virtual machines is called a host machine, and each virtual machine is called a guest machine. https://en.wikipedia.org/wiki/Hypervisor
  • 62. Hypervisor? 1. Native(bare metal): Chạy trực tiếp trên hardware của host machine. Xen, Oracle VM Server for SPARC, Oracle VM Server for x86, Microsoft Hyper-V and VMware ESX/ESXi. 2. Hosted: Chạy phía trên OS của host machine. VMware Workstation, VMware Player, VirtualBox, Parallels Desktop for Mac and QEMU 62
  • 63. Docker có phải VM ko? 63 In computing, a virtual machine (VM) is an emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardware, software, or a combination. https://en.wikipedia.org/wiki/Virtual_machine Docker container khiến ta “cảm giác” như là đang dùng VM vậy. - Có thể ssh vào container - Có thể run các CLI của OS - Không gian riêng bên trong container - ...
  • 64. Docker vs Hypervisor 64 Containers are an abstraction at the app layer that packages code and dependencies together. Virtual machines (VMs) are an abstraction of physical hardware turning one server into many servers
  • 65. Docker vs Hypervisor 65 Docker Hypervisor Ảo hóa OS trở lên Ảo hóa phần cứng (hardware) trở lên Nhẹ + start nhanh Nặng + start (boot) chậm Slow provisioning Real-time provisioning and scalability Native performance Limited performance Secure kém hơn Secure tốt hơn Process-level isolation Fully isolated Sử dụng resources hiệu quả hơn Sử dụng resouces lãng phí
  • 67. 67
  • 68. Agenda ● Giới thiệu đóc cờ ● Đóc cờ cơ bản ● Đóc cờ cô lập ● Đóc cờ đại chiến Hypervisor ● Đóc cờ CI/CD ● Chốt sổ 68
  • 69. 69 Docker CI/CD ● CI: Continuous Integration là development practice yêu cầu các developers phải tích hợp(integrate) code vào shared repository vài lần 1 ngày: mỗi thay đổi đều được test = automated build để phát hiện sai sót. ● CD-Continuous Delivery: ốp tất cả những j thay đổi (new feature, hotfix,...) vào phiên bản production (ko deploy luôn) ● CD-Continuous Deployment: bước tiếp theo của Continuous Delivery là deploy luôn vào production
  • 70. CI 70
  • 74. Docker CI/CD with Travis CI sudo: required language: ruby services: - docker before_install: - docker pull carlad/sinatra - docker run -d -p 127.0.0.1:80:4567 carlad/sinatra /bin/sh -c "cd /root/sinatra; bundle exec foreman start;" - docker ps -a - docker run carlad/sinatra /bin/sh -c "cd /root/sinatra; bundle exec rake test" script: - bundle exec rake test 74
  • 75. Docker CI/CD with CircleCI 75
  • 76. CI/CD giúp gì? ● Speed: tăng tốc phát triển sản phẩm ● Quality: tăng chất lượng cho sảm phẩm ● Capacity and Scale: cho phép big team cùng theo 1 dự án. ● Cost: giảm cost meeting và management ● Focus: team member ko bị lẫn lộn nhiều task cùng lúc ● Clarity: giảm stress 76
  • 77. Tôi đã gói xôi như thế nào ● Thử thách với những project đã làm 1. Jarvis: ko dùng Docker Orchestration ○ Chỉ dùng docker bình thường. 2. CallDB: ○ dùng cả 3 công cụ Orchestration ○ Dùng CI/CD: bitbucket, DockerHub, Jenkins. 77
  • 80. database serviceapp service CallDB 80 MySQL web service NGINX PHP_FPM PHP_FPM mynet (overlay network)
  • 81.
  • 82. 82
  • 83. Agenda ● Giới thiệu đóc cờ ● Đóc cờ cơ bản ● Đóc cờ cô lập ● Đóc cờ đại chiến Hypervisor ● Đóc cờ CI/CD ● Chốt sổ 83
  • 84. 84 Chốt hạ ● Docker hay: ➽ Thống nhất môi trường ➽ Deploy nhẹ nhàng, Scale đơn giản, hiệu quả ➽ Càng ngày càng có nhiều Infrastructure service (IaaS, PaaS) lớn hỗ trợ container ➽ Cộng đồng lớn ➽ Cách nhìn khác về service infrastructure ➽ Phù hợp với kiến trúc Microservice đang hưng thịnh ● Docker dở: ➽ Việc viết Dockerfile đối với Infrastructure phức tạp rất phức tạp. ➽ Chuyển giao từ VM sang Container cần phải tìm hiểu rất nhiều để ứng dụng trên production
  • 85. 85