Skip to content

Commit 4bb170e

Browse files
authored
Remove incorrect difference between user-defined and default bridge (docker#10320)
* Remove incorrect difference between user-defined and default bridge This PR removes the first bullet point from the list differences between user-defined bridge networks and the default bridge network: [User-defined bridges provide better isolation and interoperability between containerized applications](https://docs.docker.com/network/bridge/#differences-between-user-defined-bridges-and-the-default-bridge). The default bridge network, similar to user-defined bridges, opens all ports to other containers and allows for inter-container communication by default. This is elaborated and demonstrated in docker#8973. Other relevant issue: docker#8437. * Remove mention of previous bullet point * Added isolation advantage of user-defined over default network
1 parent 42f005e commit 4bb170e

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

network/bridge.md

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,36 +34,16 @@ network.**
3434

3535
## Differences between user-defined bridges and the default bridge
3636

37-
- **User-defined bridges provide better isolation and interoperability between containerized applications**.
38-
39-
Containers connected to the same user-defined bridge network automatically
40-
expose **all ports** to each other, and **no ports** to the outside world. This allows
41-
containerized applications to communicate with each other easily, without
42-
accidentally opening access to the outside world.
43-
44-
Imagine an application with a web front-end and a database back-end. The
45-
outside world needs access to the web front-end (perhaps on port 80), but only
46-
the back-end itself needs access to the database host and port. Using a
47-
user-defined bridge, only the web port needs to be opened, and the database
48-
application doesn't need any ports open, since the web front-end can reach it
49-
over the user-defined bridge.
50-
51-
If you run the same application stack on the default bridge network, you need
52-
to open both the web port and the database port, using the `-p` or `--publish`
53-
flag for each. This means the Docker host needs to block access to the
54-
database port by other means.
55-
5637
- **User-defined bridges provide automatic DNS resolution between containers**.
5738

5839
Containers on the default bridge network can only access each other by IP
5940
addresses, unless you use the [`--link` option](/network/links/), which is
6041
considered legacy. On a user-defined bridge network, containers can resolve
6142
each other by name or alias.
6243

63-
Imagine the same application as in the previous point, with a web front-end
64-
and a database back-end. If you call your containers `web` and `db`, the web
65-
container can connect to the db container at `db`, no matter which Docker host
66-
the application stack is running on.
44+
Imagine an application with a web front-end and a database back-end. If you call
45+
your containers `web` and `db`, the web container can connect to the db container
46+
at `db`, no matter which Docker host the application stack is running on.
6747

6848
If you run the same application stack on the default bridge network, you need
6949
to manually create links between the containers (using the legacy `--link`
@@ -72,6 +52,12 @@ network.**
7252
Alternatively, you can manipulate the `/etc/hosts` files within the containers,
7353
but this creates problems that are difficult to debug.
7454

55+
- **User-defined bridges provide better isolation**.
56+
57+
All containers without a `--network` specified, are attached to the default bridge network. This can be a risk, as unrelated stacks/services/containers are then able to communicate.
58+
59+
Using a user-defined network provides a scoped network in which only containers attached to that network are able to communicate.
60+
7561
- **Containers can be attached and detached from user-defined networks on the fly**.
7662

7763
During a container's lifetime, you can connect or disconnect it from

0 commit comments

Comments
 (0)