Main Menu

Search

DOCKER: How To Create Bridge Network For Enabling Communication Between Docker Containers Running On Same Host? (DevOps)

FDocumentation on Docker Bridge Networks can be found at https://docs.docker.com/network/bridge/

Following are steps to create Bridge networks for Dockers

1. Create Bridge Network using below command.

docker network create -d bridge <bridge-network-name>

Following is sample output of above command. In this case we created network by name weblogic

#docker network create -d bridge weblogic
5c36fbc01eacef39387a3aec8d35324e523813bb27aa9508db7878f78af15e8d
 


2. Check if the Bridge network got created using below command.

docker network ls

Following is sample output of above command. In this case we see bridge network by name weblogic created.

# docker network ls
NETWORK ID NAME DRIVER SCOPE
a1d4a09ed294 bridge bridge local
79652466acbc host host local
b2376b3d239e none null local
5c36fbc01eac weblogic bridge local

 

3. For e.g. if you want to run docker container to use bridge network, docker run command has to be run with --net option. For e.g. below is the command.

docker run -d --net <bridge-network> -p port1:port2 <image-name>

 


Products to which Article Applies

Docker 

Search Keywords: Docker Dockers network networks bridge communication nw between container containers how to creating ping enable host hosts

Article Author: Tarun Boyella

 

No comments:

Post a Comment