SlideShare a Scribd company logo
1 of 59
Download to read offline
Docker Essentials
Andrei
Manea
Founder CloudHero
@andrei_821
Workshop Agenda
● Getting started with containers
○ How to build an image
■ Base images
■ Dockerfile
■ Docker build
■ Docker commit
○ Docker tags
○ Push / Pull image
○ Docker Volumes
Workshop Agenda
● A bit of history about orchestration
● Introduction to services
○ What is a service
○ Creating services
○ Scaling Services
○ Rolling Updates
Prerequisites
● Docker Running on your Laptop
○ Docker for Mac / Windows
● Git
○ git clone
https://github.com/andrei821/orchestration-workshop.git
What is a Docker Container ?
What is Docker ?
CloudHero - Bucharest 2015
Lightweight runtime and packaging tool
VM
Kernel OS Libs
App Libs
App Binary
(process)
VM
Kernel OS Libs
App Libs
App Binary
(process)
User Space
VM
Kernel OS Libs
App Libs
App Binary
(process)
App Libs
App Binary
(process)
User Space
App Libs
App
Binary
(process)
OS Libs
App Libs
App
Binary
(process)
OS Libs
Image
App Libs
App
Binary
(process)
OS Libs
Image
User Space
VM
Kernel
App Libs
App
Binary
(process)
OS Libs
Container
App Libs
App
Binary
(process)
OS Libs
Container
User Space
Key Takeaways
● Containers are NOT VM’s or mini VM’s or Servers
○ So they DO NOT BOOT
● Containers are just Containers
○ Packs of binaries and libraries that are executed on a
shared kernel in their own name space.
● They provide great portability and some extra layer of security
Docker for MAC / Docker for Windows
The marketplace for validated software
and tools available in Docker format for
businesses and publishers
• Easy search and deploy
• Trusted and compliant
• https://store.docker.com
The Docker Store
Getting Started With
Containers
App Libs
App
Binary
(process)
OS Libs
Image
User Space
VM
Kernel
App Libs
App
Binary
(process)
OS Libs
Container
App Libs
App
Binary
(process)
OS Libs
Container
User Space
The Docker Magic
Try to run figlet on your computer
(just type figlet)
The Docker Magic
docker run -ti --name figlet ubuntu bash
The Docker Magic
apt-get update && apt-get install figlet
The Docker Magic
figlet “Innovation Labs”
The Dockerfile
FROM ubuntu:trusty
MAINTAINER Andrei Manea <andrei@cloudhero.io>
# Install base packages
RUN apt-get update && 
DEBIAN_FRONTEND=noninteractive apt-get -yq install 
curl 
apache2
Source: https://github.com/cloud-hero/apache-php
INSTRUCTION statement
Building an Image
Building an image allows you to create your own custom
images that you can use and share with others.
Building an Image
git https://github.com/cloud-hero/apache-php.git docker-demo
cd docker-demo
docker build -t cloudhero/apache-php .
docker images ls
Source: https://github.com/cloud-hero/apache-php
Managing Images
List images:
docker images
Delete images:
docker rmi image_name / id
docker images
Committing an Image
Committing an image allows you to create your own custom
images from running containers.
Committing an Image
docker run -ti ubuntu bash
root@9923jj4a9 apt update && apt install nginx-full
---
docker ps -a
docker commit -m “Added Nginx” -a “Andrei Manea” 9923jj4a9
nginx-ubuntu:latest
docker images ls
Settings Tags on an Image
Tags (or image names) can be used to organise and find
images easier.
Settings Tags on an Image
docker tag 9923jj4a9 my-hub-id/nginx-ubuntu:latest
Push an Images to Docker Hub / Store
Once you’ve built or created a new image you can push it to
Docker Hub using the docker push command.
This allows you to share it with others, either publicly, or push it
into a private repository.
Push an Images to Docker Hub / Store
docker push my-hub-id/nginx-ubuntu:latest
Getting Started w/ Containers
Managing Containers
We can list all the running container.
docker container ls
And then all the container existing on the host.
docker container ls -a
From this list, get the id of the container in which we installed the figlet package and restart the
container using the ‘start’ command.
docker container start CONTAINER_ID
Run an interactive shell in this container. We will use the exec command to do so.
docker container exec -ti CONTAINER_ID bash
figlet Still Here!
exit
Managing Containers
We can list all the running container.
docker container ls
And then all the container existing on the host.
docker container ls -a
From this list, get the id of the container that you want to delete.
docker container rm CONTAINER_ID (or force a running container with `rm -f`)
Mass deletion of containers.
docker container ls -aq
Docker container rm `docker container ls -aq`
Persistent Storage: Volumes
Data persistency without a Volume
Let’s run an interactive shell within an alpine container named c1.
docker container run --name c1 -ti alpine sh
We will create the /data folder and a dummy hello.txt file in it.
mkdir /data && cd /data && touch hello.txt
We will then check how the read-write layer (container layer) is accessible from the host.
Let exit the container first
exit
Let’s inspect our container in order to get the location of the container’s layer. We can use the
inspect command and then scroll into the output until the GraphDriver key, like the following.
docker container inspect -f "{{ json .GraphDriver }}" c1 | python -m
json.tool
Data persistency without a Volume
ls /graph/overlay2/[YOUR_ID]/diff/data
docker container rm c1
It seems the folder defined in the UpperDir above does not exist anymore. Do
you confirm that ? Try running the ls command again and see the results.
Data persistency with a Volume
Defining a volume in a Dockerfile
FROM alpine
VOLUME ["/data"]
ENTRYPOINT ["/bin/sh"]
Let’s build an image from this Dockerfile.
docker image build -t img1 .
docker container run --name c2 -ti img1
We should then end up in a shell within the container. From there, we will go into /data and create a
hello.txt file.
cd /data
touch hello.txt
ls
Data persistency with a Volume
Let’s create a container from the alpine image, we’ll use the -d option so it runs in background
and also define a volume on /data as we’ve done previously. In order the PID 1 process remains
active, we use the following command that pings Google DNS and log the output in a file within
the /data folder.
ping 8.8.8.8 > /data/ping.txt
The container is ran that way:
docker container run --name c3 -d -v /data alpine sh -c 'ping 8.8.8.8 >
/data/ping.txt'
Data Volume API
The volume API introduced in Docker 1.9 enables to perform operations on volume very easily.
First have a look at the commands available in the volume API.
docker volume --help
We will start with the create command, and create a volume named html.
docker volume create --name html
If we list the existing volume, our html volume should be the only one.
docker volume ls
The output should be something like
DRIVER VOLUME NAME
[other previously created volumes]
local html
docker container run --name www -d -p 8080:80 -v html:/usr/share/nginx/html nginx
A bit of networking!
The Docker Network Command
The docker network command is the main command for configuring and managing
container networks. Run the docker network command from the first terminal.
docker network
Run a docker network ls command to view existing container networks on the current
Docker host.
docker network ls
Every clean installation of Docker comes with a pre-built network called bridge. Verify this
with the docker network ls.
All networks created with the bridge driver are based on a Linux bridge (a.k.a. a virtual
switch).
The Docker Bridge Network
The Docker Swarm Network
Now, what are services?
Docker service is a part of Docker’s native approach for container
orchestration
● transition from deploying containers individually on a single host, to deploying
complex multi-container apps on many machines.
● a distributed platform, independent from infrastructure, that stays online through
the entire lifetime of your application, surviving hardware failure and software
updates.
Container Orchestration is:
docker swarm init --advertise-addr
$(hostname -i)
Copy the join command (watch out for newlines) output
and paste it in the other terminal.
Get a Docker
Swarm Cluster
Create Services
Test
Update
Scale
Type the below command in the first terminal:
docker node ls
That last line will show you a list of all the nodes, something like this:
ID HOSTNAME STATUS
AVAILABILITY MANAGER STATUS
kytp4gq5mrvmdbb0qpifdxeiv * node1 Ready Active
Leader
lz1j4d6290j8lityk4w0cxls5 node2 Ready Active
If you try to execute an administrative command in a non-leader node
worker, you’ll get an error. Try it here:
docker node ls
Get a Docker
Swarm Cluster
Create Services
Test
Update
Scale
Get a Docker
Swarm Cluster
Create Services
Test
Update
Scale
Scalable and Highly Available Hello-World With Docker
docker service create --name hello -p 80:80
cloudhero/apache-php
Get a Docker
Swarm Cluster
Create Services
Test
Update
Scale
Scalable and Highly Available Hello-World With Docker
Set your browser to:
http://localhost:80
Get a Docker
Swarm Cluster
Create Services
Test
Update
Scale
Scalable and Highly Available Hello-World With Docker
Scale Up:
docker service scale hello=3
Let’s check our service status:
docker service ps hello
Get a Docker
Swarm Cluster
Create Services
Test
Update
Scale
Scalable and Highly Available Hello-World With Docker
Set your browser to:
http://localhost:80
And refresh multiple times:
Get a Docker
Swarm Cluster
Create Services
Test
Update
Scale
Scalable and Highly Available Hello-World With Docker
Scale Down:
docker service scale hello=2
Let’s check our service status:
docker service ps hello
Get a Docker
Swarm Cluster
Create Services
Test
Update
Scale
Scalable and Highly Available Hello-World With Docker
Set your browser to:
http://localhost:80
And refresh multiple times:
Get a Docker
Swarm Cluster
Create Services
Test
Update
Scale
Scalable and Highly Available Hello-World With Docker
Update Publisher Port
docker service update --publish-add 81:80
hello
docker services ls
Set your browser to:
http://localhost:81
Thank you!

More Related Content

What's hot

TensorFlow, Docker & GoLang - All for Image Rekognition Sangam Biradar(Engine...
TensorFlow, Docker & GoLang - All for Image Rekognition Sangam Biradar(Engine...TensorFlow, Docker & GoLang - All for Image Rekognition Sangam Biradar(Engine...
TensorFlow, Docker & GoLang - All for Image Rekognition Sangam Biradar(Engine...sangam biradar
 
DockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with DockerDockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with DockerDocker, Inc.
 
Enable Fig to deploy to multiple Docker servers by Willy Kuo
Enable Fig to deploy to multiple Docker servers by Willy KuoEnable Fig to deploy to multiple Docker servers by Willy Kuo
Enable Fig to deploy to multiple Docker servers by Willy KuoDocker, Inc.
 
Deep dive in container service discovery
Deep dive in container service discoveryDeep dive in container service discovery
Deep dive in container service discoveryDocker, Inc.
 
Making kubernetes simple for developers
Making kubernetes simple for developersMaking kubernetes simple for developers
Making kubernetes simple for developersSuraj Deshmukh
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windowsDocker, Inc.
 
2016 - Continuously Delivering Microservices in Kubernetes using Jenkins
2016 - Continuously Delivering Microservices in Kubernetes using Jenkins2016 - Continuously Delivering Microservices in Kubernetes using Jenkins
2016 - Continuously Delivering Microservices in Kubernetes using Jenkinsdevopsdaysaustin
 
Kubernetes101 - Pune Kubernetes Meetup 6
Kubernetes101 - Pune Kubernetes Meetup 6Kubernetes101 - Pune Kubernetes Meetup 6
Kubernetes101 - Pune Kubernetes Meetup 6Harshal Shah
 
DevOps Summit 2016 - The immutable Journey
DevOps Summit 2016 - The immutable JourneyDevOps Summit 2016 - The immutable Journey
DevOps Summit 2016 - The immutable Journeysmalltown
 
DockerCon EU 2015: From Local Development to Production Deployments using Ama...
DockerCon EU 2015: From Local Development to Production Deployments using Ama...DockerCon EU 2015: From Local Development to Production Deployments using Ama...
DockerCon EU 2015: From Local Development to Production Deployments using Ama...Docker, Inc.
 
Continuous Deployment with Jenkins on Kubernetes
Continuous Deployment with Jenkins on KubernetesContinuous Deployment with Jenkins on Kubernetes
Continuous Deployment with Jenkins on KubernetesMatt Baldwin
 
Docker + Tenserflow + GOlang - Golang singapore Meetup
Docker + Tenserflow + GOlang - Golang singapore MeetupDocker + Tenserflow + GOlang - Golang singapore Meetup
Docker + Tenserflow + GOlang - Golang singapore Meetupsangam biradar
 
Docker for Developers - Part 2 by Borja Burgos and Fernando Mayo
Docker for Developers - Part 2 by Borja Burgos and Fernando MayoDocker for Developers - Part 2 by Borja Burgos and Fernando Mayo
Docker for Developers - Part 2 by Borja Burgos and Fernando MayoDocker, Inc.
 
Red hat ansible automation technical deck
Red hat ansible automation technical deckRed hat ansible automation technical deck
Red hat ansible automation technical deckJuraj Hantak
 
How To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeHow To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeDocker, Inc.
 
Enabling Microservices @Orbitz - DockerCon 2015
Enabling Microservices @Orbitz - DockerCon 2015Enabling Microservices @Orbitz - DockerCon 2015
Enabling Microservices @Orbitz - DockerCon 2015Steve Hoffman
 
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipelineKubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipelineKubeAcademy
 
Docker storage designing a platform for persistent data
Docker storage designing a platform for persistent dataDocker storage designing a platform for persistent data
Docker storage designing a platform for persistent dataDocker, Inc.
 
Docker Swarm 1.12 Overview and Demo
Docker Swarm 1.12 Overview and DemoDocker Swarm 1.12 Overview and Demo
Docker Swarm 1.12 Overview and DemoBrian Christner
 

What's hot (20)

TensorFlow, Docker & GoLang - All for Image Rekognition Sangam Biradar(Engine...
TensorFlow, Docker & GoLang - All for Image Rekognition Sangam Biradar(Engine...TensorFlow, Docker & GoLang - All for Image Rekognition Sangam Biradar(Engine...
TensorFlow, Docker & GoLang - All for Image Rekognition Sangam Biradar(Engine...
 
DockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with DockerDockerCon EU 2015: Trading Bitcoin with Docker
DockerCon EU 2015: Trading Bitcoin with Docker
 
Enable Fig to deploy to multiple Docker servers by Willy Kuo
Enable Fig to deploy to multiple Docker servers by Willy KuoEnable Fig to deploy to multiple Docker servers by Willy Kuo
Enable Fig to deploy to multiple Docker servers by Willy Kuo
 
Deep dive in container service discovery
Deep dive in container service discoveryDeep dive in container service discovery
Deep dive in container service discovery
 
Making kubernetes simple for developers
Making kubernetes simple for developersMaking kubernetes simple for developers
Making kubernetes simple for developers
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windows
 
2016 - Continuously Delivering Microservices in Kubernetes using Jenkins
2016 - Continuously Delivering Microservices in Kubernetes using Jenkins2016 - Continuously Delivering Microservices in Kubernetes using Jenkins
2016 - Continuously Delivering Microservices in Kubernetes using Jenkins
 
Kubernetes101 - Pune Kubernetes Meetup 6
Kubernetes101 - Pune Kubernetes Meetup 6Kubernetes101 - Pune Kubernetes Meetup 6
Kubernetes101 - Pune Kubernetes Meetup 6
 
My kubernetes toolkit
My kubernetes toolkitMy kubernetes toolkit
My kubernetes toolkit
 
DevOps Summit 2016 - The immutable Journey
DevOps Summit 2016 - The immutable JourneyDevOps Summit 2016 - The immutable Journey
DevOps Summit 2016 - The immutable Journey
 
DockerCon EU 2015: From Local Development to Production Deployments using Ama...
DockerCon EU 2015: From Local Development to Production Deployments using Ama...DockerCon EU 2015: From Local Development to Production Deployments using Ama...
DockerCon EU 2015: From Local Development to Production Deployments using Ama...
 
Continuous Deployment with Jenkins on Kubernetes
Continuous Deployment with Jenkins on KubernetesContinuous Deployment with Jenkins on Kubernetes
Continuous Deployment with Jenkins on Kubernetes
 
Docker + Tenserflow + GOlang - Golang singapore Meetup
Docker + Tenserflow + GOlang - Golang singapore MeetupDocker + Tenserflow + GOlang - Golang singapore Meetup
Docker + Tenserflow + GOlang - Golang singapore Meetup
 
Docker for Developers - Part 2 by Borja Burgos and Fernando Mayo
Docker for Developers - Part 2 by Borja Burgos and Fernando MayoDocker for Developers - Part 2 by Borja Burgos and Fernando Mayo
Docker for Developers - Part 2 by Borja Burgos and Fernando Mayo
 
Red hat ansible automation technical deck
Red hat ansible automation technical deckRed hat ansible automation technical deck
Red hat ansible automation technical deck
 
How To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeHow To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and Compose
 
Enabling Microservices @Orbitz - DockerCon 2015
Enabling Microservices @Orbitz - DockerCon 2015Enabling Microservices @Orbitz - DockerCon 2015
Enabling Microservices @Orbitz - DockerCon 2015
 
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipelineKubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
 
Docker storage designing a platform for persistent data
Docker storage designing a platform for persistent dataDocker storage designing a platform for persistent data
Docker storage designing a platform for persistent data
 
Docker Swarm 1.12 Overview and Demo
Docker Swarm 1.12 Overview and DemoDocker Swarm 1.12 Overview and Demo
Docker Swarm 1.12 Overview and Demo
 

Similar to Docker Essentials Workshop— Innovation Labs July 2020

Docker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps DevelopmentDocker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps Developmentmsyukor
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshopRuncy Oommen
 
Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers Will Hall
 
Docker for developers z java
Docker for developers z javaDocker for developers z java
Docker for developers z javaandrzejsydor
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday developmentJustyna Ilczuk
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxIgnacioTamayo2
 
Containerizing Web Application with Docker
Containerizing Web Application with DockerContainerizing Web Application with Docker
Containerizing Web Application with Dockermsyukor
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇Philip Zheng
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdfOKLABS
 
Introduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeIntroduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeDr. Ketan Parmar
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017Paul Chao
 
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 ContainerGuido Schmutz
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 applicationRoman Rodomansky
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안양재동 코드랩
 
Hands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbiesHands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbiesYigal Elefant
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Paul Chao
 

Similar to Docker Essentials Workshop— Innovation Labs July 2020 (20)

Docker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps DevelopmentDocker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps Development
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
 
Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers Docker Command Line, Using and Choosing containers
Docker Command Line, Using and Choosing containers
 
Docker for developers z java
Docker for developers z javaDocker for developers z java
Docker for developers z java
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 
Containerizing Web Application with Docker
Containerizing Web Application with DockerContainerizing Web Application with Docker
Containerizing Web Application with Docker
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdf
 
Introduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeIntroduction of Docker and Docker Compose
Introduction of Docker and Docker Compose
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
 
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
 
Docker
DockerDocker
Docker
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
 
Docker
DockerDocker
Docker
 
Docker @ Atlogys
Docker @ AtlogysDocker @ Atlogys
Docker @ Atlogys
 
Hands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbiesHands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbies
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung
 

Recently uploaded

Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 

Recently uploaded (20)

Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 

Docker Essentials Workshop— Innovation Labs July 2020

  • 3. Workshop Agenda ● Getting started with containers ○ How to build an image ■ Base images ■ Dockerfile ■ Docker build ■ Docker commit ○ Docker tags ○ Push / Pull image ○ Docker Volumes
  • 4. Workshop Agenda ● A bit of history about orchestration ● Introduction to services ○ What is a service ○ Creating services ○ Scaling Services ○ Rolling Updates
  • 5. Prerequisites ● Docker Running on your Laptop ○ Docker for Mac / Windows ● Git ○ git clone https://github.com/andrei821/orchestration-workshop.git
  • 6. What is a Docker Container ?
  • 7. What is Docker ? CloudHero - Bucharest 2015 Lightweight runtime and packaging tool
  • 8. VM Kernel OS Libs App Libs App Binary (process)
  • 9. VM Kernel OS Libs App Libs App Binary (process) User Space
  • 10. VM Kernel OS Libs App Libs App Binary (process) App Libs App Binary (process) User Space
  • 14. User Space VM Kernel App Libs App Binary (process) OS Libs Container App Libs App Binary (process) OS Libs Container User Space
  • 15. Key Takeaways ● Containers are NOT VM’s or mini VM’s or Servers ○ So they DO NOT BOOT ● Containers are just Containers ○ Packs of binaries and libraries that are executed on a shared kernel in their own name space. ● They provide great portability and some extra layer of security
  • 16. Docker for MAC / Docker for Windows
  • 17. The marketplace for validated software and tools available in Docker format for businesses and publishers • Easy search and deploy • Trusted and compliant • https://store.docker.com The Docker Store
  • 19. App Libs App Binary (process) OS Libs Image User Space VM Kernel App Libs App Binary (process) OS Libs Container App Libs App Binary (process) OS Libs Container User Space
  • 20. The Docker Magic Try to run figlet on your computer (just type figlet)
  • 21. The Docker Magic docker run -ti --name figlet ubuntu bash
  • 22. The Docker Magic apt-get update && apt-get install figlet
  • 23. The Docker Magic figlet “Innovation Labs”
  • 24. The Dockerfile FROM ubuntu:trusty MAINTAINER Andrei Manea <andrei@cloudhero.io> # Install base packages RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install curl apache2 Source: https://github.com/cloud-hero/apache-php INSTRUCTION statement
  • 25. Building an Image Building an image allows you to create your own custom images that you can use and share with others.
  • 26. Building an Image git https://github.com/cloud-hero/apache-php.git docker-demo cd docker-demo docker build -t cloudhero/apache-php . docker images ls Source: https://github.com/cloud-hero/apache-php
  • 27. Managing Images List images: docker images Delete images: docker rmi image_name / id docker images
  • 28. Committing an Image Committing an image allows you to create your own custom images from running containers.
  • 29. Committing an Image docker run -ti ubuntu bash root@9923jj4a9 apt update && apt install nginx-full --- docker ps -a docker commit -m “Added Nginx” -a “Andrei Manea” 9923jj4a9 nginx-ubuntu:latest docker images ls
  • 30. Settings Tags on an Image Tags (or image names) can be used to organise and find images easier.
  • 31. Settings Tags on an Image docker tag 9923jj4a9 my-hub-id/nginx-ubuntu:latest
  • 32. Push an Images to Docker Hub / Store Once you’ve built or created a new image you can push it to Docker Hub using the docker push command. This allows you to share it with others, either publicly, or push it into a private repository.
  • 33. Push an Images to Docker Hub / Store docker push my-hub-id/nginx-ubuntu:latest
  • 34. Getting Started w/ Containers
  • 35. Managing Containers We can list all the running container. docker container ls And then all the container existing on the host. docker container ls -a From this list, get the id of the container in which we installed the figlet package and restart the container using the ‘start’ command. docker container start CONTAINER_ID Run an interactive shell in this container. We will use the exec command to do so. docker container exec -ti CONTAINER_ID bash figlet Still Here! exit
  • 36. Managing Containers We can list all the running container. docker container ls And then all the container existing on the host. docker container ls -a From this list, get the id of the container that you want to delete. docker container rm CONTAINER_ID (or force a running container with `rm -f`) Mass deletion of containers. docker container ls -aq Docker container rm `docker container ls -aq`
  • 38. Data persistency without a Volume Let’s run an interactive shell within an alpine container named c1. docker container run --name c1 -ti alpine sh We will create the /data folder and a dummy hello.txt file in it. mkdir /data && cd /data && touch hello.txt We will then check how the read-write layer (container layer) is accessible from the host. Let exit the container first exit Let’s inspect our container in order to get the location of the container’s layer. We can use the inspect command and then scroll into the output until the GraphDriver key, like the following. docker container inspect -f "{{ json .GraphDriver }}" c1 | python -m json.tool
  • 39. Data persistency without a Volume ls /graph/overlay2/[YOUR_ID]/diff/data docker container rm c1 It seems the folder defined in the UpperDir above does not exist anymore. Do you confirm that ? Try running the ls command again and see the results.
  • 40. Data persistency with a Volume Defining a volume in a Dockerfile FROM alpine VOLUME ["/data"] ENTRYPOINT ["/bin/sh"] Let’s build an image from this Dockerfile. docker image build -t img1 . docker container run --name c2 -ti img1 We should then end up in a shell within the container. From there, we will go into /data and create a hello.txt file. cd /data touch hello.txt ls
  • 41. Data persistency with a Volume Let’s create a container from the alpine image, we’ll use the -d option so it runs in background and also define a volume on /data as we’ve done previously. In order the PID 1 process remains active, we use the following command that pings Google DNS and log the output in a file within the /data folder. ping 8.8.8.8 > /data/ping.txt The container is ran that way: docker container run --name c3 -d -v /data alpine sh -c 'ping 8.8.8.8 > /data/ping.txt'
  • 42. Data Volume API The volume API introduced in Docker 1.9 enables to perform operations on volume very easily. First have a look at the commands available in the volume API. docker volume --help We will start with the create command, and create a volume named html. docker volume create --name html If we list the existing volume, our html volume should be the only one. docker volume ls The output should be something like DRIVER VOLUME NAME [other previously created volumes] local html docker container run --name www -d -p 8080:80 -v html:/usr/share/nginx/html nginx
  • 43. A bit of networking!
  • 44. The Docker Network Command The docker network command is the main command for configuring and managing container networks. Run the docker network command from the first terminal. docker network Run a docker network ls command to view existing container networks on the current Docker host. docker network ls Every clean installation of Docker comes with a pre-built network called bridge. Verify this with the docker network ls. All networks created with the bridge driver are based on a Linux bridge (a.k.a. a virtual switch).
  • 45. The Docker Bridge Network
  • 46. The Docker Swarm Network
  • 47. Now, what are services?
  • 48. Docker service is a part of Docker’s native approach for container orchestration
  • 49. ● transition from deploying containers individually on a single host, to deploying complex multi-container apps on many machines. ● a distributed platform, independent from infrastructure, that stays online through the entire lifetime of your application, surviving hardware failure and software updates. Container Orchestration is:
  • 50. docker swarm init --advertise-addr $(hostname -i) Copy the join command (watch out for newlines) output and paste it in the other terminal. Get a Docker Swarm Cluster Create Services Test Update Scale
  • 51. Type the below command in the first terminal: docker node ls That last line will show you a list of all the nodes, something like this: ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS kytp4gq5mrvmdbb0qpifdxeiv * node1 Ready Active Leader lz1j4d6290j8lityk4w0cxls5 node2 Ready Active If you try to execute an administrative command in a non-leader node worker, you’ll get an error. Try it here: docker node ls Get a Docker Swarm Cluster Create Services Test Update Scale
  • 52. Get a Docker Swarm Cluster Create Services Test Update Scale Scalable and Highly Available Hello-World With Docker docker service create --name hello -p 80:80 cloudhero/apache-php
  • 53. Get a Docker Swarm Cluster Create Services Test Update Scale Scalable and Highly Available Hello-World With Docker Set your browser to: http://localhost:80
  • 54. Get a Docker Swarm Cluster Create Services Test Update Scale Scalable and Highly Available Hello-World With Docker Scale Up: docker service scale hello=3 Let’s check our service status: docker service ps hello
  • 55. Get a Docker Swarm Cluster Create Services Test Update Scale Scalable and Highly Available Hello-World With Docker Set your browser to: http://localhost:80 And refresh multiple times:
  • 56. Get a Docker Swarm Cluster Create Services Test Update Scale Scalable and Highly Available Hello-World With Docker Scale Down: docker service scale hello=2 Let’s check our service status: docker service ps hello
  • 57. Get a Docker Swarm Cluster Create Services Test Update Scale Scalable and Highly Available Hello-World With Docker Set your browser to: http://localhost:80 And refresh multiple times:
  • 58. Get a Docker Swarm Cluster Create Services Test Update Scale Scalable and Highly Available Hello-World With Docker Update Publisher Port docker service update --publish-add 81:80 hello docker services ls Set your browser to: http://localhost:81