SlideShare a Scribd company logo
1 of 20
DOCKER NETWORKING
Presenter Name: Sreenivas Makam
Presented at: Docker Meetup Bangalore
Presentation Date: August 22, 2015
About me
• Senior Engineering Manager at Cisco Systems
Data Center group
• Like to follow SDN and Cloud related
Opensource projects and write about it.
• Personal blog can be found at
https://sreeninet.wordpress.com/ and my hacky
code at https://github.com/smakam
• You can reach me on LinkedIn at
https://in.linkedin.com/in/sreenivasmakam
Agenda
• Why we need Container Networking?
• Current Docker Networking Internals
• Existing external networking options for
Docker – Pipework, Flannel, Weave
• Limitations of current Docker Networking
• What’s coming up Next
• Demo
Why we need Container Networking?
• Containers need to talk to external world.
• Reach Containers from external world to use
the services Containers provides.
• Containers need to talk to host machine.
• Inter-container connectivity in same host and
across hosts.
Basics
• Namespaces – Virtualize processes,
networks, file systems, users etc.
• Software switch – could be Linux bridge, OVS,
Cisco n1k, VMWare vswitch etc that resides
in hypervisor used to switch traffic between
VM, Container.
• Iptables – for NAT kind of functionality
Docker Networking options
• –net=bridge. This is the default option that Docker provides where
containers connect to the linux “docker” bridge.
• –net=host. In this option, there is no new network namespace
created for the container and the container shares the same
network namespace as host machine.
• –net=(container name or id). In this option, the new container
shares the same network namespace as the specified container in
the ‘net’ option. (Example: “sudo docker run -ti –name=ubuntu2
–net=container:ubuntu1 ubuntu:14.04 /bin/bash”. Here, ubuntu2
container shares same network namespace as ubuntu1 container)
• –net=none. In this option, container does not get allocated a new
network namespace. Only the loopback interface is created in this
case. This option is useful in scenarios where we want to create
our own networking options for the container.
Default Docker Networking
• Docker linux bridge(docker0) gets created on
the host machine. Default IP address is
172.17.42.1 with 16 bit subnet mask.
• Each Container has 2 network interface, eth0
gets IP address in 172.17.x.x network,
another is loopback interface.
• Host machine has veth* interface on the
linux bridge to which eth0 interface in the
container gets connected.
Docker Container Networking
External connectivity to Containers
• To reach Apache webserver container service
from outside.
docker run -d -p 8080:80
smakam/apachedocker
• Port 80 on the Container is mapped to port
8080 on localhost.
Linking 2 containers on same host –
Option 1
• 2 Containers Wordpress and mysql compose the
Wordpress application.
• Wordpress application needs to connect to mysql
container.
docker run --name some-mysql -e
MYSQL_ROOT_PASSWORD=mysql -d mysql
docker run --name some-wordpress -e
WORDPRESS_DB_PASSWORD=mysql -e
WORDPRESS_DB_HOST=172.17.0.16:3306 -p 8080:80 -d
wordpress
• Above, we need to specify IP address and environment
variable manually.
Linking 2 containers on same host –
Option 2
• In this option, we use Container linking mechanism to feed environment
variables automatically.
docker run --name mysql -e MYSQL_ROOT_PASSWORD=mysql -d mysql
docker run --name wordpress --link mysql:mysql -d -p 8080:80 wordpress
• Following environment variables automatically gets created in Wordpress
container.
root@ee066d135ca5:/var/www/html# set|grep MYSQL
MYSQL_ENV_MYSQL_MAJOR=5.6
MYSQL_ENV_MYSQL_ROOT_PASSWORD=mysql
MYSQL_ENV_MYSQL_VERSION=5.6.26
MYSQL_NAME=/wordpress/mysql
MYSQL_PORT=tcp://172.17.0.24:3306
MYSQL_PORT_3306_TCP=tcp://172.17.0.24:3306
MYSQL_PORT_3306_TCP_ADDR=172.17.0.24
MYSQL_PORT_3306_TCP_PORT=3306
MYSQL_PORT_3306_TCP_PROTO=tcp
Linking 2 containers on same host –
Option 3
• In this option, we use docker-compose to create and link both the containers.
Docker-compose.yml
wordpress:
image: wordpress
links:
- db:mysql
ports:
- 8080:80
db:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: example
• We can execute “docker-compose up –d” to start the Wordpress application.
Native Docker Networking limitations
• Cannot create more than 1 interface in the
container.
• Multi-host containers are difficult to create.
• IP addressing scheme for the containers is
not flexible.
• Multi-tenant container solution is not
possible with enough isolation and security.
• Automatic service discovery is not possible.
Pipework
• Pipework is a script developed by Jerome Petazonni to
network Docker containers for complex environments.
• As mentioned by Jeremy himself, the script is a temporary
solution till a more permanent solution gets developed
natively in Docker.
• Following are some features that Pipework supports:
– Connect Containers across multiple hosts.
– Create any number of interfaces with arbitrary IP addresses.
– Allows use of ovs bridge instead of Linux bridge.
– Allows isolation of containers using vlans.
– Allows configuration of IP, mac, netmask, gateway.
Host 1:
sudo ovs-vsctl add-port ovsbr0 gre0 --
set interface gre0 type=gre
options:remote_ip=<host2 ip>
sudo ~/pipework/pipework ovsbr0
<cid> 11.1.1.1/24 @10
Host 2:
sudo ovs-vsctl add-port ovsbr0 gre0 --
set interface gre0 type=gre
options:remote_ip= <host1 ip>
sudo ~/pipework/pipework ovsbr0
<cid> 11.1.1.3/24 @10
Weave
• Weave creates a Weave bridge as well as a Weave router in the
host machine.
• Weave router establishes both tcp and udp connection across
hosts to other Weave routers. TCP connection is used for
discovery and protocol related exchange. UDP is used for data
encapsulation. Encryption can be done if needed.
• The Weave bridge is configured to sniff the packets that needs to
be sent across hosts and redirect to the Weave router. For local
switching, weave router is not used.
Flannel
• Flannel creates an Overlay network using either
udp or vxlan encapsulation.
• Flannel links itself to the Docker bridge to which
the containers are attached and creates the
overlay.
• Flannel is closely integrated with CoreOS, can be
used as standalone as well.
What’s ahead -
Docker Experimental Networking
• Docker Experimental Networking addresses
majority of the problems mentioned above.
• Current approach taken is batteries-included
approach where Docker provides a default
Networking solution that customers can
substitute with other Networking plugins based
on their need.
• Docker 1.8 experimental release provides a good
taste of the Networking features that will be
coming soon.
References
• https://docs.docker.com/
• https://github.com/docker/docker/tree/mast
er/experimental
• https://sreeninet.wordpress.com/category/d
ocker/
QUESTIONS?
Linking 2 containers on same host
Web server container connecting to Database container:
$ sudo docker run -d --name db training/postgres
$ sudo docker run -d -p 8080:80 --name web --link db:dblink
smakam/apachedocker
• Webserver container gets environment variables of DB container
using which it connects to database. Following environment
variables gets imported automatically.
# set|grep DBLINK DBLINK_ENV_PG_VERSION=9.3
DBLINK_NAME=/web/dblink DBLINK_PORT=tcp://172.17.0.3:5432
DBLINK_PORT_5432_TCP=tcp://172.17.0.3:5432
DBLINK_PORT_5432_TCP_ADDR=172.17.0.3
DBLINK_PORT_5432_TCP_PORT=5432
DBLINK_PORT_5432_TCP_PROTO=tcp

More Related Content

What's hot

What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017
What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017
What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017
Ranjith Rajaram
 
Web scale infrastructures with kubernetes and flannel
Web scale infrastructures with kubernetes and flannelWeb scale infrastructures with kubernetes and flannel
Web scale infrastructures with kubernetes and flannel
purpleocean
 
Docker - container and lightweight virtualization
Docker - container and lightweight virtualization Docker - container and lightweight virtualization
Docker - container and lightweight virtualization
Sim Janghoon
 

What's hot (20)

Docker: the road ahead
Docker: the road aheadDocker: the road ahead
Docker: the road ahead
 
Docker networking
Docker networkingDocker networking
Docker networking
 
Docker Meetup: Docker Networking 1.11, by Madhu Venugopal
Docker Meetup: Docker Networking 1.11, by Madhu VenugopalDocker Meetup: Docker Networking 1.11, by Madhu Venugopal
Docker Meetup: Docker Networking 1.11, by Madhu Venugopal
 
DockerDay2015: Docker Networking
DockerDay2015: Docker NetworkingDockerDay2015: Docker Networking
DockerDay2015: Docker Networking
 
"One network to rule them all" - OpenStack Summit Austin 2016
"One network to rule them all" - OpenStack Summit Austin 2016"One network to rule them all" - OpenStack Summit Austin 2016
"One network to rule them all" - OpenStack Summit Austin 2016
 
Docker Multihost Networking
Docker Multihost Networking Docker Multihost Networking
Docker Multihost Networking
 
Networking in Docker Containers
Networking in Docker ContainersNetworking in Docker Containers
Networking in Docker Containers
 
Docker Multi Host Networking, Rachit Arora, IBM
Docker Multi Host Networking, Rachit Arora, IBMDocker Multi Host Networking, Rachit Arora, IBM
Docker Multi Host Networking, Rachit Arora, IBM
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 Presentation
 
Docker-OVS
Docker-OVSDocker-OVS
Docker-OVS
 
Docker Online Meetup #29: Docker Networking is Now GA
Docker Online Meetup #29: Docker Networking is Now GA Docker Online Meetup #29: Docker Networking is Now GA
Docker Online Meetup #29: Docker Networking is Now GA
 
Docker Networking
Docker NetworkingDocker Networking
Docker Networking
 
What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017
What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017
What should be PID 1 in a container ? by Ranjith Rajaram for #rootConf 2017
 
Web scale infrastructures with kubernetes and flannel
Web scale infrastructures with kubernetes and flannelWeb scale infrastructures with kubernetes and flannel
Web scale infrastructures with kubernetes and flannel
 
Docker Networking in OpenStack: What you need to know now
Docker Networking in OpenStack: What you need to know nowDocker Networking in OpenStack: What you need to know now
Docker Networking in OpenStack: What you need to know now
 
Pipework: Software-Defined Network for Containers and Docker
Pipework: Software-Defined Network for Containers and DockerPipework: Software-Defined Network for Containers and Docker
Pipework: Software-Defined Network for Containers and Docker
 
Docker Networking Tip - Load balancing options
Docker Networking Tip - Load balancing optionsDocker Networking Tip - Load balancing options
Docker Networking Tip - Load balancing options
 
Docker networking
Docker networkingDocker networking
Docker networking
 
Docker - container and lightweight virtualization
Docker - container and lightweight virtualization Docker - container and lightweight virtualization
Docker - container and lightweight virtualization
 
macvlan and ipvlan
macvlan and ipvlanmacvlan and ipvlan
macvlan and ipvlan
 

Viewers also liked

Inside Docker for Fedora20/RHEL7
Inside Docker for Fedora20/RHEL7Inside Docker for Fedora20/RHEL7
Inside Docker for Fedora20/RHEL7
Etsuji Nakai
 

Viewers also liked (20)

Inside Docker for Fedora20/RHEL7
Inside Docker for Fedora20/RHEL7Inside Docker for Fedora20/RHEL7
Inside Docker for Fedora20/RHEL7
 
Docker Networking (Libnetwork) - Lakshman Kumar
Docker Networking (Libnetwork) - Lakshman KumarDocker Networking (Libnetwork) - Lakshman Kumar
Docker Networking (Libnetwork) - Lakshman Kumar
 
Docker Online Meetup #22: Docker Networking
Docker Online Meetup #22: Docker NetworkingDocker Online Meetup #22: Docker Networking
Docker Online Meetup #22: Docker Networking
 
Docker Networking Deep Dive
Docker Networking Deep DiveDocker Networking Deep Dive
Docker Networking Deep Dive
 
Docker Networking: Control plane and Data plane
Docker Networking: Control plane and Data planeDocker Networking: Control plane and Data plane
Docker Networking: Control plane and Data plane
 
Dockerffm meetup 20150113_networking
Dockerffm meetup 20150113_networkingDockerffm meetup 20150113_networking
Dockerffm meetup 20150113_networking
 
swarmmode-dojo
swarmmode-dojoswarmmode-dojo
swarmmode-dojo
 
pipework - Advanced Docker Networking
pipework - Advanced Docker Networkingpipework - Advanced Docker Networking
pipework - Advanced Docker Networking
 
Building a network emulator with Docker and Open vSwitch
Building a network emulator with Docker and Open vSwitchBuilding a network emulator with Docker and Open vSwitch
Building a network emulator with Docker and Open vSwitch
 
DevOps Guide to Container Networking
DevOps Guide to Container NetworkingDevOps Guide to Container Networking
DevOps Guide to Container Networking
 
Virtualbox networking
Virtualbox networkingVirtualbox networking
Virtualbox networking
 
Lesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at ProntoLesson Learned from Using Docker Swarm at Pronto
Lesson Learned from Using Docker Swarm at Pronto
 
Docker Networking – Running multi-host applications
Docker Networking – Running multi-host applicationsDocker Networking – Running multi-host applications
Docker Networking – Running multi-host applications
 
Networking in virtual machines
Networking in virtual machinesNetworking in virtual machines
Networking in virtual machines
 
Virtualbox step by step guide
Virtualbox step by step guideVirtualbox step by step guide
Virtualbox step by step guide
 
Tutorial on using CoreOS Flannel for Docker networking
Tutorial on using CoreOS Flannel for Docker networkingTutorial on using CoreOS Flannel for Docker networking
Tutorial on using CoreOS Flannel for Docker networking
 
Docker Networking & Swarm Mode Introduction
Docker Networking & Swarm Mode IntroductionDocker Networking & Swarm Mode Introduction
Docker Networking & Swarm Mode Introduction
 
Docker networking basics & coupling with Software Defined Networks
Docker networking basics & coupling with Software Defined NetworksDocker networking basics & coupling with Software Defined Networks
Docker networking basics & coupling with Software Defined Networks
 
Persistent Data Storage for Docker Containers by Andre Moruga
Persistent Data Storage for Docker Containers by Andre MorugaPersistent Data Storage for Docker Containers by Andre Moruga
Persistent Data Storage for Docker Containers by Andre Moruga
 
A New Centralized Volume Storage Solution for Docker and Container Cloud by W...
A New Centralized Volume Storage Solution for Docker and Container Cloud by W...A New Centralized Volume Storage Solution for Docker and Container Cloud by W...
A New Centralized Volume Storage Solution for Docker and Container Cloud by W...
 

Similar to Docker Networking - Current Status and goals of Experimental Networking

Similar to Docker Networking - Current Status and goals of Experimental Networking (20)

Demystfying container-networking
Demystfying container-networkingDemystfying container-networking
Demystfying container-networking
 
Docker Networking : 0 to 60mph slides
Docker Networking : 0 to 60mph slidesDocker Networking : 0 to 60mph slides
Docker Networking : 0 to 60mph slides
 
Managing multicast/igmp stream on Docker
Managing multicast/igmp stream on DockerManaging multicast/igmp stream on Docker
Managing multicast/igmp stream on Docker
 
Docker networking tutorial 102
Docker networking tutorial 102Docker networking tutorial 102
Docker networking tutorial 102
 
Building a sdn solution for the deployment of web application stacks in docker
Building a sdn solution for the deployment of web application stacks in dockerBuilding a sdn solution for the deployment of web application stacks in docker
Building a sdn solution for the deployment of web application stacks in docker
 
Managing ejabberd Platforms with Docker - ejabberd Workshop #1
Managing ejabberd Platforms with Docker - ejabberd Workshop #1Managing ejabberd Platforms with Docker - ejabberd Workshop #1
Managing ejabberd Platforms with Docker - ejabberd Workshop #1
 
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on AzureDocker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
 
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
 
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...
 
Open stackaustinmeetupsept21
Open stackaustinmeetupsept21Open stackaustinmeetupsept21
Open stackaustinmeetupsept21
 
moscmy2016: Extending Docker
moscmy2016: Extending Dockermoscmy2016: Extending Docker
moscmy2016: Extending Docker
 
Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...
Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...
Docker San Francisco Meetup April 2015 - The Docker Orchestration Ecosystem o...
 
Killer Docker Workflows for Development
Killer Docker Workflows for DevelopmentKiller Docker Workflows for Development
Killer Docker Workflows for Development
 
Docker, but what it is?
Docker, but what it is?Docker, but what it is?
Docker, but what it is?
 
DockerCon EU 2018 Workshop: Container Networking for Swarm and Kubernetes in ...
DockerCon EU 2018 Workshop: Container Networking for Swarm and Kubernetes in ...DockerCon EU 2018 Workshop: Container Networking for Swarm and Kubernetes in ...
DockerCon EU 2018 Workshop: Container Networking for Swarm and Kubernetes in ...
 
Advanced Docker Developer Workflows on MacOS X and Windows
Advanced Docker Developer Workflows on MacOS X and WindowsAdvanced Docker Developer Workflows on MacOS X and Windows
Advanced Docker Developer Workflows on MacOS X and Windows
 
OSCON: Advanced Docker developer workflows on Mac OS and Windows
OSCON: Advanced Docker developer workflows on Mac OS and WindowsOSCON: Advanced Docker developer workflows on Mac OS and Windows
OSCON: Advanced Docker developer workflows on Mac OS and Windows
 
Container Networking Deep Dive
Container Networking Deep DiveContainer Networking Deep Dive
Container Networking Deep Dive
 
How Reconnix Is Using Docker
How Reconnix Is Using DockerHow Reconnix Is Using Docker
How Reconnix Is Using Docker
 
Deploying Microservice on Docker
Deploying Microservice on DockerDeploying Microservice on Docker
Deploying Microservice on Docker
 

More from Sreenivas Makam

More from Sreenivas Makam (17)

GKE Tip Series - Usage Metering
GKE Tip Series -  Usage MeteringGKE Tip Series -  Usage Metering
GKE Tip Series - Usage Metering
 
GKE Tip Series how do i choose between gke standard, autopilot and cloud run
GKE Tip Series   how do i choose between gke standard, autopilot and cloud run GKE Tip Series   how do i choose between gke standard, autopilot and cloud run
GKE Tip Series how do i choose between gke standard, autopilot and cloud run
 
Kubernetes design principles, patterns and ecosystem
Kubernetes design principles, patterns and ecosystemKubernetes design principles, patterns and ecosystem
Kubernetes design principles, patterns and ecosystem
 
My kubernetes toolkit
My kubernetes toolkitMy kubernetes toolkit
My kubernetes toolkit
 
Top 3 reasons why you should run your Enterprise workloads on GKE
Top 3 reasons why you should run your Enterprise workloads on GKETop 3 reasons why you should run your Enterprise workloads on GKE
Top 3 reasons why you should run your Enterprise workloads on GKE
 
How Kubernetes helps Devops
How Kubernetes helps DevopsHow Kubernetes helps Devops
How Kubernetes helps Devops
 
Deep dive into Kubernetes Networking
Deep dive into Kubernetes NetworkingDeep dive into Kubernetes Networking
Deep dive into Kubernetes Networking
 
Docker Networking Tip - Macvlan driver
Docker Networking Tip - Macvlan driverDocker Networking Tip - Macvlan driver
Docker Networking Tip - Macvlan driver
 
Compare Docker deployment options in the public cloud
Compare Docker deployment options in the public cloudCompare Docker deployment options in the public cloud
Compare Docker deployment options in the public cloud
 
Docker Mentorweek beginner workshop notes
Docker Mentorweek beginner workshop notesDocker Mentorweek beginner workshop notes
Docker Mentorweek beginner workshop notes
 
Devops in Networking
Devops in NetworkingDevops in Networking
Devops in Networking
 
Docker Security Overview
Docker Security OverviewDocker Security Overview
Docker Security Overview
 
Service Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and KubernetesService Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and Kubernetes
 
CoreOS Overview and Current Status
CoreOS Overview and Current StatusCoreOS Overview and Current Status
CoreOS Overview and Current Status
 
Container Monitoring with Sysdig
Container Monitoring with SysdigContainer Monitoring with Sysdig
Container Monitoring with Sysdig
 
CI, CD with Docker, Jenkins and Tutum
CI, CD with Docker, Jenkins and TutumCI, CD with Docker, Jenkins and Tutum
CI, CD with Docker, Jenkins and Tutum
 
Docker 1.9 Feature Overview
Docker 1.9 Feature OverviewDocker 1.9 Feature Overview
Docker 1.9 Feature Overview
 

Recently uploaded

Recently uploaded (20)

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Docker Networking - Current Status and goals of Experimental Networking

  • 1. DOCKER NETWORKING Presenter Name: Sreenivas Makam Presented at: Docker Meetup Bangalore Presentation Date: August 22, 2015
  • 2. About me • Senior Engineering Manager at Cisco Systems Data Center group • Like to follow SDN and Cloud related Opensource projects and write about it. • Personal blog can be found at https://sreeninet.wordpress.com/ and my hacky code at https://github.com/smakam • You can reach me on LinkedIn at https://in.linkedin.com/in/sreenivasmakam
  • 3. Agenda • Why we need Container Networking? • Current Docker Networking Internals • Existing external networking options for Docker – Pipework, Flannel, Weave • Limitations of current Docker Networking • What’s coming up Next • Demo
  • 4. Why we need Container Networking? • Containers need to talk to external world. • Reach Containers from external world to use the services Containers provides. • Containers need to talk to host machine. • Inter-container connectivity in same host and across hosts.
  • 5. Basics • Namespaces – Virtualize processes, networks, file systems, users etc. • Software switch – could be Linux bridge, OVS, Cisco n1k, VMWare vswitch etc that resides in hypervisor used to switch traffic between VM, Container. • Iptables – for NAT kind of functionality
  • 6. Docker Networking options • –net=bridge. This is the default option that Docker provides where containers connect to the linux “docker” bridge. • –net=host. In this option, there is no new network namespace created for the container and the container shares the same network namespace as host machine. • –net=(container name or id). In this option, the new container shares the same network namespace as the specified container in the ‘net’ option. (Example: “sudo docker run -ti –name=ubuntu2 –net=container:ubuntu1 ubuntu:14.04 /bin/bash”. Here, ubuntu2 container shares same network namespace as ubuntu1 container) • –net=none. In this option, container does not get allocated a new network namespace. Only the loopback interface is created in this case. This option is useful in scenarios where we want to create our own networking options for the container.
  • 7. Default Docker Networking • Docker linux bridge(docker0) gets created on the host machine. Default IP address is 172.17.42.1 with 16 bit subnet mask. • Each Container has 2 network interface, eth0 gets IP address in 172.17.x.x network, another is loopback interface. • Host machine has veth* interface on the linux bridge to which eth0 interface in the container gets connected.
  • 9. External connectivity to Containers • To reach Apache webserver container service from outside. docker run -d -p 8080:80 smakam/apachedocker • Port 80 on the Container is mapped to port 8080 on localhost.
  • 10. Linking 2 containers on same host – Option 1 • 2 Containers Wordpress and mysql compose the Wordpress application. • Wordpress application needs to connect to mysql container. docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=mysql -d mysql docker run --name some-wordpress -e WORDPRESS_DB_PASSWORD=mysql -e WORDPRESS_DB_HOST=172.17.0.16:3306 -p 8080:80 -d wordpress • Above, we need to specify IP address and environment variable manually.
  • 11. Linking 2 containers on same host – Option 2 • In this option, we use Container linking mechanism to feed environment variables automatically. docker run --name mysql -e MYSQL_ROOT_PASSWORD=mysql -d mysql docker run --name wordpress --link mysql:mysql -d -p 8080:80 wordpress • Following environment variables automatically gets created in Wordpress container. root@ee066d135ca5:/var/www/html# set|grep MYSQL MYSQL_ENV_MYSQL_MAJOR=5.6 MYSQL_ENV_MYSQL_ROOT_PASSWORD=mysql MYSQL_ENV_MYSQL_VERSION=5.6.26 MYSQL_NAME=/wordpress/mysql MYSQL_PORT=tcp://172.17.0.24:3306 MYSQL_PORT_3306_TCP=tcp://172.17.0.24:3306 MYSQL_PORT_3306_TCP_ADDR=172.17.0.24 MYSQL_PORT_3306_TCP_PORT=3306 MYSQL_PORT_3306_TCP_PROTO=tcp
  • 12. Linking 2 containers on same host – Option 3 • In this option, we use docker-compose to create and link both the containers. Docker-compose.yml wordpress: image: wordpress links: - db:mysql ports: - 8080:80 db: image: mysql environment: MYSQL_ROOT_PASSWORD: example • We can execute “docker-compose up –d” to start the Wordpress application.
  • 13. Native Docker Networking limitations • Cannot create more than 1 interface in the container. • Multi-host containers are difficult to create. • IP addressing scheme for the containers is not flexible. • Multi-tenant container solution is not possible with enough isolation and security. • Automatic service discovery is not possible.
  • 14. Pipework • Pipework is a script developed by Jerome Petazonni to network Docker containers for complex environments. • As mentioned by Jeremy himself, the script is a temporary solution till a more permanent solution gets developed natively in Docker. • Following are some features that Pipework supports: – Connect Containers across multiple hosts. – Create any number of interfaces with arbitrary IP addresses. – Allows use of ovs bridge instead of Linux bridge. – Allows isolation of containers using vlans. – Allows configuration of IP, mac, netmask, gateway. Host 1: sudo ovs-vsctl add-port ovsbr0 gre0 -- set interface gre0 type=gre options:remote_ip=<host2 ip> sudo ~/pipework/pipework ovsbr0 <cid> 11.1.1.1/24 @10 Host 2: sudo ovs-vsctl add-port ovsbr0 gre0 -- set interface gre0 type=gre options:remote_ip= <host1 ip> sudo ~/pipework/pipework ovsbr0 <cid> 11.1.1.3/24 @10
  • 15. Weave • Weave creates a Weave bridge as well as a Weave router in the host machine. • Weave router establishes both tcp and udp connection across hosts to other Weave routers. TCP connection is used for discovery and protocol related exchange. UDP is used for data encapsulation. Encryption can be done if needed. • The Weave bridge is configured to sniff the packets that needs to be sent across hosts and redirect to the Weave router. For local switching, weave router is not used.
  • 16. Flannel • Flannel creates an Overlay network using either udp or vxlan encapsulation. • Flannel links itself to the Docker bridge to which the containers are attached and creates the overlay. • Flannel is closely integrated with CoreOS, can be used as standalone as well.
  • 17. What’s ahead - Docker Experimental Networking • Docker Experimental Networking addresses majority of the problems mentioned above. • Current approach taken is batteries-included approach where Docker provides a default Networking solution that customers can substitute with other Networking plugins based on their need. • Docker 1.8 experimental release provides a good taste of the Networking features that will be coming soon.
  • 20. Linking 2 containers on same host Web server container connecting to Database container: $ sudo docker run -d --name db training/postgres $ sudo docker run -d -p 8080:80 --name web --link db:dblink smakam/apachedocker • Webserver container gets environment variables of DB container using which it connects to database. Following environment variables gets imported automatically. # set|grep DBLINK DBLINK_ENV_PG_VERSION=9.3 DBLINK_NAME=/web/dblink DBLINK_PORT=tcp://172.17.0.3:5432 DBLINK_PORT_5432_TCP=tcp://172.17.0.3:5432 DBLINK_PORT_5432_TCP_ADDR=172.17.0.3 DBLINK_PORT_5432_TCP_PORT=5432 DBLINK_PORT_5432_TCP_PROTO=tcp

Editor's Notes

  1. Microsoft Confidential
  2. Microsoft Confidential