Docker Networking - [ Hands-on ]

In this hands-on, we are creating the to do list using the custom network, and also explain the all docker network drivers.

In the docker , there are 6 types of Network & In the Bridge network, there are 2 subtypes.

Bridge network

a. default b. Custom

Default bridge network driver. Creates a private internal network on a single host, by default.

custome bridge network driver. created by ourselves for the container

Host Network -

Removes network isolation between the container and the Docker host, using the host's network directly.

none network -

Disables all networking. Containers attached to this network cannot communicate with the outside world or with other containers.

Overlay network -

Enables communication between containers across multiple Docker hosts.

Macvlan:

Allows you to assign a MAC address to a container, making it appear as a physical device on your network.

IP Lan Network :

an IP LAN (Local Area Network) refers to a network that is limited to a small geographic area, such as a single building, office, or campus. LANs are used to connect devices like computers, printers, servers, and other networked devices within a specific location

In the Docker , We can create and manage own IP LAN networks using user-defined bridge networks. When create a custom bridge network, Docker provides a private internal network on a single host. Containers connected to this network can communicate with each other using IP addresses.

When we install the docker, there are 3 docker network automatically install, which is default.

There are 3 Network , which are created default network in the Docker .

  1. Bridge network - default

  2. host network

  3. none network

Custom Bridge-

Customs Bridge is network which is we need to create ourself,

docker network create {name } 

using this command we can create the bridge network

So now , we can create the custom network , and using this network create a image and deploy it on the container .

Created Neatwork

Cloning the repository

git clone https://github.com/Bhushan0151/django-todo-cicd.git

DockerFile for the todo- list

we are using this docker file for creating the todo-list

Building an Image -

using the docker file we are building an image for running the container .

sudo docker build -t <Image name>

Command for run the Container

sudo docker run -t --name <container name> --network <custom network name> -p 8000:8000 <image name>:<tag>

todo list --using the custom network running on the 8000 port which is mention in the previous command

logs of the container showing the which neetwork we use for the running the todo list container

none Network

Last updated