Docker Networking Cookbook
Table of Contents
Docker Networking Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why Subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Linux Networking Constructs
Introduction
Working with interfaces and addresses
Getting ready
How to do itā¦
Configuring Linux host routing
Getting ready
How to do itā¦
Exploring bridges
Getting ready
How to do itā¦
Making connections
Getting ready
How to do itā¦
Exploring network namespaces
Getting ready
How to do itā¦
2. Configuring and Monitoring Docker Networks
Introduction
Verifying host-level settings that impact Docker networking
Getting ready
How to do itā¦
Connecting containers in bridge mode
Getting ready
How to do itā¦
Exposing and publishing ports
Getting ready
How to do itā¦
Connecting containers to existing containers
Getting ready
How to do itā¦
Connecting containers in host mode
Getting ready
How to do itā¦
Configuring service-level settings
Getting ready
How to do itā¦
docker0 bridge addressing
Docker interface binding for published ports
Container interface MTU
Container default gateway
3. User-Defined Networks
Introduction
Viewing the Docker network configuration
Getting ready
How to do itā¦
Bridge
None
Host
Creating user-defined networks
Getting ready
How to do itā¦
Connecting containers to networks
Getting ready
How to do itā¦
Defining a user-defined bridge network
Getting ready
How to do itā¦
Example 1
Example 2
Creating a user-defined overlay network
Getting ready
A key-value store
Linux kernel version of 3.16
Open ports
Docker service configuration options
How to do itā¦
Isolating networks
Getting ready
How to do itā¦
Creating internal user-defined bridges
Creating internal user-defined overlays
4. Building Docker Networks
Introduction
Manually networking containers
Getting ready
How to do itā¦
Specifying your own bridge
Getting ready
How to do itā¦
Using an OVS bridge
Getting ready
How to do itā¦
Using an OVS bridge to connect Docker hosts
Getting ready
How to do itā¦
OVS and Docker together
Getting ready
How to do itā¦
5. Container Linking and Docker DNS
Introduction
Verifying a host-based DNS configuration inside a container
Getting ready
How to do itā¦
Overriding the default name resolution settings
Getting ready
How to do itā¦
Configuring links for name and service resolution
Getting ready
How to do itā¦
Leveraging Docker DNS
Getting ready
How to do itā¦
Creating Docker DNS aliases
Getting ready
How to do itā¦
6. Securing Container Networks
Introduction
Enabling and disabling ICC
Getting ready
How to do itā¦
Disabling outbound masquerading
Getting ready
How to do itā¦
Managing netfilter to Docker integration
Getting ready
How to do itā¦
Manually creating the required iptables rules
Creating custom iptables rules
Getting ready
How to do itā¦
Exposing services through a load balancer
Getting ready
How to do itā¦
7. Working with Weave Net
Introduction
Installing and configuring Weave
Getting ready
How to do itā¦
Running Weave-connected containers
Getting ready
How to do itā¦
Understanding Weave IPAM
Getting ready
How to do itā¦
Working with WeaveDNS
Getting ready
How to do itā¦
Weave security
Getting ready
How to do itā¦
Using the Weave network plugin
Getting ready
How to do itā¦
8. Working with Flannel
Introduction
Installing and configuring Flannel
Getting ready
How to do itā¦
Integrating Flannel with Docker
Getting ready
How to do itā¦
Using the VXLAN backend
Getting ready
How to do itā¦
Using the host gateway backend
Getting ready
How to do itā¦
Specifying Flannel options
Getting ready
How to do itā¦
9. Exploring Network Features
Introduction
Working with prerelease versions of Docker
Getting ready
How to do itā¦
Understanding MacVLAN interfaces
Getting ready
How to do itā¦
Working with the Docker MacVLAN network driver
Getting ready
How to do itā¦
Understanding IPVLAN interfaces
Getting ready
How to do itā¦
Working with the Docker IPVLAN network driver
Getting ready
How to do itā¦
Tagging VLAN IDs with MacVLAN and IPVLAN networks
Getting ready
How to do itā¦
10. Leveraging IPv6
Introduction
IPv6 command-line basics
Getting ready
How to do itā¦
Enabling IPv6 capabilities in Docker
Getting ready
How to do itā¦
Working with IPv6-enabled containers
Getting ready
How to do itā¦
Configuring NDP proxying
Getting ready
How to do itā¦
User-defined networks and IPv6
Getting ready
How to do itā¦
11. Troubleshooting Docker Networks
Introduction
Using tcpdump to verify network paths
Getting ready
How to do itā¦
Verifying VETH pairs
Getting ready
How to do itā¦
Verifying published ports and outbound masquerading
Getting ready
How to do itā¦
Verifying name resolution
Getting ready
How to do itā¦
Building a test container
Getting ready
How to do itā¦
Resetting the local Docker network database
Getting ready
How to do itā¦
Index
Docker Networking Cookbook
Copyright Ā© 2016 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 author, 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: November 2016
Production reference: 1231116
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78646-114-8
www.packtpub.com
Author
Jon Langemak
Reviewer
Francisco Souza
Commissioning Editor
Priya Singh
Acquisition Editor
Rahul Nair
Content Development Editor
Rashmi Suvarna
Technical Editor
Mohd Riyan Khan
Copy Editor
Dipti Mankame
Project Coordinator
Judie Jose
Proofreader
Safis Editing
Indexer
Pratik Shirodkar
Graphics
Kirk D'Penha
Production Coordinator
Deepika Naik
Cover Work
Deepika Naik
Jon Langemak has over 10 years of experience in designing, building, and maintaining high-performance networks. He is passionate about network operations, automation, and open source tooling. His current focus is on disruptive technologies and the impact they have on network operations. Outside of work, Jon blogs at dasblinkenlichten.com and enjoys collaborating with others in the network community on new ideas and concepts.