SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Downloaden Sie, um offline zu lesen
From zero to
Docker
Giovanni Toraldo
@ LuccaLUG
Docker: what is it?
Enables software developers to:
● package an application
● with all dependencies
● runs it everywhere unchanged
Docker: what is it?
Enables system administrators to
● simplify application deployment
● ease scale-up & scale-down
● processes separation
Underlying technologies
● Linux namespaces
● Control Groups (cgroups)
● Layered filesystems
● LXC (now libcontainer)
Glossary
● Image: immutable snapshot of a container,
push/pull repository
● Container: an instance launched from an image
● Volume: persistent writable area of a container
● Registry: repository of images (versioned via
tags)
● Dockerfile: the descriptor from which an image
is built
How to install docker engine
● GNU/Linux
deb https://apt.dockerproject.org/repo ubuntu-trusty main
deb https://apt.dockerproject.org/repo debian-jessie main
pacman -S docker
● Windows / OSX
https://www.docker.com/products/docker-toolbox
Docker-machine
Machine manager (like Vagrant)
https://github.com/docker/machine
(Win/Mac: distributed in Docker toolkit)
● Launch VM somewhere
● Install Docker
● Generates and copy certificates
○ (password-less auth)
● Enable remote access via TCP
Docker-machine backends
Where nodes can run?
● Generic backend
○ existing hosts with ssh access
● Local machine (virtualization)
○ Virtualbox
○ VMware Fusion
● Cloud providers
○ Amazon
○ GCE
○ Rackspace
○ DigitalOcean
○ ...
Docker-machine bootstrap examples
$ docker-machine create --driver generic --generic-ip-address=<ip-address>
<nodename>
$ docker-machine create --driver virtualbox <nodename>
$ docker-machine create --driver digitalocean --digitalocean-access-token <token>
<nodename>
$ docker-machine create --driver amazonec2 --amazonec2-access-key <key> --
amazonec2-secret-key <secret> <nodename>
$ docker-machine create --driver kvm --kvm-cpu-count 2 --kvm-disk-size 20 --kvm-
memory 4096 <nodename>
Interaction with a Docker-machine node
$ docker-machine env default
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/home/gionn/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell:
# eval "$(docker-machine env default)"
$ docker info
Kernel Version: 4.1.17-boot2docker
Operating System: Boot2Docker 1.10.0 (TCL 6.4.1); master : b09ed60 - Thu Feb 4
20:16:08 UTC 2016
Hello world
$ docker run -ti ubuntu:14.04 /bin/bash
● Live demo time
What happens under the hood?
● Pulls the ubuntu image from registry
● Creates a new container
○ Allocates a rw filesystem
○ Allocates a network interface (on a bridge)
○ Sets up network (IP address, dns..)
● Launch a process in the container
● Captures and provides application output
Container terminates when the process exit
Dockerfile (not the best example)
Standard workflow
Build & push:
● docker build -t gionn/nodejs-app:1.0.0 .
○ a tagged image is generated
● docker push gionn/nodejs-app:1.0.0
○ publish to repository
Pull & run:
● docker pull gionn/nodejs-app:1.0.0
○ fetch from repository
● docker run gionn/nodejs-app:1.0.0
○ run container from this image
Docker compose
Compose is a tool for defining and running multi-container
Docker applications using a file in YML format.
$ docker-compose up
Examples:
https://github.com/ClouDesire/docker-compose-library
Thanks!

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Docker / Ansible
Docker / AnsibleDocker / Ansible
Docker / Ansible
 
Docker Compose to Production with Docker Swarm
Docker Compose to Production with Docker SwarmDocker Compose to Production with Docker Swarm
Docker Compose to Production with Docker Swarm
 
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) ItalyClustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
 
Docker at Flux7
Docker at Flux7Docker at Flux7
Docker at Flux7
 
ContainerDayVietnam2016: Lesson Leanred on Docker 1.12 and Swarm Mode
ContainerDayVietnam2016: Lesson Leanred on Docker 1.12 and Swarm ModeContainerDayVietnam2016: Lesson Leanred on Docker 1.12 and Swarm Mode
ContainerDayVietnam2016: Lesson Leanred on Docker 1.12 and Swarm Mode
 
Docker 原理與實作
Docker 原理與實作Docker 原理與實作
Docker 原理與實作
 
From Docker Run To Docker Compose
From Docker Run To Docker ComposeFrom Docker Run To Docker Compose
From Docker Run To Docker Compose
 
Learn docker in 90 minutes
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutes
 
GDG Lima - Docker Compose
GDG Lima - Docker ComposeGDG Lima - Docker Compose
GDG Lima - Docker Compose
 
Running Docker with OpenStack | Docker workshop #1
Running Docker with OpenStack | Docker workshop #1Running Docker with OpenStack | Docker workshop #1
Running Docker with OpenStack | Docker workshop #1
 
Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4Academy PRO: Docker. Part 4
Academy PRO: Docker. Part 4
 
Introduction to docker swarm
Introduction to docker swarmIntroduction to docker swarm
Introduction to docker swarm
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
 
Hide your development environment and application in a container
Hide your development environment and application in a containerHide your development environment and application in a container
Hide your development environment and application in a container
 
Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1Academy PRO: Docker. Part 1
Academy PRO: Docker. Part 1
 
Docker n co
Docker n coDocker n co
Docker n co
 
Docker, Docker Swarm mangement tool - Gorae
Docker, Docker Swarm mangement tool - GoraeDocker, Docker Swarm mangement tool - Gorae
Docker, Docker Swarm mangement tool - Gorae
 
Swarm: Native Docker Clustering
Swarm: Native Docker ClusteringSwarm: Native Docker Clustering
Swarm: Native Docker Clustering
 
Docker orchestration
Docker orchestrationDocker orchestration
Docker orchestration
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 

Andere mochten auch

Rabbit mq messaginginthecloud_v_mworld_2010_ms
Rabbit mq messaginginthecloud_v_mworld_2010_msRabbit mq messaginginthecloud_v_mworld_2010_ms
Rabbit mq messaginginthecloud_v_mworld_2010_ms
Rabbit MQ
 
Docker Deployments
Docker DeploymentsDocker Deployments
Docker Deployments
Docker, Inc.
 

Andere mochten auch (20)

Docker, From zero to hero
Docker, From zero to heroDocker, From zero to hero
Docker, From zero to hero
 
Easy applications deployment on OpenStack clouds
Easy applications deployment on OpenStack cloudsEasy applications deployment on OpenStack clouds
Easy applications deployment on OpenStack clouds
 
Docker zero
Docker zeroDocker zero
Docker zero
 
Dockers zero to hero - (medium version)
Dockers zero to hero - (medium version)Dockers zero to hero - (medium version)
Dockers zero to hero - (medium version)
 
Docker: from zero to nonzero
Docker: from zero to nonzeroDocker: from zero to nonzero
Docker: from zero to nonzero
 
Rabbit mq messaginginthecloud_v_mworld_2010_ms
Rabbit mq messaginginthecloud_v_mworld_2010_msRabbit mq messaginginthecloud_v_mworld_2010_ms
Rabbit mq messaginginthecloud_v_mworld_2010_ms
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
From Zero to Hero - Nexinto
From Zero to Hero - NexintoFrom Zero to Hero - Nexinto
From Zero to Hero - Nexinto
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Introduction To Docker
Introduction To DockerIntroduction To Docker
Introduction To Docker
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
From zero to hero with Docker
From zero to hero with DockerFrom zero to hero with Docker
From zero to hero with Docker
 
The DevOps Hero Toolkit: Nexus, Jenkins and Docker
The DevOps Hero Toolkit: Nexus, Jenkins and DockerThe DevOps Hero Toolkit: Nexus, Jenkins and Docker
The DevOps Hero Toolkit: Nexus, Jenkins and Docker
 
Zero downtime-java-deployments-with-docker-and-kubernetes
Zero downtime-java-deployments-with-docker-and-kubernetesZero downtime-java-deployments-with-docker-and-kubernetes
Zero downtime-java-deployments-with-docker-and-kubernetes
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
NetflixOSS and ZeroToDocker Talk
NetflixOSS and ZeroToDocker TalkNetflixOSS and ZeroToDocker Talk
NetflixOSS and ZeroToDocker Talk
 
Docker Deployments
Docker DeploymentsDocker Deployments
Docker Deployments
 
Docker: the road ahead
Docker: the road aheadDocker: the road ahead
Docker: the road ahead
 
Scaling Your App With Docker Swarm using Terraform, Packer on Openstack
Scaling Your App With Docker Swarm using Terraform, Packer on OpenstackScaling Your App With Docker Swarm using Terraform, Packer on Openstack
Scaling Your App With Docker Swarm using Terraform, Packer on Openstack
 
Docker Online Meetup: Infrakit update and Q&A
Docker Online Meetup: Infrakit update and Q&ADocker Online Meetup: Infrakit update and Q&A
Docker Online Meetup: Infrakit update and Q&A
 

Ähnlich wie From zero to Docker

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
 

Ähnlich wie From zero to Docker (20)

Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 
Docker.pdf
Docker.pdfDocker.pdf
Docker.pdf
 
Introducing Docker
Introducing DockerIntroducing Docker
Introducing Docker
 
Docker
DockerDocker
Docker
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
 
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
 
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme PetazzoniWorkshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
 
Introduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" EditionIntroduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" Edition
 
Docker
DockerDocker
Docker
 
Docker
DockerDocker
Docker
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
 
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
 
Présentation de Docker
Présentation de DockerPrésentation de Docker
Présentation de Docker
 
Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
 
Develop QNAP NAS App by Docker
Develop QNAP NAS App by DockerDevelop QNAP NAS App by Docker
Develop QNAP NAS App by Docker
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and Jenkins
 
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+java
Docker+javaDocker+java
Docker+java
 

Mehr von Giovanni Toraldo

Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)
Giovanni Toraldo
 
Docker in production service discovery with consul - road to opscon 2015
Docker in production  service discovery with consul - road to opscon 2015Docker in production  service discovery with consul - road to opscon 2015
Docker in production service discovery with consul - road to opscon 2015
Giovanni Toraldo
 
Cloud Computing in practice with OpenNebula ~ Develer workshop 2012
Cloud Computing in practice with OpenNebula ~ Develer workshop 2012Cloud Computing in practice with OpenNebula ~ Develer workshop 2012
Cloud Computing in practice with OpenNebula ~ Develer workshop 2012
Giovanni Toraldo
 
An introduction to cloud computing
An introduction to cloud computingAn introduction to cloud computing
An introduction to cloud computing
Giovanni Toraldo
 

Mehr von Giovanni Toraldo (12)

About code review and BUGS
About code review and BUGSAbout code review and BUGS
About code review and BUGS
 
Introduction to Traefik
Introduction to TraefikIntroduction to Traefik
Introduction to Traefik
 
Managing GCP Projects with Terraform (devfest Pisa 2018)
Managing GCP Projects with Terraform (devfest Pisa 2018)Managing GCP Projects with Terraform (devfest Pisa 2018)
Managing GCP Projects with Terraform (devfest Pisa 2018)
 
Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)Continuous Delivery: 5 years later (Incontro DevOps 2018)
Continuous Delivery: 5 years later (Incontro DevOps 2018)
 
Software Delivery in 2016 - A Continuous Delivery Approach
Software Delivery in 2016 - A Continuous Delivery ApproachSoftware Delivery in 2016 - A Continuous Delivery Approach
Software Delivery in 2016 - A Continuous Delivery Approach
 
Docker in production service discovery with consul - road to opscon 2015
Docker in production  service discovery with consul - road to opscon 2015Docker in production  service discovery with consul - road to opscon 2015
Docker in production service discovery with consul - road to opscon 2015
 
Introduction to Continuous Delivery
Introduction to Continuous DeliveryIntroduction to Continuous Delivery
Introduction to Continuous Delivery
 
ClouDesire @ Italian DevOps Initiative 2013 #idi2013
ClouDesire @ Italian DevOps Initiative 2013 #idi2013ClouDesire @ Italian DevOps Initiative 2013 #idi2013
ClouDesire @ Italian DevOps Initiative 2013 #idi2013
 
Cloud Computing in practice with OpenNebula ~ Develer workshop 2012
Cloud Computing in practice with OpenNebula ~ Develer workshop 2012Cloud Computing in practice with OpenNebula ~ Develer workshop 2012
Cloud Computing in practice with OpenNebula ~ Develer workshop 2012
 
An introduction to cloud computing
An introduction to cloud computingAn introduction to cloud computing
An introduction to cloud computing
 
EVA Florence 2012 ~ Open low-cost HA cluster cloud
EVA Florence 2012 ~ Open low-cost HA cluster cloudEVA Florence 2012 ~ Open low-cost HA cluster cloud
EVA Florence 2012 ~ Open low-cost HA cluster cloud
 
Open@BNCF
Open@BNCFOpen@BNCF
Open@BNCF
 

Kürzlich hochgeladen

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Kürzlich hochgeladen (20)

%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 

From zero to Docker

  • 1. From zero to Docker Giovanni Toraldo @ LuccaLUG
  • 2. Docker: what is it? Enables software developers to: ● package an application ● with all dependencies ● runs it everywhere unchanged
  • 3. Docker: what is it? Enables system administrators to ● simplify application deployment ● ease scale-up & scale-down ● processes separation
  • 4. Underlying technologies ● Linux namespaces ● Control Groups (cgroups) ● Layered filesystems ● LXC (now libcontainer)
  • 5.
  • 6. Glossary ● Image: immutable snapshot of a container, push/pull repository ● Container: an instance launched from an image ● Volume: persistent writable area of a container ● Registry: repository of images (versioned via tags) ● Dockerfile: the descriptor from which an image is built
  • 7. How to install docker engine ● GNU/Linux deb https://apt.dockerproject.org/repo ubuntu-trusty main deb https://apt.dockerproject.org/repo debian-jessie main pacman -S docker ● Windows / OSX https://www.docker.com/products/docker-toolbox
  • 8.
  • 9. Docker-machine Machine manager (like Vagrant) https://github.com/docker/machine (Win/Mac: distributed in Docker toolkit) ● Launch VM somewhere ● Install Docker ● Generates and copy certificates ○ (password-less auth) ● Enable remote access via TCP
  • 10. Docker-machine backends Where nodes can run? ● Generic backend ○ existing hosts with ssh access ● Local machine (virtualization) ○ Virtualbox ○ VMware Fusion ● Cloud providers ○ Amazon ○ GCE ○ Rackspace ○ DigitalOcean ○ ...
  • 11. Docker-machine bootstrap examples $ docker-machine create --driver generic --generic-ip-address=<ip-address> <nodename> $ docker-machine create --driver virtualbox <nodename> $ docker-machine create --driver digitalocean --digitalocean-access-token <token> <nodename> $ docker-machine create --driver amazonec2 --amazonec2-access-key <key> -- amazonec2-secret-key <secret> <nodename> $ docker-machine create --driver kvm --kvm-cpu-count 2 --kvm-disk-size 20 --kvm- memory 4096 <nodename>
  • 12. Interaction with a Docker-machine node $ docker-machine env default export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://192.168.99.100:2376" export DOCKER_CERT_PATH="/home/gionn/.docker/machine/machines/default" export DOCKER_MACHINE_NAME="default" # Run this command to configure your shell: # eval "$(docker-machine env default)" $ docker info Kernel Version: 4.1.17-boot2docker Operating System: Boot2Docker 1.10.0 (TCL 6.4.1); master : b09ed60 - Thu Feb 4 20:16:08 UTC 2016
  • 13. Hello world $ docker run -ti ubuntu:14.04 /bin/bash ● Live demo time
  • 14. What happens under the hood? ● Pulls the ubuntu image from registry ● Creates a new container ○ Allocates a rw filesystem ○ Allocates a network interface (on a bridge) ○ Sets up network (IP address, dns..) ● Launch a process in the container ● Captures and provides application output Container terminates when the process exit
  • 15. Dockerfile (not the best example)
  • 16. Standard workflow Build & push: ● docker build -t gionn/nodejs-app:1.0.0 . ○ a tagged image is generated ● docker push gionn/nodejs-app:1.0.0 ○ publish to repository Pull & run: ● docker pull gionn/nodejs-app:1.0.0 ○ fetch from repository ● docker run gionn/nodejs-app:1.0.0 ○ run container from this image
  • 17. Docker compose Compose is a tool for defining and running multi-container Docker applications using a file in YML format. $ docker-compose up Examples: https://github.com/ClouDesire/docker-compose-library