Docker Network

Docker Network

Docker Network

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed docker images.

https://cloudaffaire.com/docker-images/

In this blog post, we will discuss docker network. We will also create a bridge network and connect our existing docker container to it.

Prerequisite for this demo:

  • One AWS EC2 instance with Linux 2 AMI and internet access.
  • Docker

What is docker network?

Docker network serves as the backbone of docker for communication between host, containers and remote. Docker’s networking subsystem is pluggable, using drivers. Several drivers exist by default and provide core networking functionality.

Docker network driver types:

  • bridge: The default network driver. If you don’t specify a driver, this is the type of network you are creating. Bridge networks are usually used when your applications run in standalone containers that need to communicate.
  • host: For standalone containers, remove network isolation between the container and the Docker host, and use the host’s networking directly. host is only available for swarm services on Docker 17.06 and higher.
  • overlay: Overlay networks connect multiple Docker daemons together and enable swarm services to communicate with each other. You can also use overlay networks to facilitate communication between a swarm service and a standalone container, or between two standalone containers on different Docker daemons. This strategy removes the need to do OS-level routing between these containers.
  • macvlan: Macvlan networks allow you to assign a MAC address to a container, making it appear as a physical device on your network. The Docker daemon routes traffic to containers by their MAC addresses. Using the macvlan driver is sometimes the best choice when dealing with legacy applications that expect to be directly connected to the physical network, rather than routed through the Docker host’s network stack.
  • none: For this container, disable all networking. Usually used in conjunction with a custom network driver. none is not available for swarm services.
  • third-party network plugins: You can install and use third-party network plugins with Docker. These plugins are available from Docker Hub or from third-party vendors.

Network driver available by default: You can list network drivers available by default using docker network ls command.

Docker Network

Docker Network Demo:

Docker Network

Hope you have enjoyed this article. In the next blog post, we will discuss docker volume.

To get more details on docker, please refer below docker documentation

https://docs.docker.com/

 

Leave a Reply

Close Menu