Overlay Network Overlay Networks
Docker Network
After the Docker installation is complete, there are three types of network
Bridge
Host
None
[[email protected] ~] #docker network lsNETWORK ID NAME DRIVER scopea636fa65e954 bridge bridge localb4c906b718f6 host host local764d5cb64812 none nUll local
Note: If you do not specify a network type when creating a container, the default is bridged network (NAT Bridge)
Four types of Docker network models
Closed container
Do not participate in network communication, processes running in such containers can only access the local loopback interface
Applies only to scenarios where the process does not require network communication, such as: Backup, Process diagnostics, and various offline tasks
~]# Docker run--rm--net none busybox:latest ifconfig-a
Bridged container
A bridged network typically has two interfaces: a loopback interface an Ethernet interface connected to a bridge device on the host
A network bridge named Docker0 is created by default when Docker daemon starts, and the container is created as a bridged container with its Ethernet interface bridged to Docker0
--net Bridge to add the container interface to the Docker0 bridge
The Docker0 Bridge is a NAT bridge, so bridge-type containers can access the external network through this bridge interface, but fire rules prevent all requests to access the bridging container from the external network
~]# Docker run--rm--net Bridge busybox:latest ifconfig-a
Joined container
A federated network is a container that uses a network interface of an existing container, which is shared by each container within the Federation, so that the federated containers are completely isolated from each other, for example:
Create an HTTP server that listens on port 2222
Open container
An open network shared host network namespace container that has full access to the host's network namespace, including access to those critical services, a potential threat to host security
Setting the network type when creating a container
Use--network when creating
Docker Networking && Data Volume