Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
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 Docker
Docker, 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 Kuo
Docker, Inc.
 
Deep dive in container service discovery
Deep dive in container service discoveryDeep dive in container service discovery
Deep dive in container service discovery
Docker, Inc.
 
Making kubernetes simple for developers
Making kubernetes simple for developersMaking kubernetes simple for developers
Making kubernetes simple for developers
Suraj 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 windows
Docker, 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 Jenkins
devopsdaysaustin
 
Kubernetes101 - Pune Kubernetes Meetup 6
Kubernetes101 - Pune Kubernetes Meetup 6Kubernetes101 - Pune Kubernetes Meetup 6
Kubernetes101 - Pune Kubernetes Meetup 6
Harshal Shah
 
My kubernetes toolkit
My kubernetes toolkitMy kubernetes toolkit
My kubernetes toolkit
Sreenivas Makam
 
DevOps Summit 2016 - The immutable Journey
DevOps Summit 2016 - The immutable JourneyDevOps Summit 2016 - The immutable Journey
DevOps Summit 2016 - The immutable Journey
smalltown
 
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 Kubernetes
Matt Baldwin
 
Docker + Tenserflow + GOlang - Golang singapore Meetup
Docker + Tenserflow + GOlang - Golang singapore MeetupDocker + Tenserflow + GOlang - Golang singapore Meetup
Docker + Tenserflow + GOlang - Golang singapore Meetup
sangam 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 Mayo
Docker, Inc.
 
Red hat ansible automation technical deck
Red hat ansible automation technical deckRed hat ansible automation technical deck
Red hat ansible automation technical deck
Juraj 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 Compose
Docker, Inc.
 
Enabling Microservices @Orbitz - DockerCon 2015
Enabling Microservices @Orbitz - DockerCon 2015Enabling Microservices @Orbitz - DockerCon 2015
Enabling Microservices @Orbitz - DockerCon 2015
Steve 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 pipeline
KubeAcademy
 
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, 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 Demo
Brian 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 Development
msyukor
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
Runcy 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 java
andrzejsydor
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
Justyna Ilczuk
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
IgnacioTamayo2
 
Containerizing Web Application with Docker
Containerizing Web Application with DockerContainerizing Web Application with Docker
Containerizing Web Application with Docker
msyukor
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇
Philip Zheng
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdf
OKLABS
 
Introduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeIntroduction of Docker and Docker Compose
Introduction of Docker and Docker Compose
Dr. Ketan Parmar
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
Paul 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 Container
Guido Schmutz
 
Docker
DockerDocker
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
MANAOUIL Karim
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
Roman Rodomansky
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
양재동 코드랩
 
Docker
DockerDocker
Docker @ Atlogys
Docker @ AtlogysDocker @ 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
Yigal Elefant
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇
Philip Zheng
 

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 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇
 

Recently uploaded

Addressing the Top 9 User Pain Points with Visual Design Elements.pptx
Addressing the Top 9 User Pain Points with Visual Design Elements.pptxAddressing the Top 9 User Pain Points with Visual Design Elements.pptx
Addressing the Top 9 User Pain Points with Visual Design Elements.pptx
Sparity1
 
Kolkata @ℂall @Girls ꧁❤ 000000000 ❤꧂@ℂall @Girls Service Vip Top Model Safe
Kolkata @ℂall @Girls ꧁❤ 000000000 ❤꧂@ℂall @Girls Service Vip Top Model SafeKolkata @ℂall @Girls ꧁❤ 000000000 ❤꧂@ℂall @Girls Service Vip Top Model Safe
Kolkata @ℂall @Girls ꧁❤ 000000000 ❤꧂@ℂall @Girls Service Vip Top Model Safe
Misti Soneji
 
WEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service ProvidersWEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service Providers
Severalnines
 
Development of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML TechnologiesDevelopment of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML Technologies
MaisnamLuwangPibarel
 
@Call @Girls in Tiruppur 🤷‍♂️ XXXXXXXX 🤷‍♂️ Tanisha Sharma Best High Class ...
 @Call @Girls in Tiruppur 🤷‍♂️  XXXXXXXX 🤷‍♂️ Tanisha Sharma Best High Class ... @Call @Girls in Tiruppur 🤷‍♂️  XXXXXXXX 🤷‍♂️ Tanisha Sharma Best High Class ...
@Call @Girls in Tiruppur 🤷‍♂️ XXXXXXXX 🤷‍♂️ Tanisha Sharma Best High Class ...
Mona Rathore
 
@Call @Girls in Saharanpur 🐱‍🐉 XXXXXXXXXX 🐱‍🐉 Tanisha Sharma Best High Clas...
 @Call @Girls in Saharanpur 🐱‍🐉  XXXXXXXXXX 🐱‍🐉 Tanisha Sharma Best High Clas... @Call @Girls in Saharanpur 🐱‍🐉  XXXXXXXXXX 🐱‍🐉 Tanisha Sharma Best High Clas...
@Call @Girls in Saharanpur 🐱‍🐉 XXXXXXXXXX 🐱‍🐉 Tanisha Sharma Best High Clas...
AlinaDevecerski
 
dachnug51 - HCLs evolution of the employee experience platform.pdf
dachnug51 - HCLs evolution of the employee experience platform.pdfdachnug51 - HCLs evolution of the employee experience platform.pdf
dachnug51 - HCLs evolution of the employee experience platform.pdf
DNUG e.V.
 
ℂall Girls in Surat 🔥 +91-7023059433 🔥 Best High ℂlass Surat Esℂorts Serviℂe ...
ℂall Girls in Surat 🔥 +91-7023059433 🔥 Best High ℂlass Surat Esℂorts Serviℂe ...ℂall Girls in Surat 🔥 +91-7023059433 🔥 Best High ℂlass Surat Esℂorts Serviℂe ...
ℂall Girls in Surat 🔥 +91-7023059433 🔥 Best High ℂlass Surat Esℂorts Serviℂe ...
nitu gupta#N06
 
Disk to Cloud: Abstract your File Operations with CBFS
Disk to Cloud: Abstract your File Operations with CBFSDisk to Cloud: Abstract your File Operations with CBFS
Disk to Cloud: Abstract your File Operations with CBFS
Ortus Solutions, Corp
 
Java SE 17 Study Guide for Certification - Chapter 02
Java SE 17 Study Guide for Certification - Chapter 02Java SE 17 Study Guide for Certification - Chapter 02
Java SE 17 Study Guide for Certification - Chapter 02
williamrobertherman
 
dachnug51 - HCL Domino Roadmap .pdf
dachnug51 - HCL Domino Roadmap      .pdfdachnug51 - HCL Domino Roadmap      .pdf
dachnug51 - HCL Domino Roadmap .pdf
DNUG e.V.
 
Bhiwandi @Call @Girls Whatsapp 000000000 With Best And No 1
Bhiwandi @Call @Girls Whatsapp 000000000 With Best And No 1Bhiwandi @Call @Girls Whatsapp 000000000 With Best And No 1
Bhiwandi @Call @Girls Whatsapp 000000000 With Best And No 1
arvindkumarji156
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio, Inc.
 
Splunk_Remote_Work_Insights_Overview.pptx
Splunk_Remote_Work_Insights_Overview.pptxSplunk_Remote_Work_Insights_Overview.pptx
Splunk_Remote_Work_Insights_Overview.pptx
sudsdeep
 
How to Break Your App with Playwright Tests
How to Break Your App with Playwright TestsHow to Break Your App with Playwright Tests
How to Break Your App with Playwright Tests
Ortus Solutions, Corp
 
BoxLang Developer Tooling: VSCode Extension and Debugger
BoxLang Developer Tooling: VSCode Extension and DebuggerBoxLang Developer Tooling: VSCode Extension and Debugger
BoxLang Developer Tooling: VSCode Extension and Debugger
Ortus Solutions, Corp
 
Intro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AIIntro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AI
Ortus Solutions, Corp
 
ANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdfANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdf
sachin chaurasia
 
Migrate your Infrastructure to the AWS Cloud
Migrate your Infrastructure to the AWS CloudMigrate your Infrastructure to the AWS Cloud
Migrate your Infrastructure to the AWS Cloud
Ortus Solutions, Corp
 
How to debug ColdFusion Applications using “ColdFusion Builder extension for ...
How to debug ColdFusion Applications using “ColdFusion Builder extension for ...How to debug ColdFusion Applications using “ColdFusion Builder extension for ...
How to debug ColdFusion Applications using “ColdFusion Builder extension for ...
Ortus Solutions, Corp
 

Recently uploaded (20)

Addressing the Top 9 User Pain Points with Visual Design Elements.pptx
Addressing the Top 9 User Pain Points with Visual Design Elements.pptxAddressing the Top 9 User Pain Points with Visual Design Elements.pptx
Addressing the Top 9 User Pain Points with Visual Design Elements.pptx
 
Kolkata @ℂall @Girls ꧁❤ 000000000 ❤꧂@ℂall @Girls Service Vip Top Model Safe
Kolkata @ℂall @Girls ꧁❤ 000000000 ❤꧂@ℂall @Girls Service Vip Top Model SafeKolkata @ℂall @Girls ꧁❤ 000000000 ❤꧂@ℂall @Girls Service Vip Top Model Safe
Kolkata @ℂall @Girls ꧁❤ 000000000 ❤꧂@ℂall @Girls Service Vip Top Model Safe
 
WEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service ProvidersWEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service Providers
 
Development of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML TechnologiesDevelopment of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML Technologies
 
@Call @Girls in Tiruppur 🤷‍♂️ XXXXXXXX 🤷‍♂️ Tanisha Sharma Best High Class ...
 @Call @Girls in Tiruppur 🤷‍♂️  XXXXXXXX 🤷‍♂️ Tanisha Sharma Best High Class ... @Call @Girls in Tiruppur 🤷‍♂️  XXXXXXXX 🤷‍♂️ Tanisha Sharma Best High Class ...
@Call @Girls in Tiruppur 🤷‍♂️ XXXXXXXX 🤷‍♂️ Tanisha Sharma Best High Class ...
 
@Call @Girls in Saharanpur 🐱‍🐉 XXXXXXXXXX 🐱‍🐉 Tanisha Sharma Best High Clas...
 @Call @Girls in Saharanpur 🐱‍🐉  XXXXXXXXXX 🐱‍🐉 Tanisha Sharma Best High Clas... @Call @Girls in Saharanpur 🐱‍🐉  XXXXXXXXXX 🐱‍🐉 Tanisha Sharma Best High Clas...
@Call @Girls in Saharanpur 🐱‍🐉 XXXXXXXXXX 🐱‍🐉 Tanisha Sharma Best High Clas...
 
dachnug51 - HCLs evolution of the employee experience platform.pdf
dachnug51 - HCLs evolution of the employee experience platform.pdfdachnug51 - HCLs evolution of the employee experience platform.pdf
dachnug51 - HCLs evolution of the employee experience platform.pdf
 
ℂall Girls in Surat 🔥 +91-7023059433 🔥 Best High ℂlass Surat Esℂorts Serviℂe ...
ℂall Girls in Surat 🔥 +91-7023059433 🔥 Best High ℂlass Surat Esℂorts Serviℂe ...ℂall Girls in Surat 🔥 +91-7023059433 🔥 Best High ℂlass Surat Esℂorts Serviℂe ...
ℂall Girls in Surat 🔥 +91-7023059433 🔥 Best High ℂlass Surat Esℂorts Serviℂe ...
 
Disk to Cloud: Abstract your File Operations with CBFS
Disk to Cloud: Abstract your File Operations with CBFSDisk to Cloud: Abstract your File Operations with CBFS
Disk to Cloud: Abstract your File Operations with CBFS
 
Java SE 17 Study Guide for Certification - Chapter 02
Java SE 17 Study Guide for Certification - Chapter 02Java SE 17 Study Guide for Certification - Chapter 02
Java SE 17 Study Guide for Certification - Chapter 02
 
dachnug51 - HCL Domino Roadmap .pdf
dachnug51 - HCL Domino Roadmap      .pdfdachnug51 - HCL Domino Roadmap      .pdf
dachnug51 - HCL Domino Roadmap .pdf
 
Bhiwandi @Call @Girls Whatsapp 000000000 With Best And No 1
Bhiwandi @Call @Girls Whatsapp 000000000 With Best And No 1Bhiwandi @Call @Girls Whatsapp 000000000 With Best And No 1
Bhiwandi @Call @Girls Whatsapp 000000000 With Best And No 1
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
 
Splunk_Remote_Work_Insights_Overview.pptx
Splunk_Remote_Work_Insights_Overview.pptxSplunk_Remote_Work_Insights_Overview.pptx
Splunk_Remote_Work_Insights_Overview.pptx
 
How to Break Your App with Playwright Tests
How to Break Your App with Playwright TestsHow to Break Your App with Playwright Tests
How to Break Your App with Playwright Tests
 
BoxLang Developer Tooling: VSCode Extension and Debugger
BoxLang Developer Tooling: VSCode Extension and DebuggerBoxLang Developer Tooling: VSCode Extension and Debugger
BoxLang Developer Tooling: VSCode Extension and Debugger
 
Intro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AIIntro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AI
 
ANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdfANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdf
 
Migrate your Infrastructure to the AWS Cloud
Migrate your Infrastructure to the AWS CloudMigrate your Infrastructure to the AWS Cloud
Migrate your Infrastructure to the AWS Cloud
 
How to debug ColdFusion Applications using “ColdFusion Builder extension for ...
How to debug ColdFusion Applications using “ColdFusion Builder extension for ...How to debug ColdFusion Applications using “ColdFusion Builder extension for ...
How to debug ColdFusion Applications using “ColdFusion Builder extension for ...
 

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