Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Docker’s default bridge and a Compose project network are not interchangeable: Compose normally creates a user-defined bridge where services can find one another by service name. Use network membership to decide which services can communicate, and treat internal: true as isolation for that network—not a guarantee that every attached service is offline.

What Docker means by a bridge network

Docker Engine creates a default network named bridge. A container started without an explicit network is connected to it. Docker also supports user-defined bridge networks, which are the better fit for application stacks: they scope communication to attached containers and provide automatic name and alias discovery. Containers on a user-defined bridge can be attached to or detached from it while running. Docker’s bridge network documentation

Network type Name discovery Typical use
Docker default bridge Does not provide the same automatic container-name resolution as a user-defined bridge. Default for containers when no network is selected; not the preferred choice for service-name discovery in an application stack.
User-defined bridge Containers can resolve one another by name or alias while attached to the same network. Scoped communication among containers on one Docker Engine host.
Compose project network Compose registers service names in its internal DNS on the shared network. Default network arrangement for services in a Compose project; ordinarily a user-defined bridge.

In Compose, network_mode: bridge explicitly places a service on Docker’s default bridge. That is different from leaving a Compose service on the project’s ordinary network, and it does not give the service the project-network service-name DNS behavior. Docker recommends a user-defined network for that use. Compose service reference

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How Compose service-name DNS works

“By default, Compose sets up a single network for your app.” On that shared project network, each service is discoverable by its service name. For example, an application service can connect to a database using hostname db when both services share a network. Use the service name rather than a container IP: discovery does not promise that a container keeps a fixed IP address. Docker’s Compose networking documentation

DNS is useful only where there is network membership in common. If two services do not share a network, they cannot use that network to communicate with one another. Published ports are a separate matter: a port on a user-defined bridge is reachable by peers on that network, while access from another network or a non-Docker host requires publishing the port with -p or --publish. Docker’s bridge network documentation

Build a proxy, app, and database topology

“Proxy network” is a topology description, not a built-in Docker network driver. A straightforward layout puts the proxy and app on a frontend network, then the app and database on a backend network. The app bridges the two; the proxy and database have no shared network.

services:
  proxy:
    image: nginx
    networks: [frontend]
  app:
    image: example-app
    networks: [frontend, backend]
  db:
    image: postgres
    networks: [backend]

networks:
  frontend: {}
  backend: {}

In this example, the proxy can reach the app by its service name, and the app can reach the database as db. The proxy cannot reach the database over these networks because they do not share one. This limits direct connectivity without requiring the database to be exposed on the proxy-facing network. The pattern follows Docker’s documented Compose example. Compose networking guide

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The YAML shows network membership only; it is not a complete reverse-proxy deployment. It does not configure TLS, published ports, authentication, health checks, database credentials, or host firewall rules. Add and review those separately for your application.

What internal: true does—and does not do

Set internal: true on a Compose network when its members should not have outside connectivity through that network. Docker describes an internal network as externally isolated, without a default gateway; its documentation also describes routes and firewall rules preventing traffic to or from other networks. Containers on the internal network can still communicate with one another. Compose network reference Docker network create reference

For example, a backend can be made internal as follows:

networks:
  frontend: {}
  backend:
    internal: true

In the earlier topology, the app is attached to both networks. The internal backend does not itself provide an outside route, but the app may still reach the internet through its regular frontend network. A service’s connectivity depends on all its network attachments, so an internal membership alone does not make a multi-homed service offline. Compose networking guide

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Where bridge networking applies

Bridge networks are local to containers on the same Docker Engine host. They are not a cluster-wide network for containers on different machines. Cross-host communication requires suitable operating-system routing or a network designed for multiple hosts, such as an overlay; the right choice depends on the deployment and orchestration setup. Docker bridge driver Docker network create reference

When Compose manages the network

Compose creates and manages its project network as part of the application. If multiple Compose projects need to share a pre-existing network, configure it as external in the Compose file; that network must exist before you run docker compose up. This separates a project-owned network from one whose lifecycle is managed outside that project. Compose network reference

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.