|
1 | 1 | --- |
2 | | -title: Networking overview |
| 2 | +title: Networking |
3 | 3 | linkTitle: Networking |
4 | 4 | weight: 30 |
5 | 5 | description: Learn how networking works from the container's point of view |
@@ -29,28 +29,37 @@ routing table, DNS services, and other networking details. |
29 | 29 | This page describes networking from the point of view of the container, |
30 | 30 | and the concepts around container networking. |
31 | 31 |
|
32 | | -When Docker Engine on Linux starts for the first time, it has a single |
33 | | -built-in network called the "default bridge" network. When you run a |
34 | | -container without the `--network` option, it is connected to the default |
35 | | -bridge. |
36 | | - |
37 | | -Containers attached to the default bridge have access to network services |
38 | | -outside the Docker host. They use "masquerading" which means, if the |
39 | | -Docker host has Internet access, no additional configuration is needed |
40 | | -for the container to have Internet access. |
41 | | - |
42 | | -For example, to run a container on the default bridge network, and have |
43 | | -it ping an Internet host: |
44 | | - |
45 | | -```console |
46 | | -$ docker run --rm -ti busybox ping -c1 docker.com |
47 | | -PING docker.com (23.185.0.4): 56 data bytes |
48 | | -64 bytes from 23.185.0.4: seq=0 ttl=62 time=6.564 ms |
49 | | - |
50 | | ---- docker.com ping statistics --- |
51 | | -1 packets transmitted, 1 packets received, 0% packet loss |
52 | | -round-trip min/avg/max = 6.564/6.564/6.564 ms |
53 | | -``` |
| 32 | +## Bridge network |
| 33 | + |
| 34 | +When Docker Engine starts for the first time, it uses a single |
| 35 | +built-in network called the default bridge network. This means that when |
| 36 | +you start container without specifying `--network` option, the container |
| 37 | +defaults to the `bridge` value. When your Docker host (the virtual or physical |
| 38 | +machine running Docker) has Internet access, no additional configuration is |
| 39 | +needed for the container to have Internet access. |
| 40 | + |
| 41 | +The Docker bridge network is an isolated network for containers to communicate |
| 42 | +with each other. |
| 43 | + |
| 44 | +* By default, the bridge network gives your containers |
| 45 | +access to external networks through masquerading, or borrowing your Docker |
| 46 | +host's public IP address to make and receive requests from the Internet. |
| 47 | +* While your containers communicate on the bridge network, devices |
| 48 | +with access to your external network only see communication coming from and |
| 49 | +going to your containers with your Docker host's IP address. |
| 50 | + |
| 51 | +If you want to test the bridge network, you can send a ping request |
| 52 | +from an active container and wait for the reply. For example: |
| 53 | + |
| 54 | + ```console |
| 55 | + $ docker run --rm -ti busybox ping -c1 docker.com |
| 56 | + PING docker.com (23.185.0.4): 56 data bytes |
| 57 | + 64 bytes from 23.185.0.4: seq=0 ttl=62 time=6.564 ms |
| 58 | + |
| 59 | + --- docker.com ping statistics --- |
| 60 | + 1 packets transmitted, 1 packets received, 0% packet loss |
| 61 | + round-trip min/avg/max = 6.564/6.564/6.564 ms |
| 62 | + ``` |
54 | 63 |
|
55 | 64 | ## User-defined networks |
56 | 65 |
|
|
0 commit comments