Docker Networking Cookbook

Book description

60 practical recipes that help you gain expertise with Docker networking and understand the underlying constructs that make it all work

About This Book

  • Enhance your Docker networking skills and protect your organization using advanced networking functions

  • Learn how to use third party tools to extend Docker networking

  • This practical and recipe-based book demonstrates the different ways in which you can network containers leveraging the Docker engine.

  • Who This Book Is For

    The book is for system administrators as well as developers who are well versed with the concepts of Docker and have basic knowledge of Docker networking. You should also have sound knowledge of networking in general.

    What You Will Learn

  • Configure Linux networking primitives used by Docker networking

  • Build and deploy user-defined Docker networks

  • Examine the different options for resolving and linking containers

  • Implement custom networks for Docker to consume

  • Discover third-party networking plugins such as Weave and Flannel

  • Work through solutions to secure Docker containers and networks

  • Observe methodologies for troubleshooting container networks

  • Explore advanced and experimental Docker networking features

  • In Detail

    Networking functionality in Docker has changed considerably since its first release, evolving to offer a rich set of built-in networking features, as well as an extensible plugin model allowing for a wide variety of networking functionality. This book explores Docker networking capabilities from end to end. Begin by examining the building blocks used by Docker to implement fundamental containing networking before learning how to consume built-in networking constructs as well as custom networks you create on your own. Next, explore common third-party networking plugins, including detailed information on how these plugins inter-operate with the Docker engine. Consider available options for securing container networks, as well as a process for troubleshooting container connectivity.

    Finally, examine advanced Docker networking functions and their relevant use cases, tying together everything you need to succeed with your own projects.

    Style and approach

    This practical recipe-based book will take readers to next level of Docker networking. It covers relevant use cases and the advanced features of Docker

    Table of contents

    1. Docker Networking Cookbook
      1. Table of Contents
      2. Docker Networking Cookbook
      3. Credits
      4. About the Author
      5. About the Reviewer
      6. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why Subscribe?
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Errata
          2. Piracy
          3. Questions
      8. 1. Linux Networking Constructs
        1. Introduction
        2. Working with interfaces and addresses
          1. Getting ready
          2. How to do it…
        3. Configuring Linux host routing
          1. Getting ready
          2. How to do it…
        4. Exploring bridges
          1. Getting ready
          2. How to do it…
        5. Making connections
          1. Getting ready
          2. How to do it…
        6. Exploring network namespaces
          1. Getting ready
          2. How to do it…
      9. 2. Configuring and Monitoring Docker Networks
        1. Introduction
        2. Verifying host-level settings that impact Docker networking
          1. Getting ready
          2. How to do it…
        3. Connecting containers in bridge mode
          1. Getting ready
          2. How to do it…
        4. Exposing and publishing ports
          1. Getting ready
          2. How to do it…
        5. Connecting containers to existing containers
          1. Getting ready
          2. How to do it…
        6. Connecting containers in host mode
          1. Getting ready
          2. How to do it…
        7. Configuring service-level settings
          1. Getting ready
          2. How to do it…
            1. docker0 bridge addressing
            2. Docker interface binding for published ports
            3. Container interface MTU
            4. Container default gateway
      10. 3. User-Defined Networks
        1. Introduction
        2. Viewing the Docker network configuration
          1. Getting ready
          2. How to do it…
            1. Bridge
            2. None
            3. Host
        3. Creating user-defined networks
          1. Getting ready
          2. How to do it…
        4. Connecting containers to networks
          1. Getting ready
          2. How to do it…
        5. Defining a user-defined bridge network
          1. Getting ready
          2. How to do it…
            1. Example 1
            2. Example 2
        6. Creating a user-defined overlay network
          1. Getting ready
            1. A key-value store
            2. Linux kernel version of 3.16
            3. Open ports
            4. Docker service configuration options
          2. How to do it…
        7. Isolating networks
          1. Getting ready
          2. How to do it…
            1. Creating internal user-defined bridges
            2. Creating internal user-defined overlays
      11. 4. Building Docker Networks
        1. Introduction
        2. Manually networking containers
          1. Getting ready
          2. How to do it…
        3. Specifying your own bridge
          1. Getting ready
          2. How to do it…
        4. Using an OVS bridge
          1. Getting ready
          2. How to do it…
        5. Using an OVS bridge to connect Docker hosts
          1. Getting ready
          2. How to do it…
        6. OVS and Docker together
          1. Getting ready
          2. How to do it…
      12. 5. Container Linking and Docker DNS
        1. Introduction
        2. Verifying a host-based DNS configuration inside a container
          1. Getting ready
          2. How to do it…
        3. Overriding the default name resolution settings
          1. Getting ready
          2. How to do it…
        4. Configuring links for name and service resolution
          1. Getting ready
          2. How to do it…
        5. Leveraging Docker DNS
          1. Getting ready
          2. How to do it…
        6. Creating Docker DNS aliases
          1. Getting ready
          2. How to do it…
      13. 6. Securing Container Networks
        1. Introduction
        2. Enabling and disabling ICC
          1. Getting ready
          2. How to do it…
        3. Disabling outbound masquerading
          1. Getting ready
          2. How to do it…
        4. Managing netfilter to Docker integration
          1. Getting ready
          2. How to do it…
            1. Manually creating the required iptables rules
        5. Creating custom iptables rules
          1. Getting ready
          2. How to do it…
        6. Exposing services through a load balancer
          1. Getting ready
          2. How to do it…
      14. 7. Working with Weave Net
        1. Introduction
        2. Installing and configuring Weave
          1. Getting ready
          2. How to do it…
        3. Running Weave-connected containers
          1. Getting ready
          2. How to do it…
        4. Understanding Weave IPAM
          1. Getting ready
          2. How to do it…
        5. Working with WeaveDNS
          1. Getting ready
          2. How to do it…
        6. Weave security
          1. Getting ready
          2. How to do it…
        7. Using the Weave network plugin
          1. Getting ready
          2. How to do it…
      15. 8. Working with Flannel
        1. Introduction
        2. Installing and configuring Flannel
          1. Getting ready
          2. How to do it…
        3. Integrating Flannel with Docker
          1. Getting ready
          2. How to do it…
        4. Using the VXLAN backend
          1. Getting ready
          2. How to do it…
        5. Using the host gateway backend
          1. Getting ready
          2. How to do it…
        6. Specifying Flannel options
          1. Getting ready
          2. How to do it…
      16. 9. Exploring Network Features
        1. Introduction
        2. Working with prerelease versions of Docker
          1. Getting ready
          2. How to do it…
        3. Understanding MacVLAN interfaces
          1. Getting ready
          2. How to do it…
        4. Working with the Docker MacVLAN network driver
          1. Getting ready
          2. How to do it…
        5. Understanding IPVLAN interfaces
          1. Getting ready
          2. How to do it…
        6. Working with the Docker IPVLAN network driver
          1. Getting ready
          2. How to do it…
        7. Tagging VLAN IDs with MacVLAN and IPVLAN networks
          1. Getting ready
          2. How to do it…
      17. 10. Leveraging IPv6
        1. Introduction
        2. IPv6 command-line basics
          1. Getting ready
          2. How to do it…
        3. Enabling IPv6 capabilities in Docker
          1. Getting ready
          2. How to do it…
        4. Working with IPv6-enabled containers
          1. Getting ready
          2. How to do it…
        5. Configuring NDP proxying
          1. Getting ready
          2. How to do it…
        6. User-defined networks and IPv6
          1. Getting ready
          2. How to do it…
      18. 11. Troubleshooting Docker Networks
        1. Introduction
        2. Using tcpdump to verify network paths
          1. Getting ready
          2. How to do it…
        3. Verifying VETH pairs
          1. Getting ready
          2. How to do it…
        4. Verifying published ports and outbound masquerading
          1. Getting ready
          2. How to do it…
        5. Verifying name resolution
          1. Getting ready
          2. How to do it…
        6. Building a test container
          1. Getting ready
          2. How to do it…
        7. Resetting the local Docker network database
          1. Getting ready
          2. How to do it…
      19. Index

    Product information

    • Title: Docker Networking Cookbook
    • Author(s): Jon Langemak
    • Release date: November 2016
    • Publisher(s): Packt Publishing
    • ISBN: 9781786461148