Docker containers leveraging VSwitch
Aug 24, 2017 · 2 min read
Docker Networking on single host
When you install Docker, it creates three networks automatically. You can list these networks using the docker network ls command:

Single host communication
- When we launch a container, it is automatically connected to the default
bridgenetwork,unless specified - Containers connected to the default
bridgenetwork can communicate with each other by IP address. Docker does not support automatic service discovery on defaultbridgenetwork - It is recommended to use user-defined bridge networks to control which containers can communicate with each other, and also to enable automatic DNS resolution of container names to IP addresses
- This is as simple as creating our own
bridgenetwork and then launching containers on it. The scope of such a network is the docker host on which it is created - Creating a bridged network will create a Virtual Switch(or VSwitch) in the docker host,entirely in s/w
- The docker bridge driver leverages the linux bridge of the kernel(for docker on linux).
Commands and steps for the above
- sudo docker network create -d bridge — -subnet 10.0.0.1/24 ps-bridge

2. sudo docker run -dt — name container1 — network ps-bridge alpine sleep 1d
3. sudo docker run -dt — name container2 — network ps-bridge alpine sleep 1d

4. Checking connection

