DevOps Tutorial : Docker Networking | Docker Network commands | Custom Docker Bridge Network

    12
    17



    Hello Friends ,

    Today we are going to learn some basic commands of Docker Network.

    Docker Network Commands

    List of Available network
    docker network ls // Show the list of network

    Create new Network
    docker network create –driver [driver-name] [network-name]

    Example : docker network create –driver bridge my_network
    If the option –driver is not given then the network will be created as a bridge network. Else, the specified driver will be used.

    Provides details for the given Docker network.
    docker network inspect [network-name|network id]
    example : docker network inspect my_network

    Filter in inspect command. Ex. want to see the only container info
    docker network inspect -f ‘{{.Containers}}’ my_network // this command will give the information of only container running on
    my_network

    Remove the given Docker network.
    docker network rm [network-name|network id]

    Disconnects the given container to the specified network.
    docker network disconnect [network-name|network id] [container-name|Container ID]

    Create the container on Specific network
    docker container run -d –name [container_name] –network [network_id|network_name] [imageId|image_name]

    example : docker container run -d –name nginx_container –network my_network nginx

    Docker Network DNS

    DNS stands for Domain Name System.

    DNS makes it possible for us to use easy to remember domain names in place of complex IP addresses.

    Containers uses DNS to communicate. Containers don’t use IP address to Communicate.

    Example . Ping Nginx container from another container

    Step 1: launch 2 nginx container

    docker run -d –name nginx_01 –network my_netwrork nginx
    docker run -d –name nginx_02 –network my_netwrork nginx

    Step 2: Login to Nginx server and install ping command

    docker exec -it nginx_01 /bin/bash // After executing this command you are login into nginx and execute below command

    apt-get update
    apt-get install inetutils-ping

    Step 3: ping nginx_02 from nginx_01

    docker exec -it nginx_01 ping nginx_02

    Reference :
    https://github.com/Abhishek08/Docker

    YOUTUBE PLAYLIST
    https://www.youtube.com/channel/UCTPgiUhMnzTFVUJUswxhWJQ?view_as=subscriber

    #devops #devopsvideos #devopstutorial #jenkins #jenkinsvideos
    #jenkinstutorial #docker #dockertutorial #devopsprojects
    #devopsrealtime #devopshandson
    #devopspracticals

    #cicd #jenkinspipeline #pipeline
    #devopstraining
    #DockerImages #DockerContainers #DockerTutorials #DockerTraining #DevOpsTools #DevOpsTraining #DockerCommands #DockerForBeginners #DockerFreeTutorials #DockerforDevOps#Docker2020 #DockerTutorial2020#createcustomimage

    source

    Previous articleAdministering Beyond the Speed of Light Managing SQL Server with Ansible
    Next articleBuild and Deploy a Docker Image to a Kubernetes Cluster | Cloud Architecture | GSP304

    17 COMMENTS