You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Copy file name to clipboardExpand all lines: network/bridge.md
+9-23Lines changed: 9 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,36 +34,16 @@ network.**
34
34
35
35
## Differences between user-defined bridges and the default bridge
36
36
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
-
56
37
-**User-defined bridges provide automatic DNS resolution between containers**.
57
38
58
39
Containers on the default bridge network can only access each other by IP
59
40
addresses, unless you use the [`--link` option](/network/links/), which is
60
41
considered legacy. On a user-defined bridge network, containers can resolve
61
42
each other by name or alias.
62
43
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.
67
47
68
48
If you run the same application stack on the default bridge network, you need
69
49
to manually create links between the containers (using the legacy `--link`
@@ -72,6 +52,12 @@ network.**
72
52
Alternatively, you can manipulate the `/etc/hosts` files within the containers,
73
53
but this creates problems that are difficult to debug.
74
54
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
+
75
61
-**Containers can be attached and detached from user-defined networks on the fly**.
76
62
77
63
During a container's lifetime, you can connect or disconnect it from
0 commit comments