Network model of the container:
Closed container:
There is only one interface: Loopback
Not participate in network communication, only for applications without network communication, such as backup, program debugging, etc.
--net None
Bridged container:
There are two interfaces for this type of container:
Loopback
Ethernet interface: Bridge to Docker daemon settings used by the bridge, the default is Docker0;
--net Bridge
-H,--hostname hostname
--dns dns_server_ip
--add-host "Hostname:ip"
Docker0 the container on the Nat bridge model is published to external network access:
-P <containerPort>
Only the container port is given, indicating that the specified container port is mapped to a random port on the host;
-P Mapping the
-P Map a random port on the host's
-P Map Port
-P,--publish-all
Publish all the ports, along with the--expose option to indicate the external ports to expose;
If you do not want to start the container by using the default Docker0 bridge interface, you need to run the Docker Daemon command using the
-B Option: Specify the bridge to use;
Federated Containers:
When starting a container, let it use the network namespace of an already existing container;
--net Container:container_name
Open containers:
The container uses the host's network name space;
--net Host
Dependencies between containers:
Link mechanism: Linking
--link
Resource Limits for containers:
Options for the Run command:
-M
--cpuset-cpus
--shm-size
"Linux" "Services" "Docker" network