Getting Started with Docker
-
Upload
visual28 -
Category
Technology
-
view
56 -
download
0
Transcript of Getting Started with Docker
![Page 1: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/1.jpg)
![Page 2: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/2.jpg)
Suggested Topics• Composer• Vagrant• Kafka • React / React
Native / Flow• More Docker
• General JavaScript• Organization principals• Node JS / Node
promises • GIS• SQL
![Page 3: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/3.jpg)
Topics• CoffeeScript• Unit Testing• Polyfills • Interaction Design / Improving User
Experience • Mobile testing • A/B Testing• Regression testing• Performance optimization• Dev tools• D3.js / three.js / processing's / etc• Source Maps
• Static site generators• Accessibility for Rich Internet applications
(ARIA)• GeoJSON and mapping API’s• Electron• Node.js• Kalabox• Server Security• GreenSocks Animations• Google Analytics• Test Driven Development• Command Line
![Page 4: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/4.jpg)
Mark Aplet@visual28
Web Developer at Symsoft
![Page 5: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/5.jpg)
DockerAn Introduction & Getting Started
![Page 6: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/6.jpg)
Agenda
• Background• Installation• Commands• Hello World• Dockerfile• Docker Compose
![Page 7: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/7.jpg)
What’s the Big Deal?
![Page 8: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/8.jpg)
LAMP
Once upon a time…
![Page 9: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/9.jpg)
The Challenge TodayStatic website
nginx 1.5 + modsecurity + openssl + bootstrap
User DBpostgresql + pgv8 + v8
Analytics DBhadoop + hive + thrift + OpenJDK
Web frontend Ruby + Rails + sass + Unicorn
QueueRedis + redis-
sentinel
Background workersPython 3.0 + celery + pyredis + libcurl +
ffmpeg + libopencv + nodejs + phantomjs
API endpointPython 2.7 + Flask + pyredis + celery + psycopg + postgresql-
client
Development VM
QA serverDisaster recovery
Contributor’s laptopProduction Servers
Production Cluster
Customer Data Center
![Page 10: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/10.jpg)
Matrix From HellStatic website
Web frontend
Background workers
User DB
Analytics DB
Queue
Development VM QA Server Single Prod
Server Onsite Cluster Public Cloud Contributor’s laptop
Customer Servers
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
![Page 11: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/11.jpg)
![Page 12: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/12.jpg)
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
? ? ? ? ? ? ?
![Page 13: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/13.jpg)
Standardized Container
![Page 14: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/14.jpg)
Separation of Concerns
![Page 15: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/15.jpg)
Docker ContainerStatic website Web frontend User DB Queue Analytics DB
Development VM
QA server Public Cloud
Contributor’s laptop
Production Cluster
Customer Data Center
![Page 16: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/16.jpg)
Virtualization
![Page 17: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/17.jpg)
Virtual Machines
• Hardware VM’s been around a long time
• Allows multiple guest systems to live on a single host
• Snapshots “freeze” state at that point
• Can be migrated from one host to another
![Page 18: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/18.jpg)
VM Problems
• Ship too many bits• Each VM contained
independent OS and resource pool
• Scale may not be of value
![Page 19: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/19.jpg)
Innovation
• Created opportunity to cut out unnecessary features to create lightweight process virtualization
• lead to creation of LXC containers. (Linux Containers)
• Much smaller OS with minimal resource requirements that boots in seconds
![Page 20: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/20.jpg)
![Page 21: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/21.jpg)
VM vs Container
Hypervisor (Type 2)Host OSServer
GuestOS
Bins/Libs
Docker
VMContainer
App 1
GuestOS
Bins/Libs
App 1
GuestOS
Bins/Libs
App 2
Host OSServer
App 1
App 1
App 1
App 2
App 2
App 2
App 2
Bins/Libs Bins/Libs
![Page 22: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/22.jpg)
Enter Docker
• Removing of the unnecessary parts of OS continued
• 2013 DotCloud (now Docker) really pushed the boundaries of lightweight process virtualization
![Page 23: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/23.jpg)
Enter Docker
• A Docker container unlike VM's or LXC does not require or include a separate OS
• Docker instead relies on the Linux kernel functionality and uses resource isolation
![Page 24: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/24.jpg)
Get Started
![Page 25: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/25.jpg)
Download
• docker.com
• Docker for Mac/Win for newer systems
• Docker toolbox for older systems
![Page 26: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/26.jpg)
Helpful
• Prior knowledge of Linux is helpful
• Use Docker CLI in terminal
![Page 27: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/27.jpg)
CommandsCOMMANDSps = Processimages = images on hostrun = run a commandrm = Remove Processrmi = remove image
FLAGS-a = All Hidden-d = detached mode-ti = Terminal Interactive-p = Port number-v = Volume
![Page 28: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/28.jpg)
DEMO
![Page 29: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/29.jpg)
Hello World
$ docker run hello-world
![Page 30: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/30.jpg)
Whalesay
$ docker run docker/whalesay cowsay foobar
![Page 31: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/31.jpg)
Whalesay: DockerfileFROM docker/whalesay:latestRUN apt-get -y update && apt-get install –y fortunesCMD /usr/games/fortune -a | cowsay
$ docker build -t docker-whale .
![Page 32: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/32.jpg)
MySQL$ docker pull mysql
$ docker run --name wordpressdb -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=wordpress -d mysql:5.7
![Page 33: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/33.jpg)
WordPress$ docker pull wordpress
$ docker run -e WORDPRESS_DB_PASSWORD=password --name mywordpress --link wordpressdb:mysql -p 8080:80 -d -v "$PWD/":/var/www/html wordpress
![Page 34: Getting Started with Docker](https://reader035.fdocuments.in/reader035/viewer/2022062412/58a1695b1a28abc1708b686d/html5/thumbnails/34.jpg)
WordPress: Docker-Compose
version: '2'services: db: image: mysql:5.7 volumes: - "./.data/db:/var/lib/mysql" restart: always environment: MYSQL_ROOT_PASSWORD: wordpress MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress
wordpress: depends_on: - db image: wordpress:latest links: - db ports: - "8080:80" restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_PASSWORD: wordpress volumes: - ./wp-content/:/var/www/html/wp-content