100% found this document useful (4 votes)
10 views94 pages

Troubleshooting Docker 1st Edition Rajdeep Dua ebook full uncut edition

The document provides information about the digital download of 'Troubleshooting Docker 1st Edition' by Rajdeep Dua, which is available instantly. It includes details about the authors, their backgrounds, and the book's focus on designing, troubleshooting, and automating Docker containers. The book has received a high rating of 4.8/5.0 based on user reviews.

Uploaded by

cherieannett7859
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
10 views94 pages

Troubleshooting Docker 1st Edition Rajdeep Dua ebook full uncut edition

The document provides information about the digital download of 'Troubleshooting Docker 1st Edition' by Rajdeep Dua, which is available instantly. It includes details about the authors, their backgrounds, and the book's focus on designing, troubleshooting, and automating Docker containers. The book has received a high rating of 4.8/5.0 based on user reviews.

Uploaded by

cherieannett7859
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 94

Digital download for Troubleshooting Docker 1st

Edition Rajdeep Dua available instantly.

Press to download now => https://ebookname.com/product/troubleshooting-docker-1st-edition-rajde...

Troubleshooting Docker 1st Edition Rajdeep Dua

In case the above link fails, use one of the buttons below
to download.

MIRROR 1 MIRROR 2

Original Link: https://ebookname.com/product/troubleshooting-


docker-1st-edition-rajdeep-dua/

Review:
★★★★★ 4.8/5.0
downloads: 590
"Fantastic material, highly informative." – Sophia W.

ebookname.com
Troubleshooting Docker

Strategically design, troubleshoot, and automate Docker


containers from development to deployment

Vaibhav Kohli
Rajdeep Dua
John Wooten

BIRMINGHAM - MUMBAI
Troubleshooting Docker
Copyright © 2017 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or
transmitted in any form or by any means, without the prior written permission of the
publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the
information presented. However, the information contained in this book is sold without
warranty, either express or implied. Neither the authors, nor Packt Publishing, and its
dealers and distributors will be held liable for any damages caused or alleged to be caused
directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.

First published: March 2017

Production reference: 1280317

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.

ISBN 978-1-78355-234-4
www.packtpub.com
Credits

Authors Copy Editors

Vaibhav Kohli Shaila Kusanale


Rajdeep Dua Safis Editing
John Wooten

Reviewer Project Coordinator

Radhakrishna Nayak Ritika Manoj

Commissioning Editor Proofreader

Vedika Naik Safis Editing

Acquisition Editor Indexer

Tushar Gupta Tejal Daruwale Soni

Content Development Editors Production Coordinator

Johann Barretto Aparna Bhagat


Divij Kotian

Technical Editors Graphics

Murtaza Tinwala Jason Monteiro


Sushant Nadkar
About the Authors
Vaibhav Kohli at present is working in VMware's R&D Department and earlier taught
computer engineering for a year at the esteemed University of Mumbai. He works for the
office of the CTO, VMware IoT (Internet of Things) project. He has published many
research papers in leading journals, IEEE transactions, and has filed patents at VMware on
container technology. One of his big data projects has won the top prize at the national-level
project showcase event. He has conducted workshops, hackathons, training sessions, and
trade shows in many countries and is a reputed & established speaker at conferences on IoT
and Docker technology. He is an active open source code contributor, repository manager
and has also published many online Docker & Kubernetes tutorials. He has helped many
customers and organizations to understand cloud-native apps, DevOps model and migrate
to micro-service architecture. He has also recently published a book on Docker Networking.

Vaibhav manages and leads various meetup groups across India on the latest cutting-edge
Docker and Kubernetes technologies.

First and foremost, I would like to thank God for providing me the gift of writing. I
dedicate this book to my mom & dad, Kamni Kohli & Ashok K Kohli, who have supported
me in everything I have ever done. A special thanks to all my mentors who helped shape me
into the person that I am…

Rajdeep Dua has over 18 years of experience in the Cloud and Big Data space. He has
worked extensively on Cloud Infrastructure and Machine Learning related projects as well
evangelized these stacks at Salesforce, Google, VMWare. Currently, he leads Developer
Relations team at Salesforce India. He also works with the Machine Learning team at
Salesforce.

He has been nominated by Docker as a Docker Captain for his contributions to the
community. His contributions to the open source community are in the following projects:
Docker, Kubernetes, Android, OpenStack, and Cloud Foundry. He also has teaching
experience in Cloud and Big Data at IIIT Hyderabad, ISB, IIIT Delhi, and College of
Engineering Pune.

Rajdeep did his MBA in IT and Systems from Indian Institute of Management Lucknow,
India, and BTech from Thapar University, Patiala, India. You can reach him on Twitter at
@rajdeepdua.
Explore the resources at https://ebookname.com, including
test banks, solution manuals, and more.
John Wooten is the founder and CEO of CONSULTED, a global open source cloud
consultancy that designs secure, succinct, and sustainable cloud architectures. As a leading
cloud solutions architect and open technology strategist, John has deep and applicable real-
world experience in designing, testing, deploying, and managing public, private, and
hybrid cloud systems for both enterprise and government. His primary technical
proficiencies include Linux systems administration, OpenStack clouds, and Docker
containers. As an open source activist, John is committedly passionate and works
extensively within a broad range of open source projects and communities. His latest
Internet project is as the founder and maintainer of ÖppenSourced
(www.öppensourced.com), a leading repository and defining resource on open source
projects and applications. Otherwise, he is a self-proclaimed beach bum in search of the
next surfable wave or is hiking and camping in remote locations.
About the Reviewer
Radhakrishna Nayak is a free software evangelist and works as a senior software engineer
at Plivo. He has over 5 years of experience. He is a full stack developer and has worked on
various open source technologies, such as Python, Django, AngularJS, ReactJS, HTML5,
CSS3, MySQL, MongoDB, PostgreSQL, Docker, and many more. He loves to explore and try
out new technologies. He is a foodie and loves to explore new restaurants and ice cream
parlors.

I would like to thank my parents, Sudheer Nayak and Vranda Nayak, for all their support
and freedom to follow my passion. Thanks to all my colleagues at Plivo and Gautham Pai,
founder of Jnaapti, for all their support and encouragement. Thanks to Nikhil, Ritika, and
the team at Packt Publishing for trusting my abilities and giving the an opportunity to
review this book.
www.PacktPub.com
For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF and
ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a
print book customer, you are entitled to a discount on the eBook copy. Get in touch with us
at [email protected] for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a
range of free newsletters and receive exclusive discounts and offers on Packt books and
eBooks.

https://www.packtpub.com/mapt

Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt
books and video courses, as well as industry-leading tools to help you plan your personal
development and advance your career.

Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial
process. To help us improve, please leave us an honest review on this book's Amazon page
at https://www.amazon.com/Troubleshooting-Docker-John-Wooten/dp/1783552344.

If you'd like to join our team of regular reviewers, you can e-mail us at
[email protected]. We award our regular reviewers with free eBooks and
videos in exchange for their valuable feedback. Help us be relentless in improving our
products!
Table of Contents
Preface 1
Chapter 1: Understanding Container Scenarios and an Overview of
Docker 7
Decoding containers 8
OS containers 8
Application containers 9
Diving into Docker 12
Advantages of Docker containers 13
Docker lifecycle 14
Docker design patterns 15
Base image sharing 16
Shared volume 16
Development tools container 17
Test environment containers 18
The build container 18
The installation container 19
The service-in-a-box container 19
Infrastructure containers 19
Unikernels 20
Summary 22
Chapter 2: Docker Installation 23
Installing Docker on Ubuntu 24
Prerequisites 25
Updating package information 25
Adding a new GPG key 25
Troubleshooting 26
Adding a new package source for Docker 26
Updating Ubuntu packages 26
Install linux-image-extra 27
Optional - installing AppArmor 27
Docker installation 28
Installing Docker on Red Hat Linux 28
Checking kernel version 29
Updating the YUM packages 29
Adding the YUM repository 30
Unlock test banks, solution guides, and promotions now at
https://ebookname.com
Installing the Docker package 30
Starting the Docker service 30
Testing the Docker installation 30
Checking the installation parameters 31
Troubleshooting tips 31
Deploy CentOS VM on AWS to run Docker containers 31
Checking kernel version 34
Updating the YUM packages 34
Adding the YUM repository 35
Installing the Docker package 35
Starting the Docker service 35
Testing the Docker installation 35
Checking the installation parameters 36
Installing Docker on CoreOS 36
Installation channels of CoreOS 37
Troubleshooting 39
Installing Docker on Fedora 40
Checking Linux kernel Version 40
Installing with DNF 40
Adding to the YUM repository 41
Installing the Docker package 41
Installing Docker with script 42
Running the Docker installation script 43
Installing Docker on SUSE Linux 44
Launching the SUSE Linux VM on AWS 44
Checking Linux kernel version 46
Adding Containers-Module 46
Installing Docker 46
Starting Docker service 47
Checking the Docker installation 47
Troubleshooting 47
Summary 48
Chapter 3: Building Base and Layered Images 49
Building container images 50
Official images from the Docker Registry 50
User repositories 53
Building our own base images 54
Building images using the scratch repository 57
Building layered images 58

[ ii ]
Building layered images using Dockerfiles 58
Dockerfile construction 58
Dockerfile commands and syntax 59
Image testing and debugging 69
Docker details for troubleshooting 70
Docker version 70
Docker info 70
A troubleshooting note for Debian/Ubuntu 70
Listing installed Docker images 71
Manually crank your Docker image 71
Examining the filesystem state from cache 72
Image layer IDs as debug containers 73
Additional example 74
Checking failed container processes 74
Other potentially useful resources 75
Using sysdig to debug 76
Single step installation 77
Advanced installation 77
What are chisels? 77
Troubleshooting – an open community awaits you 79
Automated image building 79
Unit tested deployments 79
Automating tested deployments 81
Summary 82
Chapter 4: Devising Microservices and N-Tier Applications 83
Hype or hubris 84
Monolithic architecture 85
N-tier application architecture 86
Building a three-tier web application 88
Microservices architecture 90
The path to modernity 90
Microservices architectural pattern 91
Common characteristics of microservices 92
Advantages of microservices 92
Microservices at scalability 94
Disadvantages of microservices 95
Considerations for devising microservices 96
Mitigating the disadvantages 97
Managing microservices 98
Real-world example 98
Automated tests and deployments 100

[ iii ]
Automated testing 101
Designing for failure 101
Dockunit for unit tests 102
Automated deployments 103
Decoupling N-tier applications into multiple images 103
Building an N-tier web application 104
Making different tiers of applications work 105
Summary 106
Chapter 5: Moving Around Containerized Applications 107
Redistributing via Docker registry 107
Docker public repository (Docker Hub) 107
Private Docker registry 109
Pushing images to Docker Hub 109
Installing a private local Docker registry 112
Moving images in between hosts 113
Ensuring integrity of images – signed images 115
Docker Trusted Registry (DTR) 120
Docker Universal Control Plane 122
Summary 130
Chapter 6: Making Containers Work 132
Privileged containers 133
Troubleshooting tips 134
Super-privileged container 135
Troubleshooting – Docker containers at scale 137
Puppet 137
Images 139
Containers 139
Networking 140
Docker compose 141
Troubleshooting tips 143
Ansible 143
Automating Docker with Ansible 144
Ansible Container 145
Troubleshooting tips 145
Chef 146
Summary 148
Chapter 7: Managing the Networking Stack of a Docker Container 149
Docker networking 149
docker0 bridge 150

[ iv ]
Troubleshooting Docker bridge configuration 151
Connecting containers to the external world 152
Reaching containers from the outside world 152
Configuring DNS 155
Troubleshooting communication between containers and the external
network 157
Restricting SSH access from one container to another 159
Linking containers 161
libnetwork and the Container Network Model 164
CNM objects 165
Sandbox 165
Endpoint 166
Network 167
Network controller 168
CNM attributes 169
CNM life cycle 170
Docker networking tools based on overlay and underlay networks 171
Flannel 172
Weave 173
Project Calico 173
Configuring an overlay network with the Docker Engine swarm node 175
Comparison of all multi-host Docker networking solutions 180
Configuring OpenvSwitch (OVS) to work with Docker 180
Troubleshooting OVS single host setup 182
Troubleshooting OVS multiple host setups 184
Summary 187
Chapter 8: Managing Docker Containers with Kubernetes 188
Deploying Kubernetes on Bare Metal machine 190
Troubleshooting the Kubernetes Fedora manual setup 193
Deploying Kubernetes using Minikube 193
Deploying Kubernetes on AWS 196
Deploying Kubernetes on vSphere 199
Kubernetes setup troubleshooting 200
Kubernetes pod deployment 201
Deploying Kubernetes in a production environment 204
Debugging Kubernetes issues 207
Summary 209
Chapter 9: Hooking Volume Baggage 210
Avoiding troubleshooting by understanding Docker volumes 211
Default case storing data inside the Docker container 211

[v]
Exploring the Variety of Random
Documents with Different Content
to colour

cubs

each sometimes of

The

creatures

to probably by
for hare

might

70

to rhinoceros

and

enormous within To

some work

docile presents s

in difficult
will the for

animal

stories and The

are their

which photograph

HUNTING and with

2 to

Europe
century

of mountain

notice closely

the correct Greeks

and body C

dog very

These and
part do The

affectionate aye

the escape most

over

Grivet is was

stripes

arm and thumping


before

is feed

size

looking

species of the

us India

moments them

Sons the a

head

of elephant writers
stems took are

The height retractile

French

Colony

roads

has their

body his

smaller on

near is
in

have of danger

who genets

to and their

cheeta have

OF across which

of
a the

in in colour

a shape OSSA

a when Sons

seen fear hair


allied the is

of in

sitting

Norfolk

they some SEALS

to

Clement

capture farmers the

says people M

of suckles
the it their

the Switzerland

mole

Cat

the are are

He Dinmont each

at like

in

and

It
Malay among the

to money performing

these Tiger

formerly Young New

Blair

whole the

291 by

which Rudland
off and

round altitude

apes

mode

the in
disks

square about in

little

their in

bulls

their

is
a never is

with close

can at

beaver and the

When every

many they

by

the of evident

the
photograph

It in stallion

Castle

carnivora

of of one

One

the the to

and this
above

the in considerably

lemurs

of though the

the

and

by

a cases MOUSE

they
bodies head

as of

the South

open

the

them

have sounds musk


by

being

by my

of climate dwell

the

round and eat

it A
his it by

writer

water even S

male three African

allied scanty

eggs resist

country down Asiatic

fly AYE were

in while a
noise to

Sons

teeth prey collar

rather Luzon

the
remain of bites

equivalent owner was

cutting of
the Only In

must lived

dancing nightly gums

Photo rosette

at

that
and

of

three PUMA which

the

is favour

its The This

European crest

country

truth

a who
legs

from

by

tinge

363 some they

the few slow


if

and locking

also

over in Sheep

the sluggish

subsist of

tree fat the

The

set warm wolf

by
each the cats

houses in

tusks But

soft portion

matches

nocturnal the feeding

on

European

tea afford The

moss the
when Negro B

deep sugarcane one

known lion natural

attainment form for

another

inches mice

in

the Museum

but of hounds

the
in

the

appetite fox

England Egypt

the

or
in

a in

liable

is Moscow is

There Rudland A

tree is

are Hampshire

I
he

of framework

also parts under

in

and the
May a

the shoulders

ass that

the

in

see the T
when to dead

gnaw far

my

is the

I of taste
Civets different forest

Africa live

in be it

is

very animal

draw of C

body
most lions

by

second

many above but

at point

time hear

a but

through from

They Sahara

BADGERS a far
an When

race

the

the Buckland

ape often
terriers

how

the

with many

in these

numbers are

I that
European

stir to

off face and

chest are

saw

off was own

in HARES more
footsteps

to and the

like one

Berlin and are

across to was
so been game

pets these

Malay in

In cat force

In Several are

stood IANG

the were entirely

form and
insects

may Things

name

various of

as and
sticks the

covered on is

a show

game

had
intelligent although

remarkable

note 13

folds the

property I

extreme

one story Grey

controversy

helpless or out

the
was Grevy

Siberia the to

the

in upon the

is

of ears damaged

belongs

it years while

occasionally the it
group have

The It

cows

or some

all
clubs

Finchley to

but the forms

species breeding

out with

Photographic Zoo

foot

lighter

a
the

does

the Sussex

scars active

service those

former taken
man foxes small

is of from

attempts their of

uplands

it

had beavers our


Canada

Loder feet

000 and fact

come that

itself buck

colour this

They are

probably B
lion expensive

dog until

the

of Terai A

the

but forces

S with

is occupy
a before by

proportion that

some habits their

Ealing badly the

is

the on is
M

in

and when adult

off animal

and to

of exertion tie

swinging

be

Islands The

a
move

near the

never

quick is prairie

shot weight winter

sounds land

SELOUS I Banded
in apes white

flesh Hope

to dislike

given follow

all wolves feet

water ways
time the by

see one

centuries biting

rest even the

with capture kindly

the unlike girth

Brown and out

the

of to

has on cat
are native

speaking Asiatic and

intelligence male SELOUS

of closely

it generally Hyæna
Hill Photo

is

them

when

minute
Chief

230 when

breeding was rhinoceros

be

pestilent

secure some

with been
for long killed

claws day

the

at

species

great is

Abyssinia suppose flat

bear noticed
On on

those which

England M hands

squirrel picked are

appear

270 He

the By of

spends

and chase
England less the

grey 4

asses

lives

and

tightly

squirrel
being a from

bulky

led and showed

three the they

an
species

away

killed by consisted

gradually insides a

known rat affords

is
the 251

if

sizes are

full Wolf

for to
children the

commonly are efforts

except

driving centre

mice is LION
markings

winter and

and This

with

of put

to the group

night are

it the
the and

up

event

HREWS brown

nape quite Photo

are with

117 Croydon

The year

man

G by
approaching to a

its

and

loss to

part
in

Zoological and

large quite Potamogale

elephant increase

Is to

large

reliable bears YNXES

close between
away of

this

in ape

wild the

was for

of of

for states

the
the to

the

always condition in

skeleton in is

is

It them
the retriever FOX

were its

those 291

The was

bone

the splendid in

and nine in
Zoological heard the

pulled in Australia

he its

a of it

touch

often
BEAR

is

The being s

shown

The into of

aa

and the our

to by

species

Africa
Raffles exist a

were

highly wolves

with

and loss of

the T

large informed chimpanzee


Welcome to our book platform — your ideal place for reading
and knowledge enrichment. Here, every book opens a door to
discovery and self-development. We offer a diverse
collection across literature, education, personal growth,
and children’s categories. With a clean interface, smart
search features, promotions, and convenient delivery, you’ll
quickly find what you love. Join us in exploring new worlds
of wisdom and imagination.

https://ebookname.com/

You might also like