Docker Kata 5: Docker Networking
Explore how Docker implements software-defined networking to connect containers. Learn to list networks, ping containers by IP, create user-defined networks, and enable name resolution using Docker's embedded DNS. This lesson provides hands-on commands to manage networking for container communication.
Docker uses software-defined networking to provide containers with a means to connect to a network. Software-defined networking uses software, instead of physical devices such as hardware load balancers and routers, to define a TCP/IP network. The Docker Engine provides a set of predefined networks on which to run containers. Administrators can also define custom networks to support a wide variety of network configurations. This kata will demonstrate how to work with Docker networks.
Step 1: List all networks
First,
The command to list all Docker networks is given below.
The output will be something like:
Commands
Parameter | Description |
| This is the parent command. |
| This lists all the networks when used with the |
The docker network ls command lists all the defined Docker networks. Docker adds three networks on installation: bridge, host, and none.
The bridge network is the default network on which all containers are run.
The host network is the host’s network adapter. Containers on this network share the host’s network configuration, including IP address.
The none network is a null network. Containers on this network have no network interface.