SlideShare a Scribd company logo
1 of 22
Download to read offline
Lorem Ipsum Dolor
Docker Quiz
Ganesh & Hari
ganesh@codeops.tech
hari@codeops.tech
1. Question
What is the name of the container runtime used by
Docker? (hint: it is from Open Container Initiative)
1. Answer
RunC (see https://runc.io/)
$ docker info | grep -i runc
Runtimes: runc
Default Runtime: runc
2. Question
What happens when you execute this on the command-
line?
docker run debian /bin/sh
A. A prompt from the shell of created container will be thrown to you
B. A container is created and then exited immediately
C. A container is created and executes in the detached mode; you can
attach to it later using the container id
D. Docker CLI issues the error: Error response from daemon: No
command specified.
2. Answer
When you execute this command,
docker run debian /bin/sh
A container is created and then exited immediately.
$ docker ps -a
CONTAINER ID IMAGE COMMAND
CREATED STATUS PORTS NAMES
4c12998fd392 debian "/bin/bash"
6 seconds ago Exited (0) 5 seconds ago sick_panini
3. Question
What happens when you execute this on the command-
line with -p option?
$ docker run -p 80-87:80 --name nginx3 -d nginx
A. The port 80 in the container is mapped to ports 80 and 87 in the
host machine
B. The port 80 in the hostmachine is mapped to ports 80 and 87 in
the container
C. The port 80 in the container is mapped to a port in the range 80 to
87 in the host machine
D. Docker CLI will issue the error:“Invalid syntax: Using hyphen is not
allowed with -P command”
3. Answer
The option “-p 80-87:80” maps the port 80 in the container to a port
(based on the availability) in the range 80 to 87 in the host machine; this
is called “port range”
Example:
docker port nginx3
80/tcp -> 0.0.0.0:82
4. Question
Which command do you use “to find layers and their
sizes” in an image using Docker CLI?
A. Use “docker images -layers <<imageid>>” command
B. Use “docker layers <<imageid>> command
C. Use “docker history <<imageid>> command
D. There is no way you can find layers and their sizes using Docker CLI
- you need to use external tools
4. Answer
To find layers and their sizes in an image using Docker
CLI, use“docker history <<imageid>> command.
$ docker history google/cadvisor
IMAGE CREATED CREATED BY SIZE
COMMENT
106e303be3a4 2 weeks ago /bin/sh -c #(nop) ENTRYPOINT ["/usr/bin/cadvi 0 B
<missing> 2 weeks ago /bin/sh -c #(nop) EXPOSE 8080/tcp 0 B
<missing> 2 weeks ago /bin/sh -c #(nop) ADD file:1bde294f31142b3dee 25.87 MB
<missing> 2 weeks ago /bin/sh -c apk --no-cache add ca-certificates 17.13 MB
<missing> 2 weeks ago /bin/sh -c #(nop) ENV GLIBC_VERSION=2.23-r3 0 B
<missing> 2 weeks ago /bin/sh -c #(nop) MAINTAINER dengnan@google.c 0 B
<missing> 3 months ago /bin/sh -c #(nop) ADD file:852e9d0cb9d906535a 4.799 MB
5. Question
Which command do you use “recreate the Dockerfile
that was used to build that image” from a given image
id/tag using Docker CLI?
A. Use “docker images -dockerfile <<imageid>>” command
B. Use “docker build -reverse <<imageid>> command
C. Use “docker history --no-trunc --out:<filename> <<imageid>>
command
D. There is no way to recreate the Dockerfile that was used to build
that image from a given image id/tag using Docker CLI
5. Answer
There is NO way to recreate the Dockerfile that was used to build that
image from a given image id/tag using Docker CLI.
Think about Makefile: can you recreate the Makefile that was used to
build that executable file? No.
However, you can see the commands used to create the layers in the
image. Pass “—no-trunc” option to “docker history” command.
Example: “docker history --no-trunc google/cadvisor"
Try it now!
6. Question
You are creating a new container with this command:
docker run -d --name myubuntu ubuntu /bin/sh -c "while true; do echo current date and
time is: $(date); sleep 10; done”
Which network is the “myubuntu” container attached
to?
A. Bridge network
B. Overlay network
C. Custom network
D. Host network
E. None (not connected to any network)
6. Answer
Bridge network. By default, a newly created container is attached to the
bridge network (unless a different network is specified, for example, using
the “—network” option with the docker run command).
$ docker network inspect bridge
[
{
"Name": “bridge",
// ...
"Containers": {
"04579b88a74c981ae854261dffc7ab17328c28bb6fafec0f9c1e9431e77b3b27": {
"Name": "myubuntu",
"EndpointID":
"8a0e7a2559eac35eb60a90e85554679de276bd1ba39ff3a4083301d08e9ee384",
"MacAddress": "02:42:ac:11:00:03",
"IPv4Address": "172.17.0.3/16",
"IPv6Address": ""
},
// ...
},
// ...
}
]
7. Question
Which one of the following is a recommended Docker
BEST PRACTICE?
A. Prefer using docker commit or docker import instead of using
docker build using Dockerfiles (for creating custom/new images)
B. Use --link for linking containers explicitly on the same host instead
of using default bridge network for inter container communication
(ICC)
C. Put ADD commands later in the Dockerfile because the source files
or executables may change but the earlier layers will not change (to
avoid “cache bursting”)
D. Use explicit file/dir paths (e.g., -v /usr/mydir:/usr/mydir) instead of
using named volumes created using “docker volume create”
command
7. Answer
Avoid cache bursting and make your Dockerfile cache friendly. Example:
Put ADD commands later in the Dockerfile - because the source files or
executables may change but the earlier layers will not change
Other three are bad practices:
❖ Prefer using docker build using Dockerfiles (for creating custom/
new images) instead of using docker commit or docker import
❖ Using default bridge network for inter container communication
(ICC) instead of --link for linking containers explicitly on the same
host
❖ Use named volumes created using “docker volume create”
command instead of explicit file/dir paths (e.g., -v /usr/mydir:/usr/
mydir)
8. Question
When you run this command, what will be the PID of /
bin/sh?
docker run -it alpine /bin/sh
A. PID 1
B. Same as the PID of the docker process in the host
C. PID 0
D. Don’t know ;) Its randomly assigned by Docker
8. Answer
PID 1
docker run -it alpine /bin/sh
$ docker run -it alpine /bin/sh
/ # ps
PID USER TIME COMMAND
1 root 0:00 /bin/sh
7 root 0:00 ps
/ #
9. Question
What does this command do?
“docker run --privileged -d docker:dind”
A. It runs “docker within docker”
B. It runs the monitoring tool for docker
C. It is equivalent to “docker exec” and attach to a running container
D. It is for debugging docker containers
9. Answer
“docker run --privileged -d docker:dind"
“docker:dind” is the official “Docker in Docker base image”
Upcoming bootcamps
h"ps://www.townscript.com/e/modernarch	(5th	Nov)		
h"ps://www.townscript.com/e/solid	(19th	Nov)		
h"ps://www.townscript.com/e/interneto<hings	(26th	Nov)		
h"ps://www.townscript.com/e/so<ware-architecture	(10	Oct)
Meetups
http://www.meetup.com/Core-Java-Meetup-Bangalore/ (12th Nov, lastminute.com)
https://www.meetup.com/Mobile-App-Developers-Bangalore-Meetup/ (26th Nov, Work-In)
http://www.meetup.com/JavaScript-Meetup-Bangalore/ (19th Nov, HPE)
http://www.meetup.com/Container-Developers-Meetup-Bangalore/ (Dec 3, Microsoft)
http://www.meetup.com/CloudOps-Meetup-Bangalore/ (12th Nov, lastminute.com)
ganesh@codeops.tech @GSamarthyam
www.codeops.tech slideshare.net/sgganesh
+91 98801 64463 bit.ly/ganeshsg

More Related Content

What's hot

Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentationToufiq Mahmud
 
Docker introduction for the beginners
Docker introduction for the beginnersDocker introduction for the beginners
Docker introduction for the beginnersJuneyoung Oh
 
Laravel introduction
Laravel introductionLaravel introduction
Laravel introductionSimon Funk
 
virtual hosting and configuration
virtual hosting and configurationvirtual hosting and configuration
virtual hosting and configurationHAMZA AHMED
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraformJulien Pivotto
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShellDale Lane
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java DevelopersYakov Fain
 
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...Edureka!
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to dockerInstruqt
 
Web Development with Laravel 5
Web Development with Laravel 5Web Development with Laravel 5
Web Development with Laravel 5Soheil Khodayari
 
eServices-Tp2: bpel
eServices-Tp2: bpeleServices-Tp2: bpel
eServices-Tp2: bpelLilia Sfaxi
 
15 practical grep command examples in linux
15 practical grep command examples in linux15 practical grep command examples in linux
15 practical grep command examples in linuxTeja Bheemanapally
 

What's hot (20)

Laravel Introduction
Laravel IntroductionLaravel Introduction
Laravel Introduction
 
Express js
Express jsExpress js
Express js
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentation
 
Final terraform
Final terraformFinal terraform
Final terraform
 
Consul
ConsulConsul
Consul
 
Docker introduction for the beginners
Docker introduction for the beginnersDocker introduction for the beginners
Docker introduction for the beginners
 
Laravel introduction
Laravel introductionLaravel introduction
Laravel introduction
 
Laravel Tutorial PPT
Laravel Tutorial PPTLaravel Tutorial PPT
Laravel Tutorial PPT
 
virtual hosting and configuration
virtual hosting and configurationvirtual hosting and configuration
virtual hosting and configuration
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraform
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShell
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
 
Tomcat Server
Tomcat ServerTomcat Server
Tomcat Server
 
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...
Docker vs VM | | Containerization or Virtualization - The Differences | DevOp...
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Web Development with Laravel 5
Web Development with Laravel 5Web Development with Laravel 5
Web Development with Laravel 5
 
eServices-Tp2: bpel
eServices-Tp2: bpeleServices-Tp2: bpel
eServices-Tp2: bpel
 
15 practical grep command examples in linux
15 practical grep command examples in linux15 practical grep command examples in linux
15 practical grep command examples in linux
 

Similar to Docker by Example - Quiz

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
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Paul Chao
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇Philip Zheng
 
Lecture eight to be introduced in class.
Lecture eight to be introduced in class.Lecture eight to be introduced in class.
Lecture eight to be introduced in class.nigamsajal14
 
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
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017Paul Chao
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇Philip Zheng
 
Docker workshop
Docker workshopDocker workshop
Docker workshopEvans Ye
 
Docker for Deep Learning (Andrea Panizza)
Docker for Deep Learning (Andrea Panizza)Docker for Deep Learning (Andrea Panizza)
Docker for Deep Learning (Andrea Panizza)MeetupDataScienceRoma
 
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
 
Build service with_docker_in_90mins
Build service with_docker_in_90minsBuild service with_docker_in_90mins
Build service with_docker_in_90minsLarry Cai
 

Similar to Docker by Example - Quiz (20)

Docker, but what it is?
Docker, but what it is?Docker, but what it is?
Docker, but what it is?
 
Docker From Scratch
Docker From ScratchDocker From Scratch
Docker From Scratch
 
ABCs of docker
ABCs of dockerABCs of docker
ABCs of docker
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung
 
手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇手把手帶你學 Docker 入門篇
手把手帶你學 Docker 入門篇
 
Lecture eight to be introduced in class.
Lecture eight to be introduced in class.Lecture eight to be introduced in class.
Lecture eight to be introduced in class.
 
docker.pdf
docker.pdfdocker.pdf
docker.pdf
 
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 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Docker
DockerDocker
Docker
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇
 
Docker
DockerDocker
Docker
 
A Hands-on Introduction to Docker
A Hands-on Introduction to DockerA Hands-on Introduction to Docker
A Hands-on Introduction to Docker
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Docker workshop
Docker workshopDocker workshop
Docker workshop
 
Docker for Deep Learning (Andrea Panizza)
Docker for Deep Learning (Andrea Panizza)Docker for Deep Learning (Andrea Panizza)
Docker for Deep Learning (Andrea Panizza)
 
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
 
Build service with_docker_in_90mins
Build service with_docker_in_90minsBuild service with_docker_in_90mins
Build service with_docker_in_90mins
 

More from Ganesh Samarthyam

Applying Refactoring Tools in Practice
Applying Refactoring Tools in PracticeApplying Refactoring Tools in Practice
Applying Refactoring Tools in PracticeGanesh Samarthyam
 
CFP - 1st Workshop on “AI Meets Blockchain”
CFP - 1st Workshop on “AI Meets Blockchain”CFP - 1st Workshop on “AI Meets Blockchain”
CFP - 1st Workshop on “AI Meets Blockchain”Ganesh Samarthyam
 
Great Coding Skills Aren't Enough
Great Coding Skills Aren't EnoughGreat Coding Skills Aren't Enough
Great Coding Skills Aren't EnoughGanesh Samarthyam
 
College Project - Java Disassembler - Description
College Project - Java Disassembler - DescriptionCollege Project - Java Disassembler - Description
College Project - Java Disassembler - DescriptionGanesh Samarthyam
 
Coding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean CodeCoding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean CodeGanesh Samarthyam
 
Design Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesDesign Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesGanesh Samarthyam
 
Bangalore Container Conference 2017 - Brief Presentation
Bangalore Container Conference 2017 - Brief PresentationBangalore Container Conference 2017 - Brief Presentation
Bangalore Container Conference 2017 - Brief PresentationGanesh Samarthyam
 
Bangalore Container Conference 2017 - Poster
Bangalore Container Conference 2017 - PosterBangalore Container Conference 2017 - Poster
Bangalore Container Conference 2017 - PosterGanesh Samarthyam
 
Software Design in Practice (with Java examples)
Software Design in Practice (with Java examples)Software Design in Practice (with Java examples)
Software Design in Practice (with Java examples)Ganesh Samarthyam
 
OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ Ganesh Samarthyam
 
Bangalore Container Conference 2017 - Sponsorship Deck
Bangalore Container Conference 2017 - Sponsorship DeckBangalore Container Conference 2017 - Sponsorship Deck
Bangalore Container Conference 2017 - Sponsorship DeckGanesh Samarthyam
 
Let's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming LanguageLet's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming LanguageGanesh Samarthyam
 
Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction Ganesh Samarthyam
 
Java Generics - Quiz Questions
Java Generics - Quiz QuestionsJava Generics - Quiz Questions
Java Generics - Quiz QuestionsGanesh Samarthyam
 
Software Architecture - Quiz Questions
Software Architecture - Quiz QuestionsSoftware Architecture - Quiz Questions
Software Architecture - Quiz QuestionsGanesh Samarthyam
 
Core Java: Best practices and bytecodes quiz
Core Java: Best practices and bytecodes quizCore Java: Best practices and bytecodes quiz
Core Java: Best practices and bytecodes quizGanesh Samarthyam
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesGanesh Samarthyam
 

More from Ganesh Samarthyam (20)

Wonders of the Sea
Wonders of the SeaWonders of the Sea
Wonders of the Sea
 
Animals - for kids
Animals - for kids Animals - for kids
Animals - for kids
 
Applying Refactoring Tools in Practice
Applying Refactoring Tools in PracticeApplying Refactoring Tools in Practice
Applying Refactoring Tools in Practice
 
CFP - 1st Workshop on “AI Meets Blockchain”
CFP - 1st Workshop on “AI Meets Blockchain”CFP - 1st Workshop on “AI Meets Blockchain”
CFP - 1st Workshop on “AI Meets Blockchain”
 
Great Coding Skills Aren't Enough
Great Coding Skills Aren't EnoughGreat Coding Skills Aren't Enough
Great Coding Skills Aren't Enough
 
College Project - Java Disassembler - Description
College Project - Java Disassembler - DescriptionCollege Project - Java Disassembler - Description
College Project - Java Disassembler - Description
 
Coding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean CodeCoding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean Code
 
Design Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesDesign Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on Examples
 
Bangalore Container Conference 2017 - Brief Presentation
Bangalore Container Conference 2017 - Brief PresentationBangalore Container Conference 2017 - Brief Presentation
Bangalore Container Conference 2017 - Brief Presentation
 
Bangalore Container Conference 2017 - Poster
Bangalore Container Conference 2017 - PosterBangalore Container Conference 2017 - Poster
Bangalore Container Conference 2017 - Poster
 
Software Design in Practice (with Java examples)
Software Design in Practice (with Java examples)Software Design in Practice (with Java examples)
Software Design in Practice (with Java examples)
 
OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++
 
Bangalore Container Conference 2017 - Sponsorship Deck
Bangalore Container Conference 2017 - Sponsorship DeckBangalore Container Conference 2017 - Sponsorship Deck
Bangalore Container Conference 2017 - Sponsorship Deck
 
Let's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming LanguageLet's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming Language
 
Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction
 
Java Generics - Quiz Questions
Java Generics - Quiz QuestionsJava Generics - Quiz Questions
Java Generics - Quiz Questions
 
Java Generics - by Example
Java Generics - by ExampleJava Generics - by Example
Java Generics - by Example
 
Software Architecture - Quiz Questions
Software Architecture - Quiz QuestionsSoftware Architecture - Quiz Questions
Software Architecture - Quiz Questions
 
Core Java: Best practices and bytecodes quiz
Core Java: Best practices and bytecodes quizCore Java: Best practices and bytecodes quiz
Core Java: Best practices and bytecodes quiz
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
 

Recently uploaded

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyAnusha Are
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 

Recently uploaded (20)

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 

Docker by Example - Quiz

  • 1. Lorem Ipsum Dolor Docker Quiz Ganesh & Hari ganesh@codeops.tech hari@codeops.tech
  • 2. 1. Question What is the name of the container runtime used by Docker? (hint: it is from Open Container Initiative)
  • 3. 1. Answer RunC (see https://runc.io/) $ docker info | grep -i runc Runtimes: runc Default Runtime: runc
  • 4. 2. Question What happens when you execute this on the command- line? docker run debian /bin/sh A. A prompt from the shell of created container will be thrown to you B. A container is created and then exited immediately C. A container is created and executes in the detached mode; you can attach to it later using the container id D. Docker CLI issues the error: Error response from daemon: No command specified.
  • 5. 2. Answer When you execute this command, docker run debian /bin/sh A container is created and then exited immediately. $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4c12998fd392 debian "/bin/bash" 6 seconds ago Exited (0) 5 seconds ago sick_panini
  • 6. 3. Question What happens when you execute this on the command- line with -p option? $ docker run -p 80-87:80 --name nginx3 -d nginx A. The port 80 in the container is mapped to ports 80 and 87 in the host machine B. The port 80 in the hostmachine is mapped to ports 80 and 87 in the container C. The port 80 in the container is mapped to a port in the range 80 to 87 in the host machine D. Docker CLI will issue the error:“Invalid syntax: Using hyphen is not allowed with -P command”
  • 7. 3. Answer The option “-p 80-87:80” maps the port 80 in the container to a port (based on the availability) in the range 80 to 87 in the host machine; this is called “port range” Example: docker port nginx3 80/tcp -> 0.0.0.0:82
  • 8. 4. Question Which command do you use “to find layers and their sizes” in an image using Docker CLI? A. Use “docker images -layers <<imageid>>” command B. Use “docker layers <<imageid>> command C. Use “docker history <<imageid>> command D. There is no way you can find layers and their sizes using Docker CLI - you need to use external tools
  • 9. 4. Answer To find layers and their sizes in an image using Docker CLI, use“docker history <<imageid>> command. $ docker history google/cadvisor IMAGE CREATED CREATED BY SIZE COMMENT 106e303be3a4 2 weeks ago /bin/sh -c #(nop) ENTRYPOINT ["/usr/bin/cadvi 0 B <missing> 2 weeks ago /bin/sh -c #(nop) EXPOSE 8080/tcp 0 B <missing> 2 weeks ago /bin/sh -c #(nop) ADD file:1bde294f31142b3dee 25.87 MB <missing> 2 weeks ago /bin/sh -c apk --no-cache add ca-certificates 17.13 MB <missing> 2 weeks ago /bin/sh -c #(nop) ENV GLIBC_VERSION=2.23-r3 0 B <missing> 2 weeks ago /bin/sh -c #(nop) MAINTAINER dengnan@google.c 0 B <missing> 3 months ago /bin/sh -c #(nop) ADD file:852e9d0cb9d906535a 4.799 MB
  • 10. 5. Question Which command do you use “recreate the Dockerfile that was used to build that image” from a given image id/tag using Docker CLI? A. Use “docker images -dockerfile <<imageid>>” command B. Use “docker build -reverse <<imageid>> command C. Use “docker history --no-trunc --out:<filename> <<imageid>> command D. There is no way to recreate the Dockerfile that was used to build that image from a given image id/tag using Docker CLI
  • 11. 5. Answer There is NO way to recreate the Dockerfile that was used to build that image from a given image id/tag using Docker CLI. Think about Makefile: can you recreate the Makefile that was used to build that executable file? No. However, you can see the commands used to create the layers in the image. Pass “—no-trunc” option to “docker history” command. Example: “docker history --no-trunc google/cadvisor" Try it now!
  • 12. 6. Question You are creating a new container with this command: docker run -d --name myubuntu ubuntu /bin/sh -c "while true; do echo current date and time is: $(date); sleep 10; done” Which network is the “myubuntu” container attached to? A. Bridge network B. Overlay network C. Custom network D. Host network E. None (not connected to any network)
  • 13. 6. Answer Bridge network. By default, a newly created container is attached to the bridge network (unless a different network is specified, for example, using the “—network” option with the docker run command). $ docker network inspect bridge [ { "Name": “bridge", // ... "Containers": { "04579b88a74c981ae854261dffc7ab17328c28bb6fafec0f9c1e9431e77b3b27": { "Name": "myubuntu", "EndpointID": "8a0e7a2559eac35eb60a90e85554679de276bd1ba39ff3a4083301d08e9ee384", "MacAddress": "02:42:ac:11:00:03", "IPv4Address": "172.17.0.3/16", "IPv6Address": "" }, // ... }, // ... } ]
  • 14. 7. Question Which one of the following is a recommended Docker BEST PRACTICE? A. Prefer using docker commit or docker import instead of using docker build using Dockerfiles (for creating custom/new images) B. Use --link for linking containers explicitly on the same host instead of using default bridge network for inter container communication (ICC) C. Put ADD commands later in the Dockerfile because the source files or executables may change but the earlier layers will not change (to avoid “cache bursting”) D. Use explicit file/dir paths (e.g., -v /usr/mydir:/usr/mydir) instead of using named volumes created using “docker volume create” command
  • 15. 7. Answer Avoid cache bursting and make your Dockerfile cache friendly. Example: Put ADD commands later in the Dockerfile - because the source files or executables may change but the earlier layers will not change Other three are bad practices: ❖ Prefer using docker build using Dockerfiles (for creating custom/ new images) instead of using docker commit or docker import ❖ Using default bridge network for inter container communication (ICC) instead of --link for linking containers explicitly on the same host ❖ Use named volumes created using “docker volume create” command instead of explicit file/dir paths (e.g., -v /usr/mydir:/usr/ mydir)
  • 16. 8. Question When you run this command, what will be the PID of / bin/sh? docker run -it alpine /bin/sh A. PID 1 B. Same as the PID of the docker process in the host C. PID 0 D. Don’t know ;) Its randomly assigned by Docker
  • 17. 8. Answer PID 1 docker run -it alpine /bin/sh $ docker run -it alpine /bin/sh / # ps PID USER TIME COMMAND 1 root 0:00 /bin/sh 7 root 0:00 ps / #
  • 18. 9. Question What does this command do? “docker run --privileged -d docker:dind” A. It runs “docker within docker” B. It runs the monitoring tool for docker C. It is equivalent to “docker exec” and attach to a running container D. It is for debugging docker containers
  • 19. 9. Answer “docker run --privileged -d docker:dind" “docker:dind” is the official “Docker in Docker base image”
  • 21. Meetups http://www.meetup.com/Core-Java-Meetup-Bangalore/ (12th Nov, lastminute.com) https://www.meetup.com/Mobile-App-Developers-Bangalore-Meetup/ (26th Nov, Work-In) http://www.meetup.com/JavaScript-Meetup-Bangalore/ (19th Nov, HPE) http://www.meetup.com/Container-Developers-Meetup-Bangalore/ (Dec 3, Microsoft) http://www.meetup.com/CloudOps-Meetup-Bangalore/ (12th Nov, lastminute.com)