What sets a bridge network apart from a custom network

Docker networking decides how containers talk to each other and to the outside world. By default, every container joins the built-in bridge network: it shares an internal subnet and can reach other containers by IP, but that network runs no DNS server at all, so a container name never resolves. This lab proves it live: a ping by name on the default bridge fails first, then succeeds the moment the containers share a network created with docker network create.

Embedded DNS and isolation on custom networks

When you create a network with docker network create, Docker turns on an embedded DNS server at 127.0.0.11 inside every container attached to it. Any container on that network can resolve any other by name, with no manual /etc/hosts editing. The flip side is isolation: a container that isn’t attached to that network can’t even resolve the name of the containers that are, so two applications can share the same host without seeing each other unless you explicitly bridge them with docker network connect.

Publishing ports to the host

Publishing a port with -p host:container is a separate concern entirely: it has nothing to do with container-to-container networking, it’s about exposing a service to the host and, from there, to the outside network. If you already installed Docker on Debian with our Docker on Debian install guide, this lab is the natural next step: go deeper into every network driver in our Docker networking: bridge, host and custom networks article, check how to persist data in our Docker volumes and bind mounts guide, and if you want a full environment to practice on, start with our self-hosted home lab. For the official reference on every driver, see the Docker networking documentation, the bridge(8) man page on man7.org for the underlying Linux bridge, and the project’s source at github.com/moby/moby.

FAQ

Why can't I ping a container by name on the default bridge network?

Because the default bridge network runs no internal DNS server at all: it only hands out IPs and routes traffic between containers. To resolve names you need to create your own network with docker network create, which does turn on Docker's embedded DNS at 127.0.0.11.

What is the difference between the default bridge network and a custom network in Docker?

The default bridge is created automatically by Docker and only connects containers by IP. A custom network is one you create yourself with docker network create, where you choose the subnet and, crucially, it turns on internal DNS so containers find each other by name and stay isolated from other networks.

How do I make a container belong to two Docker networks at once?

With docker network connect <network> <container>, no recreation needed. The container stays attached to its original network and the new one at the same time, and it can resolve by name any container on either network it belongs to.