Docker Kata 5: Docker Networking

Learn how to list containers, ping between containers, create a user-defined network, and run containers on the network.

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, stopstop and removeremove all the containers.

The command to list all Docker networks is given below.

Press + to interact
docker network ls

The output will be something like:

Listing all the Docker networks

Commands

Parameter

Description

docker network

This is the parent command.

ls

This lists all the networks when used with the docker network parent command.

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 ...

Get hands-on with 1400+ tech skills courses.