Prodinit Software Solutions
LinkedinGithub
  • Prodinit's Engineering Blog
  • aws
    • Ways to delete AWS ECR images
    • Enable Cloudwatch Alarm and SNS Topic for AWS Billing Alert
    • A-Z of AWS VPC and other services - with Terraform
    • How Internet Works?
    • How to download/view code running in your lambda functions?
  • backend engineering
    • What is idempotency?
  • databases
    • Database Optimisation - Indexing vs Sharding with Postgres and Django ORM examples
  • devops
    • Docker Best Practices
    • Docker Networking - Bridge vs Host vs Overlay
    • A comparision between multistage build and singlestage build in Docker
    • Things to remember before building your first blue/green deployment in Kubernetes
    • How to export env variables in circleci? (You wont find this in circleci documentation)
  • frontend engineering
    • Host your static website with s3, CloudFront, Route53, and domain from godaddy in 4 easy steps
  • product management
    • You'll fail as a lead developer, here's why ...
  • python
    • Achieve Peak Performance in Python
    • Play with List of dictionaries in Python
    • How we develop a custom autoscaling metrics based on number of tasks in the queues?
  • Contact Us
    • Who are we?
    • Work with us.
Powered by GitBook
On this page
  • What is Networking?
  • Networking Scenarios
  • Types of Networking
  • Bridge Networking
  • Host Networking
  • None Networking
  • Overlay Networking
  • Conclusion
  • Enjoyed the blog? If so, you'll appreciate collaborating with the minds behind it as well.
  1. devops

Docker Networking - Bridge vs Host vs Overlay

PreviousDocker Best PracticesNextA comparision between multistage build and singlestage build in Docker

Last updated 1 year ago

What is Networking?

It allows one docker container to interact/communicate with other docker containers and the host system.

Networking Scenarios

  1. Container 1 can talk to Container 2

  2. Container 1 is isolated from Container 2

  3. Host can talk to both Container 1 and Container 2

Types of Networking

  1. Bridge Networking

  2. Host Networking

  3. Overlay Networking

Bridge Networking

You launch a host (EC2/VM/droplet/etc), that host is comes up with a default eth0 network, suppose 172.10.1.1.

When you run a docker container inside the host, the container will have its own default eth0 network, suppose 172.11.1.1

Now, when host with x.x.1.1 IP tries to ping docker container with x.x.1.2 IP, it gets a networking error.

To solve this, docker by default creates a veth virtual eth and connect it with both docker container and the host. veth acts like a bridge and allows communication between docker container and host. This veth is called bridge network.

You can create custom bridge networks to achieve isolated networks for any container.

Host Networking

It is a networking mode in which a Docker container shares its network namespace with the host machine. For example, If you run a container that binds to port 80 and uses host networking, the container’s application is available on port 80 on the host’s IP address.

One limitation with the host driver is that it doesn’t work on Docker desktop: you need a Linux host to use it.

None Networking

The none network driver does not attach containers to any network. Containers do not access the external network or communicate with other containers. You can use it when you want to disable the networking on a container.

Overlay Networking

Overlays use networking tunnels to deliver communication across hosts. This allows containers to behave as if they are on the same machine by tunneling network subnets from one host to the next.

Overlays focus on the cross-host communication challenge.

Conclusion

We have covered docker networking, networking scenarios and types of networks.

  • Reach us out if you need help in containerising your applications.

Tags

Enjoyed the blog? If so, you'll appreciate collaborating with the minds behind it as well.

Bridge Networking

Written by -

Dishant Sethi