Networking in Containers
Overview
Docker containers and it's services are so powerful because these can connect together, or can connect with the workload which is not running on docker. Even our containers and services are not required to be aware that they are running on docker or not even their peers.
Network Drivers
Container uses one of network driver to communicate with host or other containers. Docker networking subsystem is plug-gable, using drivers. Several drivers exist with default installation to provide core functionalities for networking:
- bridge : This is a default network driver, if we don't specify the network driver we are creating bridge network. Bridge networks are usually used for standalone container that need to communicate.
- host : This driver removes the network isolation between container and docker host
- overlay : overlay network connects multiple docker daemon to enable swarm service. It can be used to communicate between multiple docker daemon or multiple standalone containers. This removes OS level routing between containers.
- macvlan : macvlan network all us to assign MAC address to the containers and making it to appear as physical devies. In this network Docker daemon routes traffic to container directly through MAC address. It is useful when we deal with legacy applications that expect to be connected directly to the physical network instead routed through Docker's host network
- null : null driver is used to create none network. containers attached to the none network will not have any connectivity outside them self.
Note: bridge, host and null are the only drivers which are available with default docker installation. For example: (we can check these with "docker network ls" command)
Command for Network Management
docker network <command>
<command> : connect, disconnect, create, rm, ls, inspect
- Network plugins
We can also install & use plugins with docker provided by third party vendors.
Comments