SlideShare uma empresa Scribd logo
1 de 31
Baixar para ler offline
Preparation study
of Docker
2016/03/24
Mulodo Vietnam Co., Ltd.
“Docker”
Docker allows you to package an
application with all of its dependencies
into a standardized unit for software
development.
What is “Docker”?
Docker containers wrap up a piece of
software in a complete filesystem that
contains everything it needs to run:
code, runtime, system tools, system
libraries – anything you can install on
a server. This guarantees that it will
always run the same, regardless of the
environment it is running in.
( https://www.docker.com/what-docker )
Docker VS Vagrant ??
Alternatively ?? NO!!
Docker : a kind of Linux container
Vagrant: Virtual machine manager
Docker VS Vagrant ??
Alternatively ?? NO!!
Docker : a kind of Linux container
Vagrant: Virtual machine manager
Docker
Work on Host OS
directory
OS of Docker and
Host OS is Same
using host’s OS
Docker VS Vagrant ??
Vagrant Emulated OS on Host
OS
Independent from
Host OS.
Virtual box
VMware...
Docker VS Vagrant ??
Vagrant Emulated OS on Host
OS
Independent from
Host OS.
where is Vagrant?
Virtual box
VMware...
Docker VS Vagrant ??
Vagrant Emulated OS on Host
OS
Independent from
Host OS.
where is Vagrant?
VM managemanet tool
use various VM with
same I/F.
Virtual box
VMware...
I/F
Today’s goal
OSX
Mac Book Air
Linux on Linux on OSX
A typical use case on OSX
Today’s goal
Linux on Linux on OSX
OSX
Mac Book Air
Vagrant
Virtual Box
Linux
A typical use case on OSX
Today’s goal
Linux on Linux on OSX
OSX
Mac Book Air
Vagrant
Virtual Box
Linux
Docker
bin/libs
A typical use case on OSX
Today’s goal
Linux on Linux on OSX
A typical use case on OSX
OSX
Mac Book Air
Vagrant
Virtual Box
Linux
Docker
bin/libs
virtual machine (Linux)
virtual machine
(linux)
Rough history of container
chroot:(1979, 1983->BSD)
Use user own env.
change root directory.
ex) /home/nemo => /
jail : (2000)
Quarantine/restrictions of OS resources. (≒Namespace)
container : (2005, 2008->Linux)
Namespace (mount:2002.... PID:2008)
Cgroup (Quarantine/restrictions of HW resources)
LXC : (2014 (ver.1))
The one you love.
Docker : (2014 (ver.1))
The one you love.
Rough history of Hypervisor
VMware: (1999-)
The first product which used by *many*
engineer.(?)
Xen : (2002)
Use Linux kernel as Hypervisor
KVM : (2006)
Linux kernel include Xen like Hypervisor
Virtual Box : (2007)
proprietary software -> added OSS version.
BHyVe : (2011)
KVM for BSD, simple, small, cool(?)
get tired a bit...
Create Vagrant machine
# coding: utf-8
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu-14.04"
config.vm.network "private_network", ip: "192.168.33.130"
end
$ vagrant box add utuntu-14.04 https://oss-
binaries.phusionpassenger.com/vagrant/boxes/latest/
ubuntu-14.04-amd64-vbox.box
:
$ vagrant box list
ubuntu-14.04 (virtualbox, 0)
$
Add Vagrant box (ubuntu-14.04)
Create Vagrantfile
Setup Docker machine
$ cat hosts
[Docker-server]
192.168.33.130 (virtualbox, 0)
$ cat setup.yml
# setup docker server (base apps)
- include: playbooks/server.yml
# setup docker server
- include: playbooks/docker.yml
$ mkdir playbooks
$
Create hosts, setup.yml, playbooks/
Setup Docker machine
$ cat playbooks/server.yml
- hosts: Docker-server
tasks:
- name: "APT: update"
become: yes
apt: update_cache=yes
- name: "APT: clean"
become: yes
shell: >
apt-get -y autoclean;
apt-get -y clean
- name: "APT: install required apps"
become: yes
apt: pkg={{ item }} state=present update_cache=yes
with_items:
- git
- unzip
- emacs
Create playbooks/server.yml (basic apps)
Setup Docker machine
Create playbooks/docker.yml
Please check the official Docs
https://docs.docker.com/engine/
installation/linux/ubuntulinux/
Setup Docker machine
- hosts: Docker-server
tasks:
# setup to add Docker to APT
- name: "check Docker list file"
- name: "Put docker list file"
- name: "check Docker bin"
- name: "APT: update"
- name: "install apt auth related packagesr"
- name: "get APT key"
- name: "APT: update"
- name: "APT: purge lxc-docker"
- name: "APT : cache"
# install Docker and start docker service
- name: "APT: update"
- name: "APT: add extra imager"
- name: "APT: install Docker"
- name: "service docker start"
Create playbooks/docker.yml
only steps.
add Ansible provision into Vagrantfile
# coding: utf-8
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu-14.04"
config.vm.network "private_network", ip: "192.168.33.130"
# Ansible
config.vm.provision "ansible" do |ansible|
ansible.playbook = "./setup.yml"
ansible.inventory_path = "./hosts"
ansible.limit = "Docker-server"
end
end
Setup Docker machine
- hosts: Docker-server
tasks:
# setup to add Docker to APT
- name: "check Docker list file"
- name: "Put docker list file"
- name: "check Docker bin"
- name: "APT: update"
- name: "install apt auth related packagesr"
- name: "get APT key"
- name: "APT: update"
- name: "APT: purge lxc-docker"
- name: "APT : caceh"
# install Docker and start docker service
- name: "APT: update"
- name: "APT: add extra imager"
- name: "APT: install Docker"
- name: "service docker start"
Create playbooks/docker.yml
only steps.
Please clone the repository
Setup Docker machine
$ git clone -b Docker
git@github.com:nemo-soshi-mulodo/
OpenDevStudyGroup.git
sample scripts.
Again..
$ vagrant destroy
$ vagrant up
$ vagrant ssh
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic
x86_64)
* Documentation: https://help.ubuntu.com/
Last login: Thu Mar 24 05:30:32 2016 from 10.0.2.2
vagrant@ubuntu-14:~$ docker version
Client:
Version: 1.10.3
API version: 1.22
Go version: go1.5.3
Git commit: 20f81dd
Built: Thu Mar 10 15:54:52 2016
OS/Arch: linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon
running on this host?
vagrant@ubuntu-14:~$ sudo service docker status
docker start/running, process 8511
vagrant@ubuntu-14:~$
Create server
vagrant@ubuntu-14:~$ docker pull php:7.0.2-apache
7.0.2-apache: Pulling from library/php
03e1855d4f31: Downloading 3.666 MB/51.36 MB
a3ed95caeb02: Download complete
18f8f35c7f98: Downloading 3.311 MB/8.716 MB
252f4816c8e7: Downloading 3.222 MB/69.26 MB
f8ac546f9ad6: Waiting
56eec5affd36: Waiting
8d6aa2f3838f: Waiting
082124b746bb: Waiting
a237f42233ef: Waiting
e532fb3215e9: Waiting
c7e6a0f56f27: Waiting
e1c620b7e144: Waiting
6953fe89923b: Waiting
e5bfe4c72d64: Waiting
Create server
vagrant@ubuntu-14:~$ docker pull php:7.0.2-apache
7.0.2-apache: Pulling from library/php
03e1855d4f31: Downloading 3.666 MB/51.36 MB
a3ed95caeb02: Download complete
18f8f35c7f98: Downloading 3.311 MB/8.716 MB
252f4816c8e7: Downloading 3.222 MB/69.26 MB
f8ac546f9ad6: Waiting
56eec5affd36: Waiting
8d6aa2f3838f: Waiting
082124b746bb: Waiting
a237f42233ef: Waiting
e532fb3215e9: Waiting
c7e6a0f56f27: Waiting
e1c620b7e144: Waiting
6953fe89923b: Waiting
e5bfe4c72d64: Waiting
Create server
vagrant@ubuntu-14:~$ docker pull php:7.0.2-apache
7.0.2-apache: Pulling from library/php
03e1855d4f31: Download complete
a3ed95caeb02: Download complete
18f8f35c7f98: Download complete
252f4816c8e7: Download complete
f8ac546f9ad6: Download complete
56eec5affd36: Download complete
8d6aa2f3838f: Download complete
082124b746bb: Download complete
a237f42233ef: Download complete
e532fb3215e9: Download complete
c7e6a0f56f27: Download complete
e1c620b7e144: Download complete
6953fe89923b: Download complete
e5bfe4c72d64: Download complete
Digest: sha256:b1e1421a1ca86660552025c00ed42906c6619daa1bcb9c477236b80fadc8f27b
Status: Downloaded newer image for php:7.0.2-apache
vagrant@ubuntu-14:~$
check server
vagrant@vagrant:~$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
php 7.0.2-apache 90e2c0e2fc5c 8 weeks ago 521 MB
vagrant@vagrant:~$ docker run -d php:7.0.2-apache
1d5fc77e68dde86cbaea5716beef723c102b41e9b0240d44739b08ed83b09d1f
vagrant@vagrant:~$
vagrant@vagrant:~$ docker ps
CONTAINER ID IMAGE COMMAND ..
1d5fc77e68dd php:7.0.2-apache “apache2-foreground" ..
vagrant@vagrant:~$
vagrant@ubuntu-14:~$ docker stop 1d5fc77e68dd
1d5fc77e68dd
vagrant@ubuntu-14:~$ docker ps
CONTAINER ID IMAGE COMMAND ...
vagrant@vagrant:~$
check server (2)
vagrant@ubuntu-14:~$ docker run -it php:7.0.2-apache /bin/bash
root@3399320f814e:/var/www/html# ps ax
PID TTY STAT TIME COMMAND
1 ? Ss 0:00 /bin/bash
7 ? R+ 0:00 ps ax
root@3399320f814e:/var/www/html# /etc/init.d/apache2 start
[....] Starting web server: apache2AH00558: apache2: Could not
reliably determine the server's fully qualified domain name, using
172.17.0.2. Set the 'ServerName' directive globally to suppress
this message
. ok
root@3399320f814e:/var/www/html# ps -ax | grep apache
24 ? Ss 0:00 /usr/sbin/apache2 -k start
27 ? S 0:00 /usr/sbin/apache2 -k start
28 ? S 0:00 /usr/sbin/apache2 -k start
29 ? S 0:00 /usr/sbin/apache2 -k start
30 ? S 0:00 /usr/sbin/apache2 -k start
31 ? S 0:00 /usr/sbin/apache2 -k start
55 ? S+ 0:00 grep apache
root@3399320f814e:/var/www/html# exit
exit
vagrant@ubuntu-14:~$ docker ps
CONTAINER ID IMAGE ....
vagrant@ubuntu-14:~$
Finished..
I'm looking forward to the event.
Finished..
I'm looking forward to the event.
Meow
(Thank you)

Mais conteúdo relacionado

Mais procurados

Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Michele Orselli
 
Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013Tomas Doran
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for DummiesŁukasz Proszek
 
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...Puppet
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012Carlos Sanchez
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Łukasz Proszek
 
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpecTest-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpecMartin Etmajer
 
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Puppet
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Michele Orselli
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with AnsibleIvan Serdyuk
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012Carlos Sanchez
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packerfrastel
 
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014Puppet
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksCarlos Sanchez
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopLorin Hochstein
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and AgentRanjit Avasarala
 

Mais procurados (19)

Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
 
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpecTest-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
 
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Vagrant
VagrantVagrant
Vagrant
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packer
 
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
 
Cialug August 2021
Cialug August 2021Cialug August 2021
Cialug August 2021
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and Agent
 

Destaque

Big query - Command line tools and Tips - (MOSG)
Big query - Command line tools and Tips - (MOSG)Big query - Command line tools and Tips - (MOSG)
Big query - Command line tools and Tips - (MOSG)Soshi Nemoto
 
Big query the first step - (MOSG)
Big query the first step - (MOSG)Big query the first step - (MOSG)
Big query the first step - (MOSG)Soshi Nemoto
 
CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)Soshi Nemoto
 
Posquit0 - Fabric을 이용한 ssh streamlining
Posquit0 - Fabric을 이용한 ssh streamliningPosquit0 - Fabric을 이용한 ssh streamlining
Posquit0 - Fabric을 이용한 ssh streamliningByungjin Park
 
Presentation on fabric
Presentation on fabricPresentation on fabric
Presentation on fabricSiya Agarwal
 

Destaque (6)

Big query - Command line tools and Tips - (MOSG)
Big query - Command line tools and Tips - (MOSG)Big query - Command line tools and Tips - (MOSG)
Big query - Command line tools and Tips - (MOSG)
 
Big query the first step - (MOSG)
Big query the first step - (MOSG)Big query the first step - (MOSG)
Big query the first step - (MOSG)
 
CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)
 
Posquit0 - Fabric을 이용한 ssh streamlining
Posquit0 - Fabric을 이용한 ssh streamliningPosquit0 - Fabric을 이용한 ssh streamlining
Posquit0 - Fabric을 이용한 ssh streamlining
 
Presentation on fabric
Presentation on fabricPresentation on fabric
Presentation on fabric
 
fabric study
fabric studyfabric study
fabric study
 

Semelhante a Preparation study of_docker - (MOSG)

Agile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Partner S.A.
 
Docker module 1
Docker module 1Docker module 1
Docker module 1Liang Bo
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017Paul Chao
 
Develop QNAP NAS App by Docker
Develop QNAP NAS App by DockerDevelop QNAP NAS App by Docker
Develop QNAP NAS App by DockerTerry Chen
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardwayDave Pitts
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 applicationRoman Rodomansky
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作Philip Zheng
 
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, OrchestrationThe Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, OrchestrationErica Windisch
 
Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant Ricardo Amaro
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with DockerPatrick Mizer
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Ben Hall
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇Philip Zheng
 
Docker in Action
Docker in ActionDocker in Action
Docker in ActionAlper Kanat
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortalsHenryk Konsek
 
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins Mando Stam
 
Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peekmsyukor
 

Semelhante a Preparation study of_docker - (MOSG) (20)

Agile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: Introduction
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
 
Develop QNAP NAS App by Docker
Develop QNAP NAS App by DockerDevelop QNAP NAS App by Docker
Develop QNAP NAS App by Docker
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardway
 
Docker
DockerDocker
Docker
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作
 
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, OrchestrationThe Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
 
Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant
 
Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
 
Docker
DockerDocker
Docker
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
 
Introducing Docker
Introducing DockerIntroducing Docker
Introducing Docker
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
 
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
 
Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peek
 

Último

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Último (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

Preparation study of_docker - (MOSG)

  • 3. Docker allows you to package an application with all of its dependencies into a standardized unit for software development. What is “Docker”? Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in. ( https://www.docker.com/what-docker )
  • 4. Docker VS Vagrant ?? Alternatively ?? NO!! Docker : a kind of Linux container Vagrant: Virtual machine manager
  • 5. Docker VS Vagrant ?? Alternatively ?? NO!! Docker : a kind of Linux container Vagrant: Virtual machine manager Docker Work on Host OS directory OS of Docker and Host OS is Same using host’s OS
  • 6. Docker VS Vagrant ?? Vagrant Emulated OS on Host OS Independent from Host OS. Virtual box VMware...
  • 7. Docker VS Vagrant ?? Vagrant Emulated OS on Host OS Independent from Host OS. where is Vagrant? Virtual box VMware...
  • 8. Docker VS Vagrant ?? Vagrant Emulated OS on Host OS Independent from Host OS. where is Vagrant? VM managemanet tool use various VM with same I/F. Virtual box VMware... I/F
  • 9. Today’s goal OSX Mac Book Air Linux on Linux on OSX A typical use case on OSX
  • 10. Today’s goal Linux on Linux on OSX OSX Mac Book Air Vagrant Virtual Box Linux A typical use case on OSX
  • 11. Today’s goal Linux on Linux on OSX OSX Mac Book Air Vagrant Virtual Box Linux Docker bin/libs A typical use case on OSX
  • 12. Today’s goal Linux on Linux on OSX A typical use case on OSX OSX Mac Book Air Vagrant Virtual Box Linux Docker bin/libs virtual machine (Linux) virtual machine (linux)
  • 13. Rough history of container chroot:(1979, 1983->BSD) Use user own env. change root directory. ex) /home/nemo => / jail : (2000) Quarantine/restrictions of OS resources. (≒Namespace) container : (2005, 2008->Linux) Namespace (mount:2002.... PID:2008) Cgroup (Quarantine/restrictions of HW resources) LXC : (2014 (ver.1)) The one you love. Docker : (2014 (ver.1)) The one you love.
  • 14. Rough history of Hypervisor VMware: (1999-) The first product which used by *many* engineer.(?) Xen : (2002) Use Linux kernel as Hypervisor KVM : (2006) Linux kernel include Xen like Hypervisor Virtual Box : (2007) proprietary software -> added OSS version. BHyVe : (2011) KVM for BSD, simple, small, cool(?)
  • 15. get tired a bit...
  • 16. Create Vagrant machine # coding: utf-8 # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.box = "ubuntu-14.04" config.vm.network "private_network", ip: "192.168.33.130" end $ vagrant box add utuntu-14.04 https://oss- binaries.phusionpassenger.com/vagrant/boxes/latest/ ubuntu-14.04-amd64-vbox.box : $ vagrant box list ubuntu-14.04 (virtualbox, 0) $ Add Vagrant box (ubuntu-14.04) Create Vagrantfile
  • 17. Setup Docker machine $ cat hosts [Docker-server] 192.168.33.130 (virtualbox, 0) $ cat setup.yml # setup docker server (base apps) - include: playbooks/server.yml # setup docker server - include: playbooks/docker.yml $ mkdir playbooks $ Create hosts, setup.yml, playbooks/
  • 18. Setup Docker machine $ cat playbooks/server.yml - hosts: Docker-server tasks: - name: "APT: update" become: yes apt: update_cache=yes - name: "APT: clean" become: yes shell: > apt-get -y autoclean; apt-get -y clean - name: "APT: install required apps" become: yes apt: pkg={{ item }} state=present update_cache=yes with_items: - git - unzip - emacs Create playbooks/server.yml (basic apps)
  • 19. Setup Docker machine Create playbooks/docker.yml Please check the official Docs https://docs.docker.com/engine/ installation/linux/ubuntulinux/
  • 20. Setup Docker machine - hosts: Docker-server tasks: # setup to add Docker to APT - name: "check Docker list file" - name: "Put docker list file" - name: "check Docker bin" - name: "APT: update" - name: "install apt auth related packagesr" - name: "get APT key" - name: "APT: update" - name: "APT: purge lxc-docker" - name: "APT : cache" # install Docker and start docker service - name: "APT: update" - name: "APT: add extra imager" - name: "APT: install Docker" - name: "service docker start" Create playbooks/docker.yml only steps.
  • 21. add Ansible provision into Vagrantfile # coding: utf-8 # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.box = "ubuntu-14.04" config.vm.network "private_network", ip: "192.168.33.130" # Ansible config.vm.provision "ansible" do |ansible| ansible.playbook = "./setup.yml" ansible.inventory_path = "./hosts" ansible.limit = "Docker-server" end end
  • 22. Setup Docker machine - hosts: Docker-server tasks: # setup to add Docker to APT - name: "check Docker list file" - name: "Put docker list file" - name: "check Docker bin" - name: "APT: update" - name: "install apt auth related packagesr" - name: "get APT key" - name: "APT: update" - name: "APT: purge lxc-docker" - name: "APT : caceh" # install Docker and start docker service - name: "APT: update" - name: "APT: add extra imager" - name: "APT: install Docker" - name: "service docker start" Create playbooks/docker.yml only steps. Please clone the repository
  • 23. Setup Docker machine $ git clone -b Docker git@github.com:nemo-soshi-mulodo/ OpenDevStudyGroup.git sample scripts.
  • 24. Again.. $ vagrant destroy $ vagrant up $ vagrant ssh Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64) * Documentation: https://help.ubuntu.com/ Last login: Thu Mar 24 05:30:32 2016 from 10.0.2.2 vagrant@ubuntu-14:~$ docker version Client: Version: 1.10.3 API version: 1.22 Go version: go1.5.3 Git commit: 20f81dd Built: Thu Mar 10 15:54:52 2016 OS/Arch: linux/amd64 Cannot connect to the Docker daemon. Is the docker daemon running on this host? vagrant@ubuntu-14:~$ sudo service docker status docker start/running, process 8511 vagrant@ubuntu-14:~$
  • 25. Create server vagrant@ubuntu-14:~$ docker pull php:7.0.2-apache 7.0.2-apache: Pulling from library/php 03e1855d4f31: Downloading 3.666 MB/51.36 MB a3ed95caeb02: Download complete 18f8f35c7f98: Downloading 3.311 MB/8.716 MB 252f4816c8e7: Downloading 3.222 MB/69.26 MB f8ac546f9ad6: Waiting 56eec5affd36: Waiting 8d6aa2f3838f: Waiting 082124b746bb: Waiting a237f42233ef: Waiting e532fb3215e9: Waiting c7e6a0f56f27: Waiting e1c620b7e144: Waiting 6953fe89923b: Waiting e5bfe4c72d64: Waiting
  • 26. Create server vagrant@ubuntu-14:~$ docker pull php:7.0.2-apache 7.0.2-apache: Pulling from library/php 03e1855d4f31: Downloading 3.666 MB/51.36 MB a3ed95caeb02: Download complete 18f8f35c7f98: Downloading 3.311 MB/8.716 MB 252f4816c8e7: Downloading 3.222 MB/69.26 MB f8ac546f9ad6: Waiting 56eec5affd36: Waiting 8d6aa2f3838f: Waiting 082124b746bb: Waiting a237f42233ef: Waiting e532fb3215e9: Waiting c7e6a0f56f27: Waiting e1c620b7e144: Waiting 6953fe89923b: Waiting e5bfe4c72d64: Waiting
  • 27. Create server vagrant@ubuntu-14:~$ docker pull php:7.0.2-apache 7.0.2-apache: Pulling from library/php 03e1855d4f31: Download complete a3ed95caeb02: Download complete 18f8f35c7f98: Download complete 252f4816c8e7: Download complete f8ac546f9ad6: Download complete 56eec5affd36: Download complete 8d6aa2f3838f: Download complete 082124b746bb: Download complete a237f42233ef: Download complete e532fb3215e9: Download complete c7e6a0f56f27: Download complete e1c620b7e144: Download complete 6953fe89923b: Download complete e5bfe4c72d64: Download complete Digest: sha256:b1e1421a1ca86660552025c00ed42906c6619daa1bcb9c477236b80fadc8f27b Status: Downloaded newer image for php:7.0.2-apache vagrant@ubuntu-14:~$
  • 28. check server vagrant@vagrant:~$ docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE php 7.0.2-apache 90e2c0e2fc5c 8 weeks ago 521 MB vagrant@vagrant:~$ docker run -d php:7.0.2-apache 1d5fc77e68dde86cbaea5716beef723c102b41e9b0240d44739b08ed83b09d1f vagrant@vagrant:~$ vagrant@vagrant:~$ docker ps CONTAINER ID IMAGE COMMAND .. 1d5fc77e68dd php:7.0.2-apache “apache2-foreground" .. vagrant@vagrant:~$ vagrant@ubuntu-14:~$ docker stop 1d5fc77e68dd 1d5fc77e68dd vagrant@ubuntu-14:~$ docker ps CONTAINER ID IMAGE COMMAND ... vagrant@vagrant:~$
  • 29. check server (2) vagrant@ubuntu-14:~$ docker run -it php:7.0.2-apache /bin/bash root@3399320f814e:/var/www/html# ps ax PID TTY STAT TIME COMMAND 1 ? Ss 0:00 /bin/bash 7 ? R+ 0:00 ps ax root@3399320f814e:/var/www/html# /etc/init.d/apache2 start [....] Starting web server: apache2AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message . ok root@3399320f814e:/var/www/html# ps -ax | grep apache 24 ? Ss 0:00 /usr/sbin/apache2 -k start 27 ? S 0:00 /usr/sbin/apache2 -k start 28 ? S 0:00 /usr/sbin/apache2 -k start 29 ? S 0:00 /usr/sbin/apache2 -k start 30 ? S 0:00 /usr/sbin/apache2 -k start 31 ? S 0:00 /usr/sbin/apache2 -k start 55 ? S+ 0:00 grep apache root@3399320f814e:/var/www/html# exit exit vagrant@ubuntu-14:~$ docker ps CONTAINER ID IMAGE .... vagrant@ubuntu-14:~$
  • 31. Finished.. I'm looking forward to the event. Meow (Thank you)