cover-img

Docker Networks: Connecting Container

Learn docker network...

6 March, 2022

8

8

0

TABLE OF CONTENT
1. Author
2. Multi-Container Application
3. Container Networking Model
4. Docker Native Network Driver
5. working with Network driver
6. Working with Docker Network
7. Connect Disconnect and Inspect Network
8. Conclusion

1. Author

Sundram Awasthi

2. Multi-Container Application

Till we working on single Container senerio , we did't use more than one container they are completely independent to one another . Example smart phone have more than one Container with specific perpose . In such case information exchange between container is such crusial process .
The commnucation can be one-to-one , one-to-many, many-to-many , In docker these commnucation can be manage by object called DOCKER DRIVER

Docker Network driver is piece of software that enable docker network Container . It is reposible for invoking the network inside the host or within the cluster .Docker network driver is quite reliable that docker use to connect outside the world , mean that docker it self provide some native docker network driver . Docker also support the remote driver that are created and managed by thired party vendors or commnuity. Docker also provide the IP address management driver which is use for the control and managed the range by admin , if we not set it .

3. Container Network Model -

HOST NETWORK INFRASTRUCTURE -
First we have Host Network Infrastructure , that include both hardware and software infrastructure detail like using ethernet ,wifi , and host network infrastructure stack in mine case LINUX network stack .
NETWORK DRIVER -
On top we have docker network driver , which include network and IPAM Driver .
DOCKER ENGINE
On top of that driver we have docker Engine , which create indivisual network object .
CONTAINER NETWORK
On top of it we have docker network that user define or default Network container .
RUNNING CONTAINER
On top of it we have running Container , which are accomplished at least on end point .
END POINT
End point simply refers ,Container side connector represention of virtual Eithernet which is comman protocal of networking accross docker .They contain networking information such as IP address , Virtual Physical address and Port . If container connected with more than one network , it has more than one end point and IP address .
Container Network provide this information to Network driver and IPAM driver , then driver translate this request into host network suported package and transmit them to make sure container are commnucate with outside world .

4. Docker Native Network Driver -

Native Netwrok driver are use in creation of in dafult and user define network
HOST NETWORK

The idea in the host network is Network credencial of host are directly reflected to container end point, which mean container connected to itself have same IP as the host itself . it not mean that container abunden their true nature . Now let's say we have 2 Container connected to user define host network in this case both container are commnucate while virtual ethernet reflecting the capability and ability of host machine .
Bridge Network -

It is also default network for docker Container . In bridge network we don't explicit connected to container to any network , they will connected to default bridge network . Its create virtual ethernet bridge all of network connected to this container are connected to this bridge where container end point bridge connectd to host network , it mean container are isolated to host network specification .
OVERLAY NETWORK -

In industrial use of docker Commnuity and entrprise edition you can find cluster and cluster of docker host which run single connectd and atleast releavent set of containerization . such arrangement called swam mode in docker .In overlay network we have multiple host having multiple container .any combination of commnnuation might be nessary .for establishing and performing container to container application our netwrok drive can't get away by keep network IP . It also need to route application with proper host to slve this overlay network have two layer of information .

5. Working with Docker Nettwork -

let's Create our first docker Network for createing our first docker network we are using the docker network create command and furnished with driver flag and then give it name .after run the command we get the ID of the network that we created .
docker network create --driver bridge my-bridge

Now let's created another network my-bridge 1 and provide more parameter to this for better comparison , let provide subnet and Ip range and run it , again we got another id .
docker network create -1driver bridge --subnet=162.198.0.0/16 --ip-range=192.168.5.0/24 my-bridge-1

We can check the network using docker network ls command , also we can apply the filter by the command docker network ls --filter driver=bridge
docker network ls
docker network ls --filter driver=bride

6. Connected Disconnected and inspect Network -

Let's connected the one of container to one of network that we are created .
For connectd the container firstly we have to start a container as running state then for connect we use docker network connect command followed by container and network name and press enter
docker network connect my-bridge-1 my-ubuntu
After run the above command for verify that our container and network are sucessfully connected we use docker inspect command .
docker container inspect my-ubuntu
After use the inspect command it provide you detail information by which you can verify .

Here listout some more command that we can use connected and check port and inspect also disconnect the container .
docker container run -itd --network host --name cont_nginx nginx:latest
docker network port cont_nginx
docker container inspect cont_nginx
docker disconnect inspect my-ubuntu

7. Conclsion -

Yeah....
Till now we learn about docker networking , their type , how to connect the container and network , how we inspect it . Also mentioed some command to disconnect the container .
what Next ?......
yeah .. Till we learn about docker networking and thier concept . on the next seniro we learn about storage in docker and touch some networking concept again .
Thankyou for Reading ...

8

8

0

Sundram Awasthi
Student || Open Source enthusiasm || flutter developer Intern || DevOPs enthusiasm

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2025. Showcase Creators Inc. All rights reserved.