Docker network

Commands

  • docker network ls
    • list the network present on docker

Example :

Create two docker alphine container and establish a connectivity between them

  • docker run -dit –name alpine1 alpine ash
    • Container with name alpine 1 created
  • docker run -dit –name alpine2 alpine ash
    • Container with name alpine 2 created
  • docker ps
    • List the running containers
  • docker network ls
    • Get the name of networks
  • docker network inspect bridge
    • To find the details of network details
  • docker attach alpine1
    • Get the terminal for alpine1
  • ip addr show
    • shows all the network driver connected along with ip
  • ping google.com
    • to check the internet connectivity
  • ping 172.12.0.3
    • this shows the connectivity between two containers are established in defalt bridge connectivity

Leave a Comment