Challenge Easy

Docker 101: List Docker Networks and Inspect the Default Bridge

Explore the container networks of a freshly installed Docker host: find the default network, its subnet and gateway, and the Linux interface behind it.
Important

This challenge focuses on Docker Engine running directly on a Linux server, which is the setup most production Docker installations use. Docker Desktop runs Docker Engine inside a separate VM, so the network interfaces Docker creates are not visible on your computer directly.

In the previous challenge, you found the IP addresses of a few containers. In this challenge, you will explore where these addresses come from.

Docker networks created by a Docker Engine upon installation on a Linux server.

List the Networks

Docker keeps container networking settings in networks. A network object defines how its containers can reach each other, the Docker host, and the outside world. Docker creates a few networks on its own when it starts for the first time. The docker network command manages Docker networks, and it has subcommands to list, inspect, create, and remove them.

Find out which networks exist on the host:

Hint: Listing networks

Most Docker objects (containers, images, volumes, networks) can be listed with an ls subcommand. Check the docker network --help output.

Find the Default Network

Every container that is started without extra network options ends up on the default network. Which network does Docker attach a new container to when docker run is called without the --network flag?

Hint: Checking a container's network

Start a container without any network options and look at the NetworkSettings section of its docker inspect output.

Inspect the Default Bridge

The docker network inspect command shows the configuration of a network as JSON. Its IPAM section (IP Address Management) describes the range of addresses that containers on the network get. What subnet does the default bridge network use?

Containers send traffic destined for other networks to the gateway address, and this address belongs to the Docker host itself. What is the gateway address of the default bridge network?

Note

Knowing the Docker network subnet and the gateway address might be needed when writing firewall rules or access lists for traffic coming to/from containers.

Find the Bridge Interface

A Docker network exists inside Docker, but on a Linux host every bridge network is backed by a virtual network interface. The host's routing table sends all traffic for the network's subnet through it.

Which network interface on the Docker host holds the gateway address of the default bridge network?

Hint: Finding the interface

The ip -br addr command lists the network interfaces of the host together with their addresses. The docker network inspect output also names the interface in its Options section. Pick the command you like more.