SlideShare une entreprise Scribd logo
1  sur  62
● Basics of container and Docker
● Major Docker components
● Starting learning basic docker commands
● Hands-on labs and exercises
● Quiz
Course outline
Prerequisites
● Basic knowledge of how OS works, no need
to be expert
● At least 1 virtual machine
Traditional application deployment
A bit of scale makes a bit of scare
Containers under the hood
cgroups - Wikipedia
cgroups (abbreviated from control groups) is a Linux kernel feature that limits,
accounts for and isolates the resource usage (CPU, memory, disk I/O, network,
etc.) of a collection of processes.
Engineers at Google (primarily Paul Menage and Rohit Seth) started the work
on this feature in 2006, under the name "process containers".[1] In late 2007
the nomenclature changed to "control groups" due to the confusion caused by
multiple meanings of the term "container" in the Linux kernel context, and
control-group functionality merged into kernel version 2.6.24.[2] Since then,
developers have added many new features and controllers, such as support for
kernfs,[3] firewalling,[4] and unified hierarchy.[5]
Quiz - Containers
What are the benefits of using container
instead of VM?
● No need for hypervisor
● No need for operating system
● No physical hardware
● No need for priveleged user
● No. It’s uselles.
Quiz - Containers
What are the benefits of using container
instead of VM?
● No need for hypervisor
● No need for operating system
● No physical hardware
● No need for priveleged user
● No. It’s uselles.
I create process with PID=1234 in container. What PID will
be on host OS?
a. the same as in container: PID=1234
b. on host there will be PID=4321 that maps to PID=1234
in container
c. it wont be created in container. Actually container
creates it on host.
d. there will be no pid on host. PID=1234 is the child
process in container
Quiz - Containers
I create process with PID=1234 in container. What PID will
be on host OS?
a. the same as in container: PID=1234
b. on host there will be PID=4321 that maps to PID=1234
in container
c. it wont be created in container. Actually container
creates it on host.
d. there will be no pid on host. PID=1234 is the child
process in container
Quiz - Containers
What are the main components of namespaces?
a. uts, ipc, pid, network, user, mount
b. user, pid, mount, filesystem, application, io
c. pid, os, hardware, user, internet, filesystem
d. mount, hardware, network, user, pid, cgroup
Quiz - Containers
What are the main components of namespaces?
a. uts, ipc, pid, network, user, mount
b. user, pid, mount, filesystem, application, io
c. pid, os, hardware, user, internet, filesystem
d. mount, hardware, network, user, pid, cgroup
Quiz - Containers
Quiz - Containers
What should i do to run application with unprivileged user in
container?
a. change the owner to current user and run it
b. login as sudo and run the application
c. enter the container and run it
d. login as sudo then chown the application then run it
Quiz - Containers
What should i do to run application with unprivileged user in
container?
a. change the owner to current user and run it
b. login as sudo and run the application
c. enter the container and run it
d. login as sudo then chown the application then run it
Major Docker components
In short: write once, really run anywhere
Docker images and containers
pull the image from docker cloud servers
Images repository - Dockerhub
Installing Docker engine
1. Open https://docs.docker.com/installation/
2. Find the name of your host operating system
from the list
3. Follow the instructions
Linux: Add current user to docker group
sudo gpasswd -a <user_name> docker
Mac OS: set env variables for boot2docker
boot2docker up
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=<cert path>
export DOCKER_TLS_VERIFY=1
or
$(boot2docker shellinit)
Get ip of boot2docker: boot2docker ip
Check version of docker: docker version
Windows: maybe like on MacOS...but didnt try
boot2docker up
set DOCKER_HOST=tcp://192.168.59.103:2376
set DOCKER_CERT_PATH=<cert path>
set DOCKER_TLS_VERIFY=1
or
boot2docker shellinit
Get ip of boot2docker: boot2docker ip
Check version of docker: docker version
Let docker say: Hello World!
docker run hello-world
Now let’s get into the container
1) docker pull centos – fetch centos image from repository
2) docker run centos – run fetched centos image within container
3) docker ps - list the running containers
4) docker ps -a - list all the containers (running + not running)
5) docker exec - to execute the command inside container
6) docker attach - get into the container
7) exit from container quits the container
8) Ctrl+P and Ctrl+Q leaves the running container
9) docker inspect <container_id> - show info about running container
Lab: Run required container
IOS/Android developers:
1) docker run -d –p 8080:8080 jenkins
2) Open http://<docker_host>:8080 in your browser and create build plan in
jenkins
Service developers:
1) docker run -it --rm williamyeh/scala
2) Write hello world in scala
TIP: docker --help is you cheat sheet
Quiz - Docker
What is the difference between images and containers?
a. containers consist of binary files, images consist of user app files
b. containers run only once, whereas images run multiple times
c. containers pulled from dockerhub, whereas images stores locally
d. images consist of instructions and user files, whereas containers
only runtime environment for user process
Quiz - Docker
What is the difference between images and containers?
a. containers consist of binary files, images consist of user app files
b. containers run only once, whereas images run multiple times
c. containers pulled from dockerhub, whereas images stores locally
d. images consist of instructions and user files, whereas containers
only runtime environment for user process
Quiz - Docker
What will be the result of the following instructions?
docker run -it my-image /bin/bash # let’s say it returns ID 123...
echo “Sample text” | cat > SampleText.txt
exit
docker cp 123:/root/SampleText.txt ./
a. will copy SampleText.txt to current directory
b. will copy data from the current directory to /root/SampleText.txt inside container
c. prints to screen Sample text and copies SampleText.txt to current directory on docker host
d. does nothing. Terminates with error
Quiz - Docker
What will be the result of the following instructions?
docker run -it my-image /bin/bash # let’s say it returns ID 123...
echo “Sample text” | cat > SampleText.txt
exit
docker cp 123:/root/SampleText.txt ./
a. will copy SampleText.txt to current directory
b. will copy data from the current directory to /root/SampleText.txt inside container
c. prints to screen Sample text and copies SampleText.txt to current directory on docker host
d. does nothing. Terminates with error
Quiz - Docker
What will be the result of the following instructions?
docker run -d my-image /bin/bash echo “Sample text” | cat > SampleText.txt
# let’s say returns id 123...
docker run -d my-image /bin/bash “ping 8.8.8.8”
docker cp 123:/root/SampleText.txt ./
a. will copy SampleText.txt to current directory
b. will copy data from the current directory to /root/SampleText.txt inside container
c. prints to screen Sample text and copies SampleText.txt to current directory on docker host
d. does nothing. Terminates with error
Quiz - Docker
What will be the result of the following instructions?
docker run -d my-image /bin/bash echo “Sample text” | cat > SampleText.txt
# let’s say returns id 123...
docker run -d my-image /bin/bash “ping 8.8.8.8”
docker cp 123:/root/SampleText.txt ./
a. will copy SampleText.txt to current directory
b. will copy data from the current directory to /root/SampleText.txt inside container
c. prints to screen Sample text and copies SampleText.txt to current directory on docker host
d. does nothing. Terminates with error
Writing own Dockerfile
FROM ubuntu:latest
MAINTAINTER <name surname>
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y nginx
CMD ["nginx", "-g", "daemon off;"]
Docker Workflow 1
1) Download file from curl -L -O http://github.com/atbaker/flask-example/archive/master.zip
2) Unzip master.zip
3) run python flask-example.py
Build as docker:
FROM python:2-onbuild
EXPOSE 8000
CMD [“gunicorn”, “-c”, “gunicorn_config.py”, “flask-example:app”]
Docker Workflow 2
Download file from curl -L -O http://github.com/atbaker/django-example/archive/master.zip
Build as docker:
FROM python:2.7-onbuild
EXPOSE 8000
CMD [“gunicorn”, “-c”, “gunicorn_config.py”, “--chdr”, “django-example”, “wsgi:application”]
docker run --name postgres -d postgres:9.3
docker run --name memcached -d atbaker/memcached-verbose
docker run --name django -d -p 8000:8000 --link postgres:db --link memcached:cache django-example
docker run --name django --link postgres:db --link memcached:cache django-example python django/example/manage.py migrate
Docker workflow 2 with Docker-Compose
django:
build: .
links:
- postgres:db
- memcached:cache
ports:
- “8000:80”
postgres:
image:postgres:9.3
memcached:
image:atbaker/memcached-verbose
Useful resources
https://docs.docker.com/ - official docs from Docker
https://docs.docker.com/compose/ - official docs about Docker
Compose
https://docs.docker.com/docker/introduction/understanding-docker/ -
Docker architecture
https://linuxcontainers.org/ - WiKi about Linux Containers (LXC)
https://lwn.net/Articles/531114/ - Linux namespaces overview
https://lwn.net/Articles/532748/ - Linux PID namespaces

Contenu connexe

Tendances

파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Composeraccoony
 
Docker and the Container Ecosystem
Docker and the Container EcosystemDocker and the Container Ecosystem
Docker and the Container Ecosystempsconnolly
 
Running Django on Docker: a workflow and code
Running Django on Docker: a workflow and codeRunning Django on Docker: a workflow and code
Running Django on Docker: a workflow and codeDanielle Madeley
 
Introduction to Docker and deployment and Azure
Introduction to Docker and deployment and AzureIntroduction to Docker and deployment and Azure
Introduction to Docker and deployment and AzureJérôme Petazzoni
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and AgentRanjit Avasarala
 
Continuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in CloudContinuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in CloudIdeato
 
Build service with_docker_in_90mins
Build service with_docker_in_90minsBuild service with_docker_in_90mins
Build service with_docker_in_90minsLarry Cai
 
開放運算&GPU技術研究班
開放運算&GPU技術研究班開放運算&GPU技術研究班
開放運算&GPU技術研究班Paul Chao
 
Docker - From Walking To Running
Docker - From Walking To RunningDocker - From Walking To Running
Docker - From Walking To RunningGiacomo Vacca
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHErica Windisch
 
Docker in production: reality, not hype (OSCON 2015)
Docker in production: reality, not hype (OSCON 2015)Docker in production: reality, not hype (OSCON 2015)
Docker in production: reality, not hype (OSCON 2015)bridgetkromhout
 
Docker workshop
Docker workshopDocker workshop
Docker workshopEvans Ye
 
Docker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopJirayut Nimsaeng
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Paul Chao
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesLarry Cai
 
How to deploy PHP projects with docker
How to deploy PHP projects with dockerHow to deploy PHP projects with docker
How to deploy PHP projects with dockerRuoshi Ling
 
Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Nicolas Poggi
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to dockerWalid Ashraf
 

Tendances (20)

파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
 
Docker and the Container Ecosystem
Docker and the Container EcosystemDocker and the Container Ecosystem
Docker and the Container Ecosystem
 
Running Django on Docker: a workflow and code
Running Django on Docker: a workflow and codeRunning Django on Docker: a workflow and code
Running Django on Docker: a workflow and code
 
Introduction to Docker and deployment and Azure
Introduction to Docker and deployment and AzureIntroduction to Docker and deployment and Azure
Introduction to Docker and deployment and Azure
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and Agent
 
Continuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in CloudContinuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in Cloud
 
Docker
DockerDocker
Docker
 
Build service with_docker_in_90mins
Build service with_docker_in_90minsBuild service with_docker_in_90mins
Build service with_docker_in_90mins
 
開放運算&GPU技術研究班
開放運算&GPU技術研究班開放運算&GPU技術研究班
開放運算&GPU技術研究班
 
Docker - From Walking To Running
Docker - From Walking To RunningDocker - From Walking To Running
Docker - From Walking To Running
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
 
Docker in production: reality, not hype (OSCON 2015)
Docker in production: reality, not hype (OSCON 2015)Docker in production: reality, not hype (OSCON 2015)
Docker in production: reality, not hype (OSCON 2015)
 
Docker workshop
Docker workshopDocker workshop
Docker workshop
 
Docker Continuous Delivery Workshop
Docker Continuous Delivery WorkshopDocker Continuous Delivery Workshop
Docker Continuous Delivery Workshop
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutes
 
How to deploy PHP projects with docker
How to deploy PHP projects with dockerHow to deploy PHP projects with docker
How to deploy PHP projects with docker
 
Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 

En vedette

Tribal Nova Docker workshop
Tribal Nova Docker workshopTribal Nova Docker workshop
Tribal Nova Docker workshopNicolas Degardin
 
Venture Capital - An Introduction
Venture Capital - An IntroductionVenture Capital - An Introduction
Venture Capital - An IntroductionJanis Zech
 
Docker - Containervirtualisierung leichtgemacht
Docker - Containervirtualisierung leichtgemachtDocker - Containervirtualisierung leichtgemacht
Docker - Containervirtualisierung leichtgemachtB1 Systems GmbH
 
Visualising Basic Concepts of Docker
Visualising Basic Concepts of Docker Visualising Basic Concepts of Docker
Visualising Basic Concepts of Docker vishnu rao
 
Introduction to Desired State Configuration (DSC)
Introduction to Desired State Configuration (DSC)Introduction to Desired State Configuration (DSC)
Introduction to Desired State Configuration (DSC)Jeffery Hicks
 
Single Host Docker Networking
Single Host Docker NetworkingSingle Host Docker Networking
Single Host Docker Networkingallingeek
 
Rootlinux17: An introduction to Xen Project Virtualisation
Rootlinux17:  An introduction to Xen Project VirtualisationRootlinux17:  An introduction to Xen Project Virtualisation
Rootlinux17: An introduction to Xen Project VirtualisationThe Linux Foundation
 
Basic docker for developer
Basic docker for developerBasic docker for developer
Basic docker for developerWeerayut Hongsa
 
Docker Einführung @GPN15
Docker Einführung @GPN15Docker Einführung @GPN15
Docker Einführung @GPN15m1no
 
Test Automation - Principles and Practices
Test Automation - Principles and PracticesTest Automation - Principles and Practices
Test Automation - Principles and PracticesAnand Bagmar
 
Landscape Line Drawings (sketch examples)
Landscape Line Drawings (sketch examples)Landscape Line Drawings (sketch examples)
Landscape Line Drawings (sketch examples)Frank Curkovic
 
Introduction to Cognitive Ergonomics
Introduction to Cognitive ErgonomicsIntroduction to Cognitive Ergonomics
Introduction to Cognitive ErgonomicsDun Huang
 
New Amazing Things about AngularJS 2.0
New Amazing Things about AngularJS 2.0New Amazing Things about AngularJS 2.0
New Amazing Things about AngularJS 2.0Mike Taylor
 
Product Marketing Framework for Product or Service Launch
Product Marketing Framework for Product or Service LaunchProduct Marketing Framework for Product or Service Launch
Product Marketing Framework for Product or Service LaunchJanet Jaiswal
 

En vedette (16)

Tribal Nova Docker workshop
Tribal Nova Docker workshopTribal Nova Docker workshop
Tribal Nova Docker workshop
 
Venture Capital - An Introduction
Venture Capital - An IntroductionVenture Capital - An Introduction
Venture Capital - An Introduction
 
Docker - Containervirtualisierung leichtgemacht
Docker - Containervirtualisierung leichtgemachtDocker - Containervirtualisierung leichtgemacht
Docker - Containervirtualisierung leichtgemacht
 
Visualising Basic Concepts of Docker
Visualising Basic Concepts of Docker Visualising Basic Concepts of Docker
Visualising Basic Concepts of Docker
 
Introduction to Desired State Configuration (DSC)
Introduction to Desired State Configuration (DSC)Introduction to Desired State Configuration (DSC)
Introduction to Desired State Configuration (DSC)
 
Single Host Docker Networking
Single Host Docker NetworkingSingle Host Docker Networking
Single Host Docker Networking
 
Rootlinux17: An introduction to Xen Project Virtualisation
Rootlinux17:  An introduction to Xen Project VirtualisationRootlinux17:  An introduction to Xen Project Virtualisation
Rootlinux17: An introduction to Xen Project Virtualisation
 
What is Docker
What is DockerWhat is Docker
What is Docker
 
Basic docker for developer
Basic docker for developerBasic docker for developer
Basic docker for developer
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Docker Einführung @GPN15
Docker Einführung @GPN15Docker Einführung @GPN15
Docker Einführung @GPN15
 
Test Automation - Principles and Practices
Test Automation - Principles and PracticesTest Automation - Principles and Practices
Test Automation - Principles and Practices
 
Landscape Line Drawings (sketch examples)
Landscape Line Drawings (sketch examples)Landscape Line Drawings (sketch examples)
Landscape Line Drawings (sketch examples)
 
Introduction to Cognitive Ergonomics
Introduction to Cognitive ErgonomicsIntroduction to Cognitive Ergonomics
Introduction to Cognitive Ergonomics
 
New Amazing Things about AngularJS 2.0
New Amazing Things about AngularJS 2.0New Amazing Things about AngularJS 2.0
New Amazing Things about AngularJS 2.0
 
Product Marketing Framework for Product or Service Launch
Product Marketing Framework for Product or Service LaunchProduct Marketing Framework for Product or Service Launch
Product Marketing Framework for Product or Service Launch
 

Similaire à ABCs of docker

時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇Philip Zheng
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017Paul Chao
 
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
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...Codemotion
 
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 2020CloudHero
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 applicationRoman Rodomansky
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014Carlo Bonamico
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇Philip Zheng
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortalsHenryk Konsek
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker皓鈞 張
 
Dockers Containers in action Slide 0 to hero
Dockers Containers in action Slide  0 to heroDockers Containers in action Slide  0 to hero
Dockers Containers in action Slide 0 to heroTayyabAslam24
 
Rooting Out Root: User namespaces in Docker
Rooting Out Root: User namespaces in DockerRooting Out Root: User namespaces in Docker
Rooting Out Root: User namespaces in DockerPhil Estes
 
Docker containers & the Future of Drupal testing
Docker containers & the Future of Drupal testing Docker containers & the Future of Drupal testing
Docker containers & the Future of Drupal testing Ricardo Amaro
 
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...Eric Smalling
 
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
 
Introduction to Docker - Learning containerization XP conference 2016
Introduction to Docker - Learning containerization  XP conference 2016Introduction to Docker - Learning containerization  XP conference 2016
Introduction to Docker - Learning containerization XP conference 2016XP Conference India
 
Intro to containerization
Intro to containerizationIntro to containerization
Intro to containerizationBalint Pato
 

Similaire à ABCs of docker (20)

時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇
 
Docker Starter Pack
Docker Starter PackDocker Starter Pack
Docker Starter Pack
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
 
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
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
 
Docker, but what it is?
Docker, but what it is?Docker, but what it is?
Docker, but what it is?
 
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
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇
 
Docker for mere mortals
Docker for mere mortalsDocker for mere mortals
Docker for mere mortals
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Dockers Containers in action Slide 0 to hero
Dockers Containers in action Slide  0 to heroDockers Containers in action Slide  0 to hero
Dockers Containers in action Slide 0 to hero
 
Rooting Out Root: User namespaces in Docker
Rooting Out Root: User namespaces in DockerRooting Out Root: User namespaces in Docker
Rooting Out Root: User namespaces in Docker
 
Docker containers & the Future of Drupal testing
Docker containers & the Future of Drupal testing Docker containers & the Future of Drupal testing
Docker containers & the Future of Drupal testing
 
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
 
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
 
Introduction to Docker - Learning containerization XP conference 2016
Introduction to Docker - Learning containerization  XP conference 2016Introduction to Docker - Learning containerization  XP conference 2016
Introduction to Docker - Learning containerization XP conference 2016
 
Intro to containerization
Intro to containerizationIntro to containerization
Intro to containerization
 
Docker by Example - Quiz
Docker by Example - QuizDocker by Example - Quiz
Docker by Example - Quiz
 

Dernier

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Dernier (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

ABCs of docker

  • 1.
  • 2. ● Basics of container and Docker ● Major Docker components ● Starting learning basic docker commands ● Hands-on labs and exercises ● Quiz Course outline
  • 3. Prerequisites ● Basic knowledge of how OS works, no need to be expert ● At least 1 virtual machine
  • 5. A bit of scale makes a bit of scare
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23. cgroups - Wikipedia cgroups (abbreviated from control groups) is a Linux kernel feature that limits, accounts for and isolates the resource usage (CPU, memory, disk I/O, network, etc.) of a collection of processes. Engineers at Google (primarily Paul Menage and Rohit Seth) started the work on this feature in 2006, under the name "process containers".[1] In late 2007 the nomenclature changed to "control groups" due to the confusion caused by multiple meanings of the term "container" in the Linux kernel context, and control-group functionality merged into kernel version 2.6.24.[2] Since then, developers have added many new features and controllers, such as support for kernfs,[3] firewalling,[4] and unified hierarchy.[5]
  • 24.
  • 25.
  • 26. Quiz - Containers What are the benefits of using container instead of VM? ● No need for hypervisor ● No need for operating system ● No physical hardware ● No need for priveleged user ● No. It’s uselles.
  • 27. Quiz - Containers What are the benefits of using container instead of VM? ● No need for hypervisor ● No need for operating system ● No physical hardware ● No need for priveleged user ● No. It’s uselles.
  • 28. I create process with PID=1234 in container. What PID will be on host OS? a. the same as in container: PID=1234 b. on host there will be PID=4321 that maps to PID=1234 in container c. it wont be created in container. Actually container creates it on host. d. there will be no pid on host. PID=1234 is the child process in container Quiz - Containers
  • 29. I create process with PID=1234 in container. What PID will be on host OS? a. the same as in container: PID=1234 b. on host there will be PID=4321 that maps to PID=1234 in container c. it wont be created in container. Actually container creates it on host. d. there will be no pid on host. PID=1234 is the child process in container Quiz - Containers
  • 30. What are the main components of namespaces? a. uts, ipc, pid, network, user, mount b. user, pid, mount, filesystem, application, io c. pid, os, hardware, user, internet, filesystem d. mount, hardware, network, user, pid, cgroup Quiz - Containers
  • 31. What are the main components of namespaces? a. uts, ipc, pid, network, user, mount b. user, pid, mount, filesystem, application, io c. pid, os, hardware, user, internet, filesystem d. mount, hardware, network, user, pid, cgroup Quiz - Containers
  • 32. Quiz - Containers What should i do to run application with unprivileged user in container? a. change the owner to current user and run it b. login as sudo and run the application c. enter the container and run it d. login as sudo then chown the application then run it
  • 33. Quiz - Containers What should i do to run application with unprivileged user in container? a. change the owner to current user and run it b. login as sudo and run the application c. enter the container and run it d. login as sudo then chown the application then run it
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 40.
  • 41. In short: write once, really run anywhere
  • 42. Docker images and containers
  • 43. pull the image from docker cloud servers
  • 44. Images repository - Dockerhub
  • 45. Installing Docker engine 1. Open https://docs.docker.com/installation/ 2. Find the name of your host operating system from the list 3. Follow the instructions
  • 46. Linux: Add current user to docker group sudo gpasswd -a <user_name> docker
  • 47. Mac OS: set env variables for boot2docker boot2docker up export DOCKER_HOST=tcp://192.168.59.103:2376 export DOCKER_CERT_PATH=<cert path> export DOCKER_TLS_VERIFY=1 or $(boot2docker shellinit) Get ip of boot2docker: boot2docker ip Check version of docker: docker version
  • 48. Windows: maybe like on MacOS...but didnt try boot2docker up set DOCKER_HOST=tcp://192.168.59.103:2376 set DOCKER_CERT_PATH=<cert path> set DOCKER_TLS_VERIFY=1 or boot2docker shellinit Get ip of boot2docker: boot2docker ip Check version of docker: docker version
  • 49. Let docker say: Hello World! docker run hello-world
  • 50. Now let’s get into the container 1) docker pull centos – fetch centos image from repository 2) docker run centos – run fetched centos image within container 3) docker ps - list the running containers 4) docker ps -a - list all the containers (running + not running) 5) docker exec - to execute the command inside container 6) docker attach - get into the container 7) exit from container quits the container 8) Ctrl+P and Ctrl+Q leaves the running container 9) docker inspect <container_id> - show info about running container
  • 51. Lab: Run required container IOS/Android developers: 1) docker run -d –p 8080:8080 jenkins 2) Open http://<docker_host>:8080 in your browser and create build plan in jenkins Service developers: 1) docker run -it --rm williamyeh/scala 2) Write hello world in scala TIP: docker --help is you cheat sheet
  • 52. Quiz - Docker What is the difference between images and containers? a. containers consist of binary files, images consist of user app files b. containers run only once, whereas images run multiple times c. containers pulled from dockerhub, whereas images stores locally d. images consist of instructions and user files, whereas containers only runtime environment for user process
  • 53. Quiz - Docker What is the difference between images and containers? a. containers consist of binary files, images consist of user app files b. containers run only once, whereas images run multiple times c. containers pulled from dockerhub, whereas images stores locally d. images consist of instructions and user files, whereas containers only runtime environment for user process
  • 54. Quiz - Docker What will be the result of the following instructions? docker run -it my-image /bin/bash # let’s say it returns ID 123... echo “Sample text” | cat > SampleText.txt exit docker cp 123:/root/SampleText.txt ./ a. will copy SampleText.txt to current directory b. will copy data from the current directory to /root/SampleText.txt inside container c. prints to screen Sample text and copies SampleText.txt to current directory on docker host d. does nothing. Terminates with error
  • 55. Quiz - Docker What will be the result of the following instructions? docker run -it my-image /bin/bash # let’s say it returns ID 123... echo “Sample text” | cat > SampleText.txt exit docker cp 123:/root/SampleText.txt ./ a. will copy SampleText.txt to current directory b. will copy data from the current directory to /root/SampleText.txt inside container c. prints to screen Sample text and copies SampleText.txt to current directory on docker host d. does nothing. Terminates with error
  • 56. Quiz - Docker What will be the result of the following instructions? docker run -d my-image /bin/bash echo “Sample text” | cat > SampleText.txt # let’s say returns id 123... docker run -d my-image /bin/bash “ping 8.8.8.8” docker cp 123:/root/SampleText.txt ./ a. will copy SampleText.txt to current directory b. will copy data from the current directory to /root/SampleText.txt inside container c. prints to screen Sample text and copies SampleText.txt to current directory on docker host d. does nothing. Terminates with error
  • 57. Quiz - Docker What will be the result of the following instructions? docker run -d my-image /bin/bash echo “Sample text” | cat > SampleText.txt # let’s say returns id 123... docker run -d my-image /bin/bash “ping 8.8.8.8” docker cp 123:/root/SampleText.txt ./ a. will copy SampleText.txt to current directory b. will copy data from the current directory to /root/SampleText.txt inside container c. prints to screen Sample text and copies SampleText.txt to current directory on docker host d. does nothing. Terminates with error
  • 58. Writing own Dockerfile FROM ubuntu:latest MAINTAINTER <name surname> FROM ubuntu:latest RUN apt-get update RUN apt-get install -y nginx CMD ["nginx", "-g", "daemon off;"]
  • 59. Docker Workflow 1 1) Download file from curl -L -O http://github.com/atbaker/flask-example/archive/master.zip 2) Unzip master.zip 3) run python flask-example.py Build as docker: FROM python:2-onbuild EXPOSE 8000 CMD [“gunicorn”, “-c”, “gunicorn_config.py”, “flask-example:app”]
  • 60. Docker Workflow 2 Download file from curl -L -O http://github.com/atbaker/django-example/archive/master.zip Build as docker: FROM python:2.7-onbuild EXPOSE 8000 CMD [“gunicorn”, “-c”, “gunicorn_config.py”, “--chdr”, “django-example”, “wsgi:application”] docker run --name postgres -d postgres:9.3 docker run --name memcached -d atbaker/memcached-verbose docker run --name django -d -p 8000:8000 --link postgres:db --link memcached:cache django-example docker run --name django --link postgres:db --link memcached:cache django-example python django/example/manage.py migrate
  • 61. Docker workflow 2 with Docker-Compose django: build: . links: - postgres:db - memcached:cache ports: - “8000:80” postgres: image:postgres:9.3 memcached: image:atbaker/memcached-verbose
  • 62. Useful resources https://docs.docker.com/ - official docs from Docker https://docs.docker.com/compose/ - official docs about Docker Compose https://docs.docker.com/docker/introduction/understanding-docker/ - Docker architecture https://linuxcontainers.org/ - WiKi about Linux Containers (LXC) https://lwn.net/Articles/531114/ - Linux namespaces overview https://lwn.net/Articles/532748/ - Linux PID namespaces